VPS Installation Configuration Linux+nginx+php+mysql environment (1/2)

Source: Internet
Author: User
Tags bz2 fpm ftp install php openssl vps mysql view openldap

VPS System CentOS5.2
Add a common account
The location of the VPS quantum data http://www.111cn.net

Useradd Lrenwang
passwd Lrenwang

--------------------------------------------------------------------------------

One installation Preparation
Shutdown Firewall

Service Iptables Stop

Close SELINUX, CP command overrides directly, no prompting required

Sed-i "S/selinux=enforcing/selinux=disabled/g"/etc/sysconfig/selinux
Setenforce 0
Sed-i "S/alias cp= ' cp-i '/#alias cp= ' cp-i"/g "~/.BASHRC"
Su-

The software I downloaded was put in the/home/lrenwang/soft

Mkdir/home/lrenwang/soft/ver1-p
Cd/home/lrenwang/soft

Configure Yum

wget Http://blog.lrenwang.com/down/CentOS-Base.repo
CP centos-base.repo/etc/yum.repos.d/

Uninstall httpd (Rmp-q httpd See if it is installed)

Yum Remove-y httpd

Update the required installation package

Yum-y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-deve L zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel Curl curl-devel e2fsprogs E2 Fsprogs-devel krb5 krb5-devel libidn libidn-devel OpenSSL openssl-devel openldap openldap-devel Nss_ldap openldap-clients openldap-servers vsftpd Patch Zip


Update Time zone

Cp/usr/share/zoneinfo/asia/shanghai/etc/localtime

Download the software required by LNMP

wget http://sysoev.ru/nginx/nginx-0.8.34.tar.gz
wget Http://www.php.net/get/php-5.2.13.tar.gz/from/this/mirror
wget http://php-fpm.org/downloads/php-5.2.13-fpm-0.5.13.diff.gz
Ftp://ftp.iij.ad.jp/pub/db/mysql/Downloads/MySQL-5.1/mysql-5.1.45.tar.gz
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.tar.gz
wget http://downloads.sourceforge.net/mcrypt/libmcrypt-2.5.8.tar.gz?modtime=1171868460&big_mirror=0
wget http://downloads.sourceforge.net/mcrypt/mcrypt-2.6.8.tar.gz?modtime=1194463373&big_mirror=0
wget http://pecl.php.net/get/memcache-2.2.5.tgz
wget http://downloads.sourceforge.net/mhash/mhash-0.9.9.9.tar.gz?modtime=1175740843&big_mirror=0
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.01.tar.gz
wget http://bart.eaccelerator.net/source/0.9.6/eaccelerator-0.9.6.tar.bz2
wget http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz
wget http://blog.s135.com/soft/linux/nginx_php/imagick/ImageMagick.tar.gz
wget http://pecl.php.net/get/imagick-2.3.0.tgz

Download configuration file
CD Ver1

wget http://blog.lrenwang.com/down/ver1/my.cnf
wget Http://blog.lrenwang.com/down/ver1/php.ini
wget http://blog.lrenwang.com/down/ver1/php-fpm.conf
wget http://blog.lrenwang.com/down/ver1/nginx.conf
wget http://blog.lrenwang.com/down/ver1/fcgi.conf
Cd.. /


--------------------------------------------------------------------------------

Second installation php5.2.13 mysql-5.1.38
1. Compile and install the required support library for PHP 5.2.13:

Tar zxvf libiconv-1.13.tar.gz
CD libiconv-1.13/
./configure--prefix=/usr/local
Make
Make install
Cd.. /
Tar zxvf libmcrypt-2.5.8.tar.gz
CD libmcrypt-2.5.8/
./configure
Make
Make install
/sbin/ldconfig
CD libltdl/
./configure--enable-ltdl-install
Make
Make install
Cd.. /.. /
Tar zxvf mhash-0.9.9.9.tar.gz
CD mhash-0.9.9.9/
./configure
Make
Make install
Cd.. /
Ln-s/usr/local/lib/libmcrypt.la/usr/lib/libmcrypt.la
Ln-s/usr/local/lib/libmcrypt.so/usr/lib/libmcrypt.so
Ln-s/usr/local/lib/libmcrypt.so.4/usr/lib/libmcrypt.so.4
Ln-s/usr/local/lib/libmcrypt.so.4.4.8/usr/lib/libmcrypt.so.4.4.8
Ln-s/USR/LOCAL/LIB/LIBMHASH.A/USR/LIB/LIBMHASH.A
Ln-s/usr/local/lib/libmhash.la/usr/lib/libmhash.la
Ln-s/usr/local/lib/libmhash.so/usr/lib/libmhash.so
Ln-s/usr/local/lib/libmhash.so.2/usr/lib/libmhash.so.2
Ln-s/usr/local/lib/libmhash.so.2.0.1/usr/lib/libmhash.so.2.0.1
Tar zxvf mcrypt-2.6.8.tar.gz
CD mcrypt-2.6.8/
/sbin/ldconfig
./configure
Make
Make install
Cd.. /

