#!/bin/bash
# author: kuangl
# mail: kuangl@orient-media.com
# description: The installation of Nginx files.
# -------------------------------------------------------- #
## Nginx_install
# -------------------------------------------------------- #
# Nginx installation
#CURRENT_PATH=$(pwd)
for
i
in
$(rpm -q gcc gcc-c++ kernel-devel openssl-devel zlib-devel popt-devel popt-static libnl-devel wget
make
|
grep
'not installed'
|
awk
'{print $2}'
)
do
yum -y
install
$i
done
[ -d
/root/software
]
[
"$?"
!= 0 ] &&
mkdir
/root/software
cd
/root/software
[ !-e pcre-8.33.
tar
.gz ] && wget
ftp
:
//ftp
.csx.cam.ac.uk
/pub/software/programming/pcre/pcre-8
.33.
tar
.gz
tar
-zxvf pcre-8.33.
tar
.gz
cd
pcre-8.33
.
/configure
make
&&
make
install
echo
$? || [ $? != 0] ||
echo
" installation pcrefailed"
||
exit
1
cd
/root/software
[ ! -e nginx-1.2.9.
tar
.gz ] && wget http:
//nginx
.org
/download/nginx-1
.2.9.
tar
.gz
tar
-zxvf nginx-1.2.9.
tar
.gz
cd
nginx-1.2.9
.
/configure--prefix
=
/usr/local/nginx
--with-http_ssl_module --with-http_sub_module
--with-http_stub_status_module--with-http_gzip_static_module
make
&&
make
install
echo
$? || [ $? != 0] ||
echo
" installationnginxfailed"
||
exit
1
# -------------------------------------------------------- #
## Keepalived_intsall
# -------------------------------------------------------- #
# Keepalived installation
cd
/root/softwarae
[ ! -e keepalived-1.2.4.
tar
.gz ] &&wget http:
//www
.keepalived.org
/software/keepalived-1
.2.4.
tar
.gz
tar
-zxvf keepalived-1.2.4.
tar
.gz
cd
keepalived-1.2.4
ln
-s
/usr/src/kernels/
$(
uname
-r)
/usr/src/kernels/linux
.
/configure
--prefix=
/usr--bindir
=
/usr/bin--sbindir
=
/usr/bin--libexecdir
=
/usr/libexec
--localstatedir=
/var
--libdir=
/lib64--infodir
=
/usr/share/info--sysconfdir
=
/etc
--mandir=
/usr/local/share/man--with-kernel-dir
=
/usr/src/kernels/linux
make
&&
make
install
echo
$? || [ $? != 0] || print
" installation keepalivedfailed"
||
exit
1
chkconfig --add keepalived
chkconfig --level 345 keepalived on