反复的安装服务器,一次次的手工安装难免不会出错。而且安装步骤很烦锁。所以,把每一个模块的安装都记录下来,封装成为一个安装脚本。此脚本包含的内容有:php 5.3, MySQL Server, memcache, spawn-fcgi, nginx, coreseek(sphinx)
#~ power by yagas60@21cn.com
#~ blog http://blog.csdn.net/yagas
#~ date 2011-08-30 15:14
#~ 下载必要的安软件装包并释放
echo "download coreseek-3.2.14..."
wget http://www.coreseek.cn/uploads/csft/3.2/coreseek-3.2.14.tar.gz -O /tmp/coreseek-3.2.14.tar.gz
echo "download memcache..."
wget http://memcached.googlecode.com/files/memcached-1.4.7.tar.gz -O /tmp/memcached-1.4.7.tar.gz
echo "download php-memcacheAPI"
wget http://pecl.php.net/get/memcache-3.0.6.tgz -O /tmp/memcache-3.0.6.tgz
echo "download nginx..."
wget http://www.nginx.org/download/nginx-1.0.6.tar.gz -O /tmp/nginx-1.0.6.tar.gz
echo "download spawn-fcgi..."
wget http://www.lighttpd.net/download/spawn-fcgi-1.6.3.tar.gz -O /tmp/spawn-fcgi-1.6.3.tar.gz
tar -xzvf /tmp/coreseek-3.2.14.tar.gz -C /tmp
tar -xzvf /tmp/memcached-1.4.7.tar.gz -C /tmp
tar -xzvf /tmp/memcache-3.0.6.tgz -C /tmp
tar -xzvf /tmp/nginx-1.0.6.tar.gz -C /tmp
tar -xzvf /tmp/spawn-fcgi-1.6.3.tar.gz -C /tmp
#~ 安装必要的开发包
yum -y install make gcc g++ gcc-c++ libtool autoconf automake imake mysql mysql-server mysql-devel libxml2-devel expat-devel libevent-devel php53 php53-devel php53-pdo php53-mysql php53-mbstring php53-gd php53-soap pcre pcre-devel
#~ 安装mmseg分词引擎
cd /tmp/coreseek-3.2.14/mmseg-3.2.14
aclocal
libtoolize --force
automake --add-missing
autoconf
autoheader
make clean
./configure --prefix=/usr/local/mmseg
make
make install
ln -s /usr/local/mmseg/bin/mmseg /usr/local/bin/mmseg
#~ 安装sphinx系统
cd /tmp/coreseek-3.2.14/csft-3.2.14
sh buildconf.sh
./configure --prefix=/usr/local/coreseek --without-python --without-unixodbc --with-mmseg --with-mmseg-includes=/usr/local/mmseg/include/mmseg/ --with-mmseg-libs=/usr/local/mmseg/lib/ --with-mysql
make
make install
ln -s /usr/local/coreseek/bin/indexer /usr/local/bin/indexer
ln -s /usr/local/coreseek/bin/searchd /usr/local/bin/searchd
#~ 安装memcache缓存引擎
cd /tmp/memcached-1.4.7
./configure --prefix=/usr/local/memcache --with-libevent=/usr
make
make install
ln -s /usr/local/memcache/bin/memcached /usr/local/bin/memcached
#~ 安装php-memcacheAPI
cd /tmp/memcache-3.0.6
phpize
./configure --with-php-config=/usr/bin/php-config --with-zlib-dir=/usr
make
make install
#~ 修改php.ini设置文件
sed 's/; extension_dir = ".\/"/extension_dir = "\/usr\/lib\/php\/modules"/' /etc/php.ini|sed 's/; default extension directory./; default extension directory.\nextension=memcache.os/' > /tmp/php.ini
mv -f /tmp/php.ini /etc/php.ini
#~ 安装nginx软件
cd /tmp/nginx-1.0.6
./configure --prefix=/usr/local/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log --pid-path=/var/run/nginx.pid --without-select_module --with-poll_module --with-http_ssl_module --with-http_gzip_static_module --with-pcre
make
make install
ln -s /usr/local/nginx/sbin/nginx /usr/local/bin/nginx
#~ 安装spawn-fcgi模块
cd /tmp/spawn-fcgi-1.6.3
./configure --prefix=/usr/local/spawn-fcgi
make
make install
ln -s /usr/local/spawn-fcgi/bin/spawn-fcgi /usr/local/bin/spawn-fcgi
#~ 设置为系统自动启动服务,并运行服务
echo "spawn-fcgi -C 10 -p 9000 -a 0.0.0.0 -f /usr/bin/php-cgi" >> /etc/rc.d/rc.local
spawn-fcgi -C 10 -p 9000 -a 0.0.0.0 -f /usr/bin/php-cgi
#~ blog http://blog.csdn.net/yagas
#~ date 2011-08-30 15:14
#~ 下载必要的安软件装包并释放
echo "download coreseek-3.2.14..."
wget http://www.coreseek.cn/uploads/csft/3.2/coreseek-3.2.14.tar.gz -O /tmp/coreseek-3.2.14.tar.gz
echo "download memcache..."
wget http://memcached.googlecode.com/files/memcached-1.4.7.tar.gz -O /tmp/memcached-1.4.7.tar.gz
echo "download php-memcacheAPI"
wget http://pecl.php.net/get/memcache-3.0.6.tgz -O /tmp/memcache-3.0.6.tgz
echo "download nginx..."
wget http://www.nginx.org/download/nginx-1.0.6.tar.gz -O /tmp/nginx-1.0.6.tar.gz
echo "download spawn-fcgi..."
wget http://www.lighttpd.net/download/spawn-fcgi-1.6.3.tar.gz -O /tmp/spawn-fcgi-1.6.3.tar.gz
tar -xzvf /tmp/coreseek-3.2.14.tar.gz -C /tmp
tar -xzvf /tmp/memcached-1.4.7.tar.gz -C /tmp
tar -xzvf /tmp/memcache-3.0.6.tgz -C /tmp
tar -xzvf /tmp/nginx-1.0.6.tar.gz -C /tmp
tar -xzvf /tmp/spawn-fcgi-1.6.3.tar.gz -C /tmp
#~ 安装必要的开发包
yum -y install make gcc g++ gcc-c++ libtool autoconf automake imake mysql mysql-server mysql-devel libxml2-devel expat-devel libevent-devel php53 php53-devel php53-pdo php53-mysql php53-mbstring php53-gd php53-soap pcre pcre-devel
#~ 安装mmseg分词引擎
cd /tmp/coreseek-3.2.14/mmseg-3.2.14
aclocal
libtoolize --force
automake --add-missing
autoconf
autoheader
make clean
./configure --prefix=/usr/local/mmseg
make
make install
ln -s /usr/local/mmseg/bin/mmseg /usr/local/bin/mmseg
#~ 安装sphinx系统
cd /tmp/coreseek-3.2.14/csft-3.2.14
sh buildconf.sh
./configure --prefix=/usr/local/coreseek --without-python --without-unixodbc --with-mmseg --with-mmseg-includes=/usr/local/mmseg/include/mmseg/ --with-mmseg-libs=/usr/local/mmseg/lib/ --with-mysql
make
make install
ln -s /usr/local/coreseek/bin/indexer /usr/local/bin/indexer
ln -s /usr/local/coreseek/bin/searchd /usr/local/bin/searchd
#~ 安装memcache缓存引擎
cd /tmp/memcached-1.4.7
./configure --prefix=/usr/local/memcache --with-libevent=/usr
make
make install
ln -s /usr/local/memcache/bin/memcached /usr/local/bin/memcached
#~ 安装php-memcacheAPI
cd /tmp/memcache-3.0.6
phpize
./configure --with-php-config=/usr/bin/php-config --with-zlib-dir=/usr
make
make install
#~ 修改php.ini设置文件
sed 's/; extension_dir = ".\/"/extension_dir = "\/usr\/lib\/php\/modules"/' /etc/php.ini|sed 's/; default extension directory./; default extension directory.\nextension=memcache.os/' > /tmp/php.ini
mv -f /tmp/php.ini /etc/php.ini
#~ 安装nginx软件
cd /tmp/nginx-1.0.6
./configure --prefix=/usr/local/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log --pid-path=/var/run/nginx.pid --without-select_module --with-poll_module --with-http_ssl_module --with-http_gzip_static_module --with-pcre
make
make install
ln -s /usr/local/nginx/sbin/nginx /usr/local/bin/nginx
#~ 安装spawn-fcgi模块
cd /tmp/spawn-fcgi-1.6.3
./configure --prefix=/usr/local/spawn-fcgi
make
make install
ln -s /usr/local/spawn-fcgi/bin/spawn-fcgi /usr/local/bin/spawn-fcgi
#~ 设置为系统自动启动服务,并运行服务
echo "spawn-fcgi -C 10 -p 9000 -a 0.0.0.0 -f /usr/bin/php-cgi" >> /etc/rc.d/rc.local
spawn-fcgi -C 10 -p 9000 -a 0.0.0.0 -f /usr/bin/php-cgi
转载于:https://blog.51cto.com/yagas/654684