2. Compile and install mysql-5.1.45.tar.gz


/usr/sbin/groupadd MySQL
/usr/sbin/useradd-g MySQL MySQL
Tar zxvf mysql-5.1.45.tar.gz
CD mysql-5.1.45/
./configure--prefix=/usr/local/webserver/mysql/--enable-assembler--with-charset=utf8--with-extra-charsets=all- -enable-thread-safe-client--with-big-tables--with-readline--with-ssl--with-embedded-server-- Enable-local-infile--with-plugins=innobase
Make && make install
chmod +w/usr/local/webserver/mysql
Chown-r Mysql:mysql/usr/local/webserver/mysql
Ln-s/usr/local/webserver/mysql/lib/mysql/libmysqlclient.so.16/usr/lib/
Cd.. /
mkdir/var/mysql/
CP VER1/MY.CNF/VAR/MYSQL/MY.CNF
Chown mysql:mysql/var/mysql/

Build database Start service process modify password

/usr/local/webserver/mysql/bin/mysql_install_db--basedir=/usr/local/webserver/mysql--datadir=/var/mysql/data-- User=mysql
/usr/local/webserver/mysql/bin/mysqld_safe--DEFAULTS-FILE=/VAR/MYSQL/MY.CNF &
/usr/local/webserver/mysql/bin/mysqladmin-uroot password "123456"-P

Enter MySQL View status (can not do)

/usr/local/webserver/mysql/bin/mysql-uroot-p123456
Status
Exit

3. Compile and install PHP (fastcgi mode)

Tar zxvf php-5.2.13.tar.gz
GZIP-CD php-5.2.13-fpm-0.5.13.diff.gz | Patch-d PHP-5.2.13-P1
CD php-5.2.13/
./configure--prefix=/usr/local/webserver/php--with-config-file-path=/usr/local/webserver/php/etc--with-mysql=/ Usr/local/webserver/mysql--with-mysqli=/usr/local/webserver/mysql/bin/mysql_config--with-iconv-dir=/usr/local- -with-freetype-dir--with-jpeg-dir--with-png-dir--with-zlib--with-libxml-dir=/usr--enable-xml-- 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-sockets--with-ldap--WITH-LDAP-SASL--with-xmlrpc--enable-zip--enable-soap
Make zend_extra_libs= '-liconv '
Make install
Cd.. /
CP Ver1/php.ini/usr/local/webserver/php/etc/php.ini

4, compile and install PHP5 expansion module

Tar zxvf memcache-2.2.5.tgz
CD memcache-2.2.5/
/usr/local/webserver/php/bin/phpize
./configure--with-php-config=/usr/local/webserver/php/bin/php-config
Make
Make install
Cd.. /

Tar jxvf eaccelerator-0.9.6.tar.bz2
CD eaccelerator-0.9.6/
/usr/local/webserver/php/bin/phpize
./configure--enable-eaccelerator=shared--with-php-config=/usr/local/webserver/php/bin/php-config
Make
Make install
Cd.. /

Tar zxvf pdo_mysql-1.0.2.tgz
CD PDO_MYSQL-1.0.2/
/usr/local/webserver/php/bin/phpize
./configure--with-php-config=/usr/local/webserver/php/bin/php-config--with-pdo-mysql=/usr/local/webserver/ Mysql
Make
Make install
Cd.. /

Tar zxvf ImageMagick.tar.gz
CD imagemagick-6.5.1-2/
./configure
Make
Make install
Cd.. /

Tar zxvf imagick-2.3.0.tgz
CD imagick-2.3.0/
/usr/local/webserver/php/bin/phpize
./configure--with-php-config=/usr/local/webserver/php/bin/php-config
Make
Make install
Cd.. /

5, if not required, in the php.ini note the following information

Extension = "memcache.so"
Extension = "pdo_mysql.so"
Extension = "imagick.so"
  
Put output_buffering = On
Change output_buffering = Off

Home 1 2 last page
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.