0x00, remove the default apache and mysql
#> apt-get remove apache2
#> apt-get autoremove apache2-bin
#> apt-get autoremove apache2
#> apt-get --purge remove apache-common
#> rm -R /var/lib/mysql/
#> rm -R /etc/mysql/
#> apt-get autoremove mysql* --purge
0x01, update the software source
#> apt-get update // update the system
#> apt-get upgrade // update the software package
0x02, install chkconfig Notice: this step is not must be!
#> apt-get install chkconfig
or use this command
#> apt-get install sysv-rc-conf
0x03, install Nginx
#> apt-get install nginx
#> service nginx start
0x04, install Mysql
#> apt-get install mysql-server-5.6 mysql-client-5.6
###---------- only do this if u want to change the data_dir ------------##
#> sudo service mysql stop
#> sudo vim /etc/mysql/my.cnf // configure the mysql, set it‘s data_dir and base_dir if u need. i change the data_dir to /data0/mysql
#> cd /data0
#> sudo cp -R /var/lib/mysql ./
#> sudo chown -R mysql:mysql mysql/
#> sudo chmod -R 700 mysql/
#> sudo service mysql start
#> vim /etc/apparmor.d/usr.sbin.mysqld // if start faild, please check the mysql.err.log and maybe u need to change this file
>>>> change like this:
#/var/lib/mysql/ r,
#/var/lib/mysql/** rwk,
/data0/mysql/ r,
/data0/mysql/** rwk,
#> sudo service mysql start
###---------- only do this if u want to change the data_dir ------------##
0x05, install php-fpm
#> apt-get install php5-fpm
0x06, install php extension
#> apt-get install php5-curl php5-gd php5-memcached php5-mysql php5-xdebug php5-mcrypt php5-common php5-json php5-dev
Use apt-get install lNMP env on Ubuntu
原文:http://my.oschina.net/u/1156660/blog/522651