在CentOs下安装Nginx Mysql PHP是很简单的事情,但我之前的做法是一个个安装,缺少什么库再以YUM的方式把缺的库给装上,但我觉得这会浪费一些时间。于是我把最天的安装记录贴出来,以便下次安装是可以快速、准确、省时、省力。
1,安装Nginx
yum installlibevent libevent-devel boost boost-devel e2fsprogs-devel libuuid-devel libevent libevent-devel libevent-devel pcre pcre-devel openssl openssl-deve libevent-devel pcre pcre-devel openssl openssl-deve
useraddwww -M -s/sbin/nologin
yuminstallpcre.x86_64 pcre-devel.x86_64 zlib.x86_64 zlib-devel.x86_64 make.x86_64
wget http://nginx.org/download/nginx-1.2.6.tar.gz
tarzxvf nginx-1.2.6.tar.gz
cdnginx-1.2.6
./configure--prefix=/usr/local/nginx--user=www --group=www --with-http_stub_status_module
make&&makeinstall
2,安装PHP
yum -yinstalllibjpeg-devel libpng-devel freetype-devel
wgetftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz
wget http://cn2.php.net/distributions/php-5.4.10.tar.gz
tar-zxvf libmcrypt-2.5.7.tar.gz
cdlibmcrypt-2.5.7
./configure
make&&makeinstall
./configure--prefix=/usr/local/php--with-iconv --with-zlib --enable-xml --disable-rpath --enable-bcmath --enable-shmo
p --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-mbstring --with-mcry
pt --with-gd --enable-gd-native-ttf --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --w
ithout-pear --with-mysql --with-mysqli --with-pdo-mysql --enable-ftp--with-jpeg-dir--with-freetype-dir--with-png-dir--enab
le-fpm --with-fpm-user=www --with-fpm-group=www --disable-fileinfo
cp php.ini-production /usr/local/php/lib/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
/usr/local/php/bin/php –ini
/usr/local/php/bin/php -m
/usr/local/php/sbin/php-fpm
3,安装Mysql
ln-s/usr/lib64/mysql//usr/lib/mysql
installgcc gcc-c++ glibc glibc-common autoconfmakeautomake openssl-d
cmake zlib* ncurses-devel bison
cdmysql-5.5.25a
groupadd mysql
useradd-r -g mysql mysql
CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DENABLED_LOCAL_INFILE=1
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_g
eneral_ci -DENABLED_LOCAL_INFILE=1
make&makeinstall
cd/usr/local/mysql/
chown-R mysql .
chgrp-R mysql .
scripts/mysql_install_db--user=mysql
chown-R root .
chown-R mysql data
cpsupport-files/my-medium.cnf/etc/my.cnf
bin/mysqld_safe--user=mysql &
support-files/mysql.server/etc/init.d/mysql.serve
scripts/mysql_install_db--user=mysql
./bin/mysqld_safe&
好了,写完了,希望对你有用。