配置lvs客户端模式~#!/bin/bash SNS_VIP=10.10.10.88 source /etc/rc.d/init.d/functions case "$1" in start) ifconfig lo:0 $SNS_VIP netmask 255.255.255.255 broadcast $SNS_VIP /sbin/route add -host $SNS_VIP dev lo:0 echo "1" >/proc/sys/net/ipv4/conf/lo/arp_ignore echo "2" >/proc/sys/net/ipv4/conf/lo/arp_announce echo "1" >/proc/sys/net/ipv4/conf/all/arp_ignore echo "2" >/proc/sys/net/ipv4/conf/all/arp_announce echo "RealServer Start OK" ;; stop) ifconfig lo:0 down route del $SNS_VIP >/dev/null 2>&1 echo "0" >/proc/sys/net/ipv4/conf/lo/arp_ignore echo "0" >/proc/sys/net/ipv4/conf/lo/arp_announce echo "0" >/proc/sys/net/ipv4/conf/all/arp_ignore echo "0" >/proc/sys/net/ipv4/conf/all/arp_announce echo "RealServer Stoped" ;; *) echo "Usage: $0 {start|stop}" exit 1 esac exit 0
lnmp自动安装脚本,含有eaccelerator memcache组件
这个是完整的配置脚本,可以把MySQL部分取消~
版本我选择的是
pcre-8.01.tar.gz, nginx-1.0.2.tar.gz, mysql-5.1.41.tar.gz, php-5.3.3.tar.bz2, memcache-2.2.5.tgz
#!/bin/sh srcpath=/usr/src apppath=/usr/local sleep 5 if [ $UID -ne 0 ];then echo “This script must use administrator or root user ,please exit …….” sleep 2 exit 1 fi Download () { cd $srcpath && wget {pcre-8.01.tar.gz,nginx-1.0.2.tar.gz,mysql-5.1.41.tar.gz,php-5.3.3.tar.bz2,memcache-2.2.5.tgz,php-fpm.conf,php.ini,nginx.conf,fcgi.conf,eaccelerator-0.9.6.1.tar.bz2} echo “THIS IS STARTING SHELL MAKE INSTALL SHELL ,PLEASE WAITING ………………………..” sleep 2s if [ $? -eq 0 ];then echo -n “DownLoad Linux source packages End ,Please Waiting Install………………” else echo -n “Download Linux source packages Failed ,Please Check………………” fi } Nginx_install () { cd $srcpath && tar xzf pcre-8.01.tar.gz && cd pcre-8.01 && ./configure –prefix=$apppath/pcre && make &&make install if [ $? -eq 0 ];then echo “This pcre make install end ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++” else echo “Pcre install failed ,please check install shell or system gcc configuration ,exiting ……….” sleep 1s exit 1 fi echo “pcre install end ………..,please install nginx …………………” useradd www ; cd $srcpath && tar xzf nginx-1.0.2.tar.gz && cd nginx-1.0.2 && ./configure –prefix=$apppath/nginx –with-http_stub_status_module –with-cc-opt=’-O3′ –with-cpu-opt=opteron –with-openssl=/usr/ –with-pcre=/usr/src/pcre-8.01 –user=www –group=www ; make ; make install cp -r $srcpath/{nginx.conf,fcgi.conf} $apppath/nginx/conf/ if [ $? -eq 0 ];then echo -n “Nginx Install success ………………” else echo -n “Nginx Install Failed ,Please Check………………” exit 1 fi echo “nginx install end …………………..,Next install mysql …………………………..” } Mysql_install () { cd $srcpath && tar xzf mysql-5.1.41.tar.gz && cd mysql-5.1.41 && ./configure –prefix=$apppath/mysql/ –enable-assembler –with-extra-charsets=complex –enable-thread-safe-client –with-big-tables –with-readline –with-ssl –with-embedded-server –enable-local-infile –with-plugins=innobase && make &&make install if [ $? -eq 0 ];then echo -n “Mysql Install success ………………” else echo -n “Mysql Install Failed ,Please Check………………” exit 1 fi echo “init mysql server , ……….please waiting ………………………………….” cd /usr/local/mysql && useradd mysql ; chown -R mysql:mysql /usr/local/mysql && /usr/local/mysql/bin/mysql_install_db –user=mysql && chown -R mysql:mysql var/ echo “Now install php ,please waiting………………………………….” } Php_install () { yum clean all && yum install -y libevent* &&cd $srcpath &&tar jxvf php-5.3.3.tar.bz2 && cd php-5.3.3 && ./configure –prefix=$apppath/php5 –with-config-file-path=$apppath/php5/etc –with-mysql=$apppath/mysql –with-mysqli=$apppath/mysql/bin/mysql_config –with-iconv-dir=/usr/local –with-freetype-dir –with-jpeg-dir –with-png-dir –with-zlib –with-libxml-dir=/usr –enable-xml –disable-rpath –enable-discard-path –enable-safe-mode –enable-bcmath –enable-shmop –enable-sysvsem –enable-inline-optimization –with-curl –with-curlwrappers –enable-mbregex –enable-fpm –enable-sockets && make &&make install if [ $? -eq 0 ];then echo “This PHP make install end ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++” else echo “This PHP failed ,please check install shell ,exiting ……….” sleep 2s echo “This PHP failed ,please check install shell ,exiting ……….” |mail -s “PHP make install failed” wgkgood@139.com exit 2 fi cp -r $srcpath/php.ini $apppath/php5/etc/ cp $srcpath/php-5.3.3/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm ;chmod o+x /etc/init.d/php-fpm } Eacce_install () { echo “Now install eaccelerator …………….,please waiting……………………..” cd /usr/src && tar jxvf eaccelerator-0.9.6.1.tar.bz2 && cd eaccelerator-0.9.6.1 && $apppath/php5/bin/phpize && ./configure –enable-eaccelerator=shared –with-php-config=$apppath/php5/bin/php-config &&make &&make test &&make install &&mkdir -p /tmp/eaccelerator && chmod 777 -R /tmp/eaccelerator if [ $? -eq 0 ];then echo “Install eaccelerator success ” else echo “Install eaccelerator failed ,please check ………………………” fi } Mem_install () { ###########now install memcached ####################### echo “next install memcached……………………………………..” cd $srcpath && tar xzf memcache-2.2.5.tgz && cd memcache-2.2.5 && /usr/local/php5/bin/phpize && ./configure –prefix=$apppath/memcached –with-php-config=$apppath/php5/bin/php-config &&make &&make install if [ $? -eq 0 ];then echo “Install Memcache success ” else echo “Install Memcache failed ,please check ………………………” fi } EXIT () { echo “Now not Install ,Please exit …………………..” exit 0 } PS3=”Please Select Install Linux Packages: ” select option in Download Nginx_install Mysql_install Php_install Eacce_install Mem_install EXIT do $option done