笔记中
?
#!/bin/bash PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH # Check if user is root if [ $(id -u) != "0" ]; then echo "Hi: You must be root to run this script, please use root to install lnmmp" exit 1 fi clear echo "========================================================================" echo "LNMMP for Debian/Ubuntu VPS , Written by achun " echo "========================================================================" echo "A tool to auto-compile & install Nginx+MySQL+MongoDB+PHP on Linux " echo "========================================================================" echo "============= clean system =============" cd $cur_dir #wget https://github.com/lowendbox/lowendscript/raw/master/setup-debian.sh --no-check-certificate #dpkg -P apache2 apache2-doc apache2-mpm-prefork apache2-utils apache2.2-common #bash setup-debian.sh system apt-get -q -y remove --purge apache2* apt-get -q -y remove --purge samba* apt-get update apt-get -y upgrade echo "============= Modify /etc/apt/sources.list =============" cur_dir=$(pwd) has=$(fgrep -c dotdeb.org /etc/apt/sources.list) if [ $has = "0" ]; then mv /etc/apt/sources.list /etc/apt/sources.list.backup cat >>/etc/apt/sources.list<<EOF deb http://php53.dotdeb.org stable all deb-src http://php53.dotdeb.org stable all deb http://packages.dotdeb.org stable all deb-src http://packages.dotdeb.org stable all deb http://downloads.mongodb.org/distros/debian 5.0 10gen EOF fi #gpg --keyserver http-keys.gnupg.net --recv-key 89DF5277 #gpg -a --export 89DF5277 | apt-key add - apt-key adv --keyserver http-keys.gnupg.net --recv-key 89DF5277 apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10 apt-get update apt-get install -y ntp ntpdate -d cn.pool.ntp.org date apt-get install -y apt-spy apt-spy update apt-spy -d stable -a $area -t 5 apt-get update echo "============= dev library =============" apt-get -y install g++ ncurses-dev echo "============= cmake =============" cd $cur_dir if [ -s cmake-2.8.3.tar.gz ]; then echo "cmake-2.8.3.tar.gz [found]" else echo "Hi: cmake-2.8.3.tar.gz not found!!!download now......" wget http://www.cmake.org/files/v2.8/cmake-2.8.3.tar.gz fi tar -zxf cmake-2.8.3.tar.gz cd cmake-2.8.3 ./configure make make install echo "============= PCRE library =============" cd $cur_dir if [ -s pcre-8.12.tar.gz ]; then echo "pcre-8.12.tar.gz [found]" else echo "Hi: pcre-8.12.tar.gz not found!!!download now......" wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.12.tar.gz fi tar zxf pcre-8.12.tar.gz cd pcre-8.12 ./configure make make install echo "============= vsftpd install =============" apt-get -y install vsftpd echo "============= MongoDB install =============" apt-get -y install mongodb-stable echo "============= PHP5 +fmp+memcache+gd install =============" #if [ -s php-5.3.5.tar.bz2 ]; then # echo "php-5.3.5.tar.bz2 [found]" # else # echo "Hi: php-5.3.5.tar.bz2 not found!!!download now......" # wget -c http://www.php.net/distributions/php-5.3.5.tar.bz2 -O php-5.3.5.tar.bz2 #fi # install with php5-memcache extension #if [ -s memcached-1.4.5.tar.gz ]; then # echo "memcached-1.4.5.tar.gz [found]" # else # echo "Hi: memcached-1.4.5.tar.gz not found!!!download now......" # wget -c http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz -O memcached-1.4.5.tar.gz #fi apt-get -y install php5-fpm php5-memcache php5-gd php5-dev php5-mysql if [ $(whereis phpize) = "phpize:"]; then echo "php5-dev not install!! phpize not found!! die" exit 1 fi echo "============= PHP5 Extension mongo-php-drive =============" cd $cur_dir if [ -s mongo-php-driver.tar.gz ]; then echo "mongo-php-driver.tar.gz [found]" else echo "Hi: mongo-php-driver.tar.gz not found!!!download now......" wget --no-check-certificate https://github.com/mongodb/mongo-php-driver/tarball/master -O mongo-php-driver.tar.gz fi tar zxf mongo-php-driver.tar.gz cd mongo-php-driver phpize ./configure make install echo "extension=mongo.so">>/etc/php5/fpm/conf.d/mongo.ini echo "============= PHP5 Extension eaccelerator =============" cd $cur_dir if [ -s eaccelerator-0.9.6.1.tar.bz2 ]; then echo "eaccelerator-0.9.6.1.tar.bz2 [found]" else echo "Hi: eaccelerator-0.9.6.1.tar.bz2 not found!!!download now......" wget -c http://bart.eaccelerator.net/source/0.9.6.1/eaccelerator-0.9.6.1.tar.bz2 -O eaccelerator-0.9.6.1.tar.bz2 fi tar jxf eaccelerator-0.9.6.1.tar.bz2 cd eaccelerator-0.9.6.1 phpize ./configure make install echo "extension=eaccelerator.so">>/etc/php5/fpm/conf.d/eaccelerator.ini echo "============= PHP5 Extension eaccelerator =============" cd $cur_dir if [ -s sphinx-1.1.0.tgz ]; then echo "sphinx-1.1.0.tgz [found]" else echo "Hi: sphinx-1.1.0.tgz not found!!!download now......" wget -c http://pecl.php.net/get/sphinx-1.1.0.tgz fi tar zxf sphinx-1.1.0.tgz cd sphinx-1.1.0 phpize ./configure make install echo "extension=sphinx.so">>/etc/php5/fpm/conf.d/sphinx.ini echo "============= Nginx =============" groupadd www useradd -g www www mkdir -p /home/wwwroot chmod +w /home/wwwroot mkdir -p /home/wwwlogs chmod 777 /home/wwwlogs touch /home/wwwlogs/nginx_error.log chown -R www:www /home/wwwroot mkdir -p /var/tmp/nginx chmod 777 /var/tmp/nginx cd $cur_dir if [ -s nginx-0.8.54.tar.gz ]; then echo "nginx-0.8.54.tar.gz [found]" else echo "Hi: nginx-0.8.54.tar.gz not found!!!download now......" wget -c http://nginx.org/download/nginx-0.8.54.tar.gz -O nginx-0.8.54.tar.gz fi tar zxf nginx-0.8.54.tar.gz cd nginx-0.8.54 ./configure \ --user=www \ --group=www \ --prefix=/usr/local/nginx \ --conf-path=/etc/nginx/nginx.conf \ --error-log-path=/var/log/nginx/error.log \ --pid-path=/var/run/nginx.pid \ --lock-path=/var/lock/nginx.lock \ --http-log-path=/var/log/nginx/access.log \ --http-client-body-temp-path=/var/tmp/nginx/body \ --http-proxy-temp-path=/var/tmp/nginx/proxy \ --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi \ --with-http_flv_module \ --with-http_gzip_static_module \ --with-http_ssl_module \ --with-http_stub_status_module \ --with-file-aio \ --with-ipv6 #--with-debug \ #--without-http_ssi_module \ #--with-http_dav_module make && make install echo "============= phpMyAdmin =============" cd $cur_dir if [ -s phpMyAdmin-3.3.9-all-languages.tar.bz2 ]; then echo "phpMyAdmin-3.3.9-all-languages.tar.bz2 [found]" else echo "Hi: phpMyAdmin-3.3.9-all-languages.tar.bz2 not found!!!download now......" wget -c http://cdnetworks-us-1.dl.sourceforge.net/project/phpmyadmin/phpMyAdmin/3.3.9/phpMyAdmin-3.3.9-all-languages.tar.bz2 -O phpmyadmin.tar.bz2 fi tar zxf phpmyadmin.tar.gz mv phpmyadmin /home/wwwroot/ echo "============= MySQL =============" cd $cur_dir if [ -s mysql-5.5.8.tar.gz ]; then echo "mysql-5.5.8.tar.gz [found]" else echo "Hi: mysql-5.5.8.tar.gz not found!!!download now......" wget -c http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.8.tar.gz/from/http://mysql.mirrors.hoobly.com/ -O mysql-5.5.8.tar.gz fi groupadd mysql useradd -g mysql mysql mkdir -p /data/mysql chown mysql:mysql /data/mysql tar zxf mysql-5.5.8.tar.gz cd mysql-5.5.8 cmake . \ -DCMAKE_BUILD_TYPE:STRING=Release \ -DCMAKE_INSTALL_PREFIX:PATH=/usr/local/mysql \ -DCOMMUNITY_BUILD:BOOL=ON \ -DENABLED_PROFILING:BOOL=ON \ -DENABLE_DEBUG_SYNC:BOOL=OFF \ -DINSTALL_LAYOUT:STRING=STANDALONE \ -DMYSQL_DATADIR:PATH=/data/mysql \ -DMYSQL_MAINTAINER_MODE:BOOL=OFF \ -DWITH_EMBEDDED_SERVER:BOOL=OFF \ -DWITH_EXTRA_CHARSETS:STRING=all \ -DWITH_SSL:STRING=bundled \ -DWITH_UNIT_TESTS:BOOL=OFF \ -DWITH_ZLIB:STRING=bundled \ -DWITH_COMMENT=dancebear \ -DWITH_INNOBASE_STORAGE_ENGINE=0 \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DMYSQL_USER=mysql \ -LH #-DWITH_MYISAM_STORAGE_ENGINE=1 \ #-DWITH_INNOBASE_STORAGE_ENGINE=1 \ #-DWITH_SPHINX_STORAGE_ENGINE=1 \ make make install cp /usr/local/mysql/support-files/my-small.cnf /etc/my.cnf cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql cp -R /usr/local/mysql/share /usr/share/mysql mkdir /var/run/mysqld chown mysql:mysql /var/run/mysqld cd /usr/local/mysql/bin for i in *; do ln -s /usr/local/mysql/bin/$i /usr/bin/$i; done /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql echo "============= my.cnf =============" echo "default-storage-engine=MyISAM" echo "============= coreseek =============" cd $cur_dir if [ -s coreseek-4.0.1-beta.tar.gz ]; then echo "coreseek-4.0.1-beta.tar.gz [found]" else echo "Hi: coreseek-4.0.1-beta.tar.gz found!!!download now......" wget -c http://www.coreseek.cn/uploads/csft/4.0/coreseek-4.0.1-beta.tar.gz -O coreseek-4.0.1-beta.tar.gz fi tar zxf coreseek-4.0.1-beta.tar.gz cd coreseek-4.0.1-beta cd mmseg-3.2.14 ./bootstrap ./configure --prefix=/usr/local/mmseg3 make && make install cd .. cd csft-4.0.1 sh buildconf.sh ./configure --prefix=/usr/local/coreseek --without-unixodbc --with-mmseg --with-mmseg-includes=/usr/local/mmseg3/include/mmseg/ --with-mmseg-libs=/usr/local/mmseg3/lib/ --with-mysql make && make install echo 'Install complete'?