linux+php5.3+nginx+mysql环境搭建

系统环境搭建:
#!/bin/bash
cd /home/source/
tar zxf libiconv-1.11.tar.gz
cd libiconv-1.11
./configure --prefix=/system/com/libiconv
make
make install || echo "libiconv fail">>/home/source/install.log
cd /home/source/
tar zxf libxml2-2.6.30.tar.gz
cd libxml2-2.6.30
./configure --prefix=/system/com/xml
make
make install || echo "libxml2 fail">>/home/source/install.log
cd /home/source/
tar zxf freetype-2.3.5.tar.gz
cd freetype-2.3.5
./configure --prefix=/system/com/freetype
make
make install || echo "freetype fail">>/home/source/install.log
cd /home/source/
tar zxf libpng-1.2.20.tar.gz
cd libpng-1.2.20
cp ./scripts/makefile.linux ./Makefile
./configure
make
make install || echo "libpng fail">>/home/source/install.log
cd /home/source/
mkdir -p /system/com/jpeg/bin
mkdir -p /system/com/jpeg/man/man1
mkdir -p /system/com/jpeg/include
mkdir -p /system/com/jpeg/lib
tar zxf jpegsrc.v6b.tar.gz
cd jpeg-6b/
./configure --prefix=/system/com/jpeg
make
make install
make install-lib || echo "jpeg fail">>/home/source/install.log
cd /home/source/
tar zxf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure
make
make install
ldconfig
cd libltdl/
./configure --enable-ltdl-install
make
make install || echo "libmcrypt fail">>/home/source/install.log
cd /home/source
tar -xvf zlib-1.2.3.tar
cd zlib-1.2.3
make clean
./configure --prefix=/system/com/zlib
make
make install || echo "zlib fail">>/home/source/install.log
cd /home/source
yum -y install gettext-devel
tar -zxf gd-2.0.35.tar.gz
cd gd-2.0.35
make clean
./configure --prefix=/system/com/gd2 --with-zlib=/system/com/zlib/ --with-png=/usr/local --with-jpeg=/system/com/jpeg/ --with-freetype=/system/com/freetype/
make
make install || echo "gd fail">>/home/source/install.log
cd /home/source
tar zxf mhash-0.9.9.tar.gz
cd mhash-0.9.9
./configure
make
make install || echo "mhash fail">>/home/source/install.log
cp /usr/local/lib/libmcrypt.* /usr/lib
ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
cd /home/source
tar zxf mcrypt-2.6.6.tar.gz
cd mcrypt-2.6.6
./configure
make
make install || echo "mcrypt fail">>/home/source/install.log
安装mysql:
cd /home/source
tar zxf mysql-5.0.45.tar.gz
cd mysql-5.0.45
./configure --prefix=/system/mysql/ --without-debug --with-unix-socket-path=/tmp/mysql.sock --with-client-ldflags=-all-static
--with-mysqld-ldflags=-all-static --enable-assembler --with-extra-charsets=latin1,gb2312,utf8 --enable-thread-safe-client
make
make install || echo "mysql fail">>/home/source/install.log
/usr/sbin/groupadd mysql
/usr/sbin/useradd -g mysql mysql
chmod +w /system/mysql
chown -R mysql:mysql /system/mysql
cp support-files/my-medium.cnf /system/mysql/my.cnf
/system/mysql/bin/mysql_install_db --defaults-file=/system/mysql/my.cnf --basedir=/system/mysql --datadir=/system/mysql/data --user=mysql
sh /system/mysql/bin/mysqld_safe --defaults-file=/system/mysql/my.cnf &
安装php:
cd /home/source
tar zxf php5.3-200805280430.tar.gz
cd php5.3-200805280430
./configure --with-mysql=mysqlnd --with-mysqli=mysqlnd --prefix=/system/php --with-config-file-path=/system/php/lib
--with-iconv-dir=/system/com/libiconv --with-jpeg-dir=/system/com/jpeg/ --with-png-dir=/usr/local --with-zlib-dir=/system/com/zlib/
--with-freetype-dir=/system/com/freetype/ --with-libxml-dir=/system/com/xml/ --with-gd=/system/com/gd2/ --enable-trace-vars
--with-ttf --enable-ftp --disable-debug --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop
--enable-sysvsem --with-curl --enable-inline-optimization --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-force-cgi-redirect --enable-mbstring --with-mcrypt
make
make install || echo "php fail">>/home/source/install.log
cp php.ini-dist /system/php/lib/php.ini
/usr/sbin/groupadd www -g 48
/usr/sbin/useradd -u 48 -g www www
mkdir -p /system/www/web
mkdir -p /system/www/logs
chmod +w /system/www/web/
chmod +w /system/www/logs
chown -R www:www /system/www/web/
chown -R www:www /system/www/logs
cd /home/source
cp /home/source/spawn-fcgi /system/php/bin
chmod +x /system/php/bin/spawn-fcgi
/system/php/bin/spawn-fcgi -a 127.0.0.1 -p 10080 -C 64 -u www -f /system/php/bin/php-cgi
cd /home/source
tar zxvf pcre-7.2.tar.gz
cd pcre-7.2/
./configure
make
make install || echo "pcre fail">>/home/source/install.log
cd /home/source
安装nginx:
tar zxvf nginx-0.5.33.tar.gz
cd nginx-0.5.33/
./configure --user=www --group=www --prefix=/system/nginx --with-http_stub_status_module
make
make install || echo "nginx fail">>/home/source/install.log
rm -f /system/nginx/conf/nginx.conf
cp /home/source/fcgi.conf /system/nginx/conf/
cp /home/source/nginx.conf /system/nginx/conf/
ulimit -SHn 51200
/system/nginx/sbin/nginx -c /system/nginx/conf/nginx.conf
cd /home/source
tar xfvz db-4.6.21.tar.gz
cd db-4.6.21/build_unix/
../dist/configure --prefix=/system/com/berkeleydb
make
make install || echo "db fail">>/home/source/install.log
cd /home/source
tar zxf libevent-1.3b.tar.gz
cd libevent-1.3b
./configure --prefix=/system/com/libevent
make
make install || echo "libevent fail">>/home/source/install.log
rm -rf /usr/lib/libevent-1.3b.so.1
cp /system/com/libevent/lib/libevent-1.3b.so.1 /usr/lib
安装memcache:
cd /home/source
tar zxf memcachedb-1.0.3.tar.gz
cd memcachedb-1.0.3
./configure --with-libevent=/system/com/libevent --with-bdb=/system/com/berkeleydb
make
make install || echo "memcachedb fail">>/home/source/install.log
cd /home/source
tar zxf memcached-1.2.0.tar.tar
cd memcached-1.2.0
./configure --with-libevent=/system/com/libevent/ --with-bdb=/system/com/berkeleydb
make
make install || echo "memcached fail">>/home/source/install.log
echo "ulimit -SHn 51200" >>/etc/rc.local
echo "/system/php/bin/spawn-fcgi -a 127.0.0.1 -p 10080 -C 64 -u www -f /system/php/bin/php-cgi" >>/etc/rc.local
echo "/system/nginx/sbin/nginx -c /system/nginx/conf/nginx.conf" >>/etc/rc.local
echo "install finish" >>/home/source/install.log

联系我们 | 蚂蚁代维版权所有 All rights reserved.