要求:所有的安装包都装在/usr/local/server/下面 首先检查各种库有没有装上 for i in ` rpm -q gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel bison bison-devel readline readline-devel |grep 'not installed' | awk '{print $2}' `; do yum -y install $i; done 1、mysql的安装 下载地址 wget http://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-5.5.20-24.1/sourc e/Percona-Server-5.5.20-rel24.1.tar.gz 因为mysql5.5需要cmake编译的,所以下载cmake安装cmake工具 wget http://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz tar zxvf cmake-2.8.4.tar.gz cd cmake-2.8.4 ./configure make && make install 安装mysql groupadd mysql useradd -g mysql mysql 解压mysql tar zxvf Percona-Server-5.5.20-rel24.1.tar.gz cd Percona-Server-5.5.20-rel24.1 cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/server/mysql -DENABLED_PROFILING=ON -DMYSQL_DATADIR=/data/mysql/data/ -DWITH_EXTRA_CHARSETS=all -DWITH_READLINE=ON -DWITH_DEBUG=0 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DENABLED_LOCAL_INFILE=1 make && make install cp ./support-files/mysql.server /etc/init.d/mysqld cp ./support-files/my-medium.cnf /etc/my.cnf chmod 777 /etc/init.d/mysqld chown -R mysql.mysql /usr/local/server/mysql/ chown -R mysql.mysql /data/mysql/ 初始化mysql /usr/local/server/mysql/mysql_install_db –user=mysql –basedir=/usr/local/server/mysql/ –datadir=/data/mysql/data/ & 启动 /etc/init.d/mysqld start 2安装nginx、 groupadd nginx useradd -g nginx nginx 因为nginx需要用正则表达式,所以也需要安装pcre wget http://sourceforge.net/projects/pcre/files/latest/download unzip pcre-8.30.zip cd pcre-8.30 ./configure make && make install wget http://nginx.org/download/nginx-1.0.13.tar.gz tar xvf nginx-1.0.13.tar.gz cd nginx-1.0.13 ./configure --user=nginx --group=nginx --prefix=/usr/local/server/nginx --with-http_stub_status_module --with-http_ssl_module make && make install 启动 /usr/local/server/nginx/bin/nginx -c /usr/local/server/nginx/conf/nginx.conf 3、安装php-fpm 下载php wget http://cn.php.net/get/php-5.2.17.tar.gz/from/this/mirror 下载php的fpm补丁 wget http://php-fpm.org/downloads/php-5.2.17-fpm-0.5.14.diff.gz 下载php的hash补丁 https://github.com/laruence/laruence.github.com/tarball/master(此链接不能直接wget,需要下载下来再传到服务器里面) 打补丁 tar zxvf php-5.2.17.tar.gz tar zxvf laruence-laruence.github.com-b648cb1.tar.gz 打p1的补丁 gzip -cd php-5.2.17-fpm-0.5.14.diff.gz | patch -d php-5.2.17 -p1 cd php-5.2.17 打上hash的补丁 patch -p1 < ../laruence-laruence.github.com-b648cb1/php-5.2-max-input-vars/php-5.2.17-max-input-vars.patch 编译安装 ./configure –prefix=/usr/local/server/php-5.2.17p1 –with-config-file-path=/usr/local/server/php-5.2.17p1/etc –with-mysql=/usr/local/server/mysql –with-mysqli=/usr/local/server/mysql/bin/mysql_config –with-iconv-dir=/usr/local –with-freetype-dir –with-jpeg-dir –with-png-dir –with-zlib –with-libxml-dir=/usr –disable-rpath –enable-discard-path –enable-safe-mode –enable-bcmath –enable-shmop –enable-sysvsem –enable-inline-optimization –with-curl –with-curlwrappers –enable-mbregex –enable-fastcgi –enable-fpm –enable-force-cgi-redirect –enable-mbstring –with-mcrypt –with-gd –enable-gd-native-ttf –with-openssl –with-mhash –enable-pcntl –enable-sockets –with-xmlrpc –enable-zip –enable-soap –enable-xml –enable-zend-multibyte –disable-debug –disable-ipv6 make && make install cp php.ini-recommended /usr/local/server/php-5.2.17p1/lib/php/php.ini 如果php安装过程中出现 Installing PEAR environment: /usr/local/server/php-5.2.17p1/lib/php/ /root/php/php-5.2.17/sapi/cli/php: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory make[1]: *** [install-pear-installer] Error 127 make: *** [install-pear] Error 2 这个是因为没有找到libmysqlclient.so.18导致的,网上找到的解决办法是 ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib/ 该方法适用于32位系统,64位系统应使用下面的这行 ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64/ (责任编辑:IT) |