Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

CentOS7 source code installation and deployment of keepalived-2.1.5

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article focuses on "CentOS7 source code installation and deployment of keepalived-2.1.5", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn "CentOS7 source code installation and deployment of keepalived-2.1.5" bar!

1. Basic environment system version nginx version keepalived version ip function CentOS Linux release 7.6nginx/1.18.0keepalived-2.1.5192.168.86.135masterCentOS Linux release 7.6nginx/1.18.0keepalived-2.1.5192.168.86.136slave

VIP:192.168.86.137

II. Installation of the compiler environment

Yum-y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel pcre pcre-devel

III. Install nginx

Install nignx

# enter the directory cd / tools # to upload installation files And extract tar-zxvf nginx-1.18.0.tar.gz# into the installation directory cd nginx-1.18.0# to check the configuration. / configure-- prefix=/usr/local/nginx make&&make install# to view the nginx version / usr/local/nginx/sbin/nginx-v# configuration nginx (check) / usr/local/nginx/sbin/nginx-t#nginx management commands / usr/local/nginx/sbin/nginx # start / usr/local/nginx/sbin/nginx-s stop # stop / usr/local/nginx/sbin/nginx-s reload # reload the configuration file

Modify nginx configuration file

Modify the content of the Nginx welcome home page (for later testing, to distinguish the Nginx of the two nodes):

Master

Echo 'this is master 135' > / usr/share/nginx/html/index.html

Slave

Echo 'this is slave 136' > / usr/share/nginx/html/index.html

Modify nginx.conf

# vi / usr/local/nginx/conf/nginx.conuser root;worker_processes 1 leading errorists log logs/error.log;#error_log logs/error.log notice;#error_log logs/error.log info;#pid logs/nginx.pid;events {worker_connections 1024;} http {include mime.types; default_type application/octet-stream # log_format main'$remote_addr-$remote_user [$time_local] "$request" #'$status $body_bytes_sent "$http_referer" #'"$http_user_agent"$http_x_forwarded_for"; # access_log logs/access.log main; sendfile on; # tcp_nopush on; # keepalive_timeout 0; keepalive_timeout 65 # gzip on; server {listen 88; server_name localhost; # charset koi8-r; # access_log logs/host.access.log main; location / {root html; index index.html index.htm } # error_page 404 / 404.html; # redirect server error pages to the static page / 50x.html error_page 500502 503504 / 50x.html; location = / 50x.html {root html;}

Start nginx

Systemctl start nginx

Test nginx startup

Curl localhostthis is master IV. Install keepalived1, create a dependent environment yum-y install libnl libnl-devel gcc openssl-devel libnl3-devel pcre-devel net-snmp-agent-libs libnfnetlink-devel curlmkdir / etc/keepalivedwget https://www.keepalived.org/software/keepalived-2.1.5.tar.gz2, install keepalivedtar-zxvf keepalived-2.1.5.tar.gzcd keepalived-2.0.15./configure-- prefix=/usr/local/keepalived-2.1.5 make & & make install3, Create the startup file ln-s / usr/local/keepalived-2.1.5/ usr/local/keepalivedmkdir / etc/keepalived/cp / usr/local/keepalived/etc/keepalived/keepalived.conf / etc/keepalived/cp / usr/local/keepalived-2.1.5/etc/sysconfig/keepalived / etc/sysconfig/ n-s / usr/local/keepalived-2.1.5/sbin/keepalived / usr/sbin/ the following files need to be copied from the keepalived source directory There is no cp cp / tools/keepalived-2.1.5/keepalived/keepalived.service / etc/systemd/system/ cp / tools/keepalived-2.1.5/keepalived/etc/init.d/keepalived / etc/init.d/4 in the installation directory, create configuration file

Master

Cat > / etc/keepalived/keepalived.conf / etc/keepalived/keepalived.conf / etc/keepalived/nginx_check.sh

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report