forked from acassen/keepalived
-
Notifications
You must be signed in to change notification settings - Fork 0
/
INSTALL
229 lines (185 loc) · 7.14 KB
/
INSTALL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
Kernel needs
==============
Compile a kernel with the following options :
Kernel/User netlink socket
LinuxVirtualServer
Keepalived supports all LVS code.
Library dependencies
====================
In order to compile Keepalived needs the following libraries :
* OpenSSL, <www.openssl.org>
Linux flavours
==============
RedHat based systems (RedHat Enterprise/CentOS/Fedora)
------------------------------------------------------
The following build packages are needed:
make
autoconf automake (to build from git source tree rather than tarball)
The following libraries need to be installed:
openssl-devel libnl3-devel ipset-devel iptables-devel libnfnetlink-devel
For magic file identification support:
file-devel
For SNMP support:
net-snmp-devel
For DBUS support:
glib2-devel
For JSON support:
json-c-devel
For PCRE support
pcre2-devel
For nftables support
libnftnl-devel libmnl-devel
For building the documentation, the following packages need to be installed:
Fedora: python-sphinx (will pull in: python2-sphinx_rtd_theme)
CentOS-and-friends: python-sphinx epel-release python-sphinx_rtd_theme
For latex or pdf files, the following are also needed:
Fedora: latexmk python-sphinx-latex
CentOS-and-friends: latexmk texlive texlive-titlesec texlive-framed texlive-threeparttable texlive-wrapfig texlive-multirow
Debian/Ubuntu
-------------
On Debian, install:
pkg-config
On Ubuntu, install:
build-essential pkg-config, and to build from git repo automake autoconf
The following libraries need to be installed:
iptables-dev libipset-dev libnfnetlink-dev libnl-3-dev libnl-genl-3-dev libssl-dev
For magic file identification support:
libmagic-dev
For SNMP support:
libsnmp-dev
For DBUS support:
libglib2.0-dev
For JSON support:
libjson-c-dev
For PCRE support:
libpcre2-dev
For nftables support
libnftnl-dev libmnl-dev
For building the documentation, the following packages need to be installed:
python-sphinx python-sphinx-rtd-theme
For latex or pdf files, the following are also needed:
texlive-latex-base texlive-generic-extra texlive-latex-recommended texlive-fonts-recommended texlive-latex-extra
Alpine Linux
------------
The following libraries need to be installed:
iptables-dev ipset-dev libnfnetlink-dev libnl3-dev musl-dev and openssl-dev or libressl-dev
For magic file identification support:
TBD
For SNMP support:
net-snmp-dev (requires libressl-dev and not openssl-dev)
For building the documentation, the following packages need to be installed:
py-sphinx py3-sphinx_rtd_theme
For latex or pdf files, you'll need texlive or similar, which is not yet
available as a distro package.
Archlinux
---------
Run the following to install the required libraries:
pacman -S ipset libnfnetlink libnl1
For magic file identification support:
TBD
For SNMP support:
pacman -S net-snmp
for PCRE support:
pcre-2 (may be installed by default)
For building the documentation, the following packages need to be installed:
python-sphinx python-sphinx_rtd_theme
For latex or pdf files, the following are also needed:
texlive-core texlive-bin texlive-latexextra
Kernel configuration requirements
---------------------------------
The following list is probably incomplete, and will be updated as other
options become known.
BPF
EPOLL
SIGNALFD
TIMERFD
SYSCTL
PROC_FS
INET
IP_MULTICAST
IPV6
IP_VS (unless --disable-lvs is specified)
IP_VS suboptions to match the real_server/virtual_server configuration
NETFILTER_XTABLES - if strict_mode or no_accept.
NETFILTER_XT options and IP_SET
NF_TABLES and associated components - to use nftables for strict_mode or no_accept
IP_ADVANCED_ROUTER and various associated options if static/dynamic routes specified
FIB_RULES if static or dynamic rules are specified
Installing from a git repo
==========================
To install from a git repo, execute:
1. Ensure you have autoconf and automake installed
2. git clone http://github.com/acassen/keepalived
3. cd keepalived
4. ./build_setup # generate the autoconf and automake environment
5. Follow the instructions below for Installation, omitting the first two steps.
Installation
============
1. tar -xf TARFILE
2. cd into the directory
3. './configure'
4. 'make'
5. 'make install'. This will install keepalived on your system,
binaries and configuration file :
* keepalived : The keepalived daemon program.
* genhash : The MD5 url digest generator. You need it to
configure HTTP GET check and SSL GET check in
order to compute MD5SUM digest etalon.
* /etc/keepalived/keepalived.conf
6. link keepalived.init into your runlevel directory. On Red Hat systems :
ln -s /etc/rc.d/init.d/keepalived.init /etc/rc.d/rc3.d/S99keepalived
By default the configure script uses /usr/local as base directory. You can
change this value to your own by passing it the --prefix value.
eg: './configure --prefix=/usr/'
Building RPM files
==================
If building from tarball:
1a. tar -xf TARFILE
1b. cd into the directory
If building from git clone:
1. ./build_setup
For tarball and git
2. ./configure
3. make rpm
The .rpm files will be created in directory `rpm --eval "%{_rpmdir}"`/ARCH
Modifying source code
=====================
If you modify the source code, especially configure.ac or any Makefile.am
file, you will need to regenerate the build files. Keepalived uses automake
and so you will need to have automake and autoconf installed.
Configuration
=============
Just take a look at the /etc/keepalived/keepalived.conf file installed.
It will give you all the information needed. Alternativley, run
'man keepalived.conf' or look at doc/keepalived.conf.SYNOPSIS.
If you want more information about keepalived, please refer to the
keepalived homepage into the documentation section.
http://www.keepalived.org
Creating a docker container
===========================
There is a very useful github project maintained by osixia for building a
docker container with keepalived.
To use, run the following:
git clone https://github.com/osixia/docker-keepalived.git
cd docker-keepalived
make build
docker run --name keepalived --cap-add=NET_ADMIN --net=host \
--env KEEPALIVED_INTERFACE=eth0 -d osixia/keepalived:1.3.5 \
# or whatever version of keepalived you have
To update the keepalived source code, put a new tarball in the image
directory (the Dockerfile may need updating with a new version).
Useful docker commands are:
docker logs keepalvied 2>&1 | lessa # view system logs of container
docker exec it keepalived bash # execute shell in container
docker rm -f keepalived # Remove the container
keepalived is unable to load the ip_tables, ip6_tables, xt_set and ip_vs
modules from within the container, so ensure they are already loaded in
the host system.
To generate a core file in the root filesystem of the container,
/proc/sys/kernel/core_pattern needs to be updated in the host system,
and not from the container (or in other words the -M option to keepalived
does not work within a container. Installing gdb in the container (edit
the image/Dockerfile to add it before make build) may be helpful if you
need to examine core files in the container.
Have fun with it !
Alexandre, <[email protected]>