安装编译环境及组件:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | yum -y install gcc gcc -c++ make 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 krb5-devel libidn libidn-devel openssl openssl-devel patch unzip vim-enhanced wget http: //sourceforge .net /projects/mcrypt/files/Libmcrypt/2 .5.8 /libmcrypt-2 .5.8. tar .gz tar zxvf libmcrypt-2.5.8. tar .gz cd libmcrypt-2.5.8 . /configure make make install cd ../ wget http: //ftp .gnu.org /pub/gnu/libiconv/libiconv-1 .14. tar .gz tar zxvf libiconv-1.14. tar .gz cd libiconv-1.14 . /configure make make install cd .. wget http: //nchc .dl.sourceforge.net /project/mhash/mhash/0 .9.9.9 /mhash-0 .9.9.9. tar .gz tar zxvf mhash-0.9.9.9. tar .gz cd mhash-0.9.9.9 . /configure make make install cd .. ldconfig wget http: //nchc .dl.sourceforge.net /project/mcrypt/MCrypt/2 .6.8 /mcrypt-2 .6.8. tar .gz tar zxvf mcrypt-2.6.8. tar .gz cd mcrypt-2.6.8 . /configure make make install cd ../ |
Mysql安装:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | wget http: //ftp .jaist.ac.jp /pub/mysql/Downloads/MySQL-5 .1 /mysql-5 .1.63. tar .gz tar zxvf mysql-5.1.63. tar .gz cd mysql-5.1.63 . /configure --prefix= /usr/local/mysql \ --without-debug \ --with-unix-socket-path= /tmp/mysql .sock \ --with-mysqld-ldflags=-all-static \ --with-charset=utf8 \ --with-extra-charsets=gbk,gb2312 \ --with-big-tables \ --with-readline \ -- enable - local -infile \ -- enable -assembler \ -- enable -thread-safe-client make make install cp support-files /my-medium .cnf /etc/my .cnf cp support-files /mysql .server /etc/init .d /mysqld chmod 755 /etc/init .d /mysqld chkconfig --level 3 mysqld on useradd -s /sbin/nologin -M mysql /usr/local/mysql/bin/mysql_install_db --user=mysql ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql ln -s /usr/local/mysql/bin/mysqldump /usr/bin/mysqldump ln -s /usr/local/mysql/bin/myisamchk /usr/bin/myisamchk /etc/init .d /mysqld start /usr/local/mysql/bin/mysqladmin -u root password "password" cd ../ |
PHP安装:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | wget http: //cn .php.net /distributions/php-5 .2.17. tar .gz wget http: //php-fpm .org /downloads/php-5 .2.17-fpm-0.5.14. diff .gz tar zxvf php-5.2.17. tar .gz gzip - cd php-5.2.17-fpm-0.5.14. diff .gz | patch -d php-5.2.17 -p1 cd php-5.2.17/ wget --no-check-certificate https: //raw .github.com /laruence/laruence .github.com /master/php-5 .2-max-input-vars /php-5 .2.17-max-input-vars.patch patch -p1 < php-5.2.17-max-input-vars.patch . /configure --prefix= /usr/local/php \ --with-mysql= /usr/local/mysql \ --with-mysqli= /usr/local/mysql/bin/mysql_config \ -- enable -inline-optimization \ --disable-debug \ -- enable -fastcgi \ -- enable -fpm \ -- enable -xml \ -- enable -sockets \ -- enable -zip \ -- enable -mbstring \ -- enable -gd-native-ttf \ --with-iconv- dir \ --with-freetype- dir \ --with-jpeg- dir \ --with-png- dir \ --with-zlib \ --with-libxml- dir \ --with-mcrypt \ --with-gd \ --with-openssl \ --with-mhash \ --with-xmlrpc \ --with-curl make ZEND_EXTRA_LIBS= '-liconv' make install cp php.ini-recommended /usr/local/php/etc/php .ini cp /usr/local/php/sbin/php-fpm /etc/init .d/ chmod 755 /etc/init .d /php-fpm sed -i '1a # chkconfig: 345 85 15' /etc/init .d /php-fpm chkconfig --level 3 php-fpm on /etc/init .d /php-fpm start ln -s /usr/local/php/bin/php /usr/bin/php ln -s /usr/local/php/bin/phpize /usr/bin/phpize ln -s /usr/local/php/sbin/php-fpm /usr/bin/php-fpm cd ../ |
Nginx安装:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | wget http: //sourceforge .net /projects/pcre/files/pcre/8 .30 /pcre-8 .30. tar .gz tar zxvf pcre-8.30. tar .gz cd pcre-8.30 . /configure make make install ln -s /usr/local/lib/libpcre .so.1 /lib/libpcre .so.1 ln -s /usr/local/lib/libpcre .so.1.0.0 /lib/libpcre .so.1.0.0 cd ../ useradd -s /sbin/nologin -M www wget http: //nginx .org /download/nginx-1 .0.15. tar .gz tar zxvf nginx-1.0.15. tar .gz cd nginx-1.0.15 . /configure --user=www --group=www --prefix= /usr/local/nginx --with-http_stub_status_module --with-http_ssl_module make make install |
标签:lnmp, linux, centos编译安装lnmp环境