adyshor
01-15-2012, 09:22 AM
This script will install:
NginX 1.1.11 & 1.0.10
PHP 5.3.8 with PHP-FPM (Latest 5.3.x , faster for processing php script)
MySQL 5.5.19
phpMyAdmin 3.4.8
ionCube PHP Loader 4.0.11
Alternative PHP Cache (APC) 3.1.9
eAccelerator 0.9.6.1
XCache 1.3.2
Suhosin Extension 0.9.32.1
Imagick 3.0.1 (Optional)
FFMPEG 0.6.0 (Optional)
PureFTPD 1.0.35 (Optional)
Latest WordPress (Additional)
Preparation
Before you’re going to install it, set your domain a record in your domain control panel
Type Host Target
a record * Your IP address
a record domain.com Your IP address
a record www.domain.com Your IP address
If you want to use name server instead of ip based / public dns please check:
Setting Nameserver Based For Domain
Download and Unpack the auto installer
wget http://mirror.planehost.com/nginxauto-1.3.12.zip
unzip nginxauto-1.3.12.zip
Make the scripts executable
chmod +x centos.sh debuntu.sh vhost.sh
optional: create an installation log first before you start the installation process, so if there’s any error it would be easier to detect. If the installation is not complete or goes wrong, please send the log file to: log [att] serversreview.net
Here are some basic settings:
================================================================================
NGINX - PHP - MYSQL AUTO INSTALLER v1.3.12 FOR DEBIAN 6 & UBUNTU 10.10
================================================================================
Junker@vbfk.com & 2298@serversreview.net
For more information please visit
http://serversreview.net/nginx-auto-installer-php-mysql
================================================================================
Please input your preferred mysql root password: test
Please input your preferred ftp/sftp password: test
Please input your preferred phpmyadmin directory name: php
Type 'devv' for development version 1.1.11
Type 'stab' for stable version 1.0.10
Please choose your preferred NginX version: stab
Type 'sqlold' for older version 5.1.60
Type 'sqlnew' for latest version 5.5.19
Please choose your preferred MySQL version: sqlnew
Type 'phpold' for PHP 5.2.17
Type 'phpnew' for PHP 5.3.8
Please choose your preferred PHP version: phpnew
Type 'apc' for APC PHP
Type 'eaccel' for eAccelerator
Type 'xcache' for XCache
Please choose your preferred PHP Opcode Cacher: eaccel
Would you like to install Image Magick?[Y/n] y
Would you like to install FFMPEG?[Y/n] n
Would you like to install PureFTPD?[Y/n] y
Press any key to start the installation...
[CODE]
script log.txt
after the installation has finished, type
[CODE]exit
and it will generate ‘log.txt’ file
Install master script on a fresh OS box
For CentOS 5 (If you’re already using the previous version, the script will ask if you want to upgrade your current NginX version.)
./centos.sh
For Debian 6.0 and Ubuntu 10.10
./debuntu.sh
Add / Remove Domain
./vhost.sh
Main Apps Init command
Nginx
/etc/init.d/nginx { start | stop | restart }
PHP-FPM
/etc/init.d/php-fpm { start | stop | restart }
MySQL
/etc/init.d/mysql { start | stop | restart }
How much memory it consume?
Here are some proffs of memory usage:
256MB XEN CentOS 5.5
[root@server2 ~]# top
top - 04:36:56 up 3 days, 6:11, 1 user, load average: 0.00, 0.02, 0.04
Tasks: 113 total, 4 running, 109 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 262144k total, 187040k used, 75104k free, 7324k buffers
Swap: 262136k total, 1780k used, 260356k free, 110464k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1 root 15 0 10352 236 204 S 0.0 0.1 0:00.09 init
2 root RT -5 0 0 0 S 0.0 0.0 0:00.20 migration/0
3 root 34 19 0 0 0 S 0.0 0.0 0:00.08 ksoftirqd/0
4 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/0
5 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 events/0
6 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 khelper
7 root 12 -5 0 0 0 S 0.0 0.0 0:00.00 kthread
9 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 xenwatch
10 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 xenbus
15 root RT -5 0 0 0 S 0.0 0.0 0:00.29 migration/1
16 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/1
17 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/1
18 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 events/1
19 root RT -5 0 0 0 S 0.0 0.0 0:00.17 migration/2
20 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/2
21 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/2
22 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 events/2
23 root RT -5 0 0 0 S 0.0 0.0 0:00.22 migration/3
[root@server2 ~]# free
total used free shared buffers cached
Mem: 262144 186748 75396 0 7332 110456
-/+ buffers/cache: 68960 193184
Swap: 262136 1780 260356
256MB OpenVZ CentOS 5.6
[root@server5 ~]# top
top - 22:47:41 up 2:34, 1 user, load average: 0.52, 1.14, 0.89
Tasks: 22 total, 1 running, 21 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 524288k total, 59320k used, 464968k free, 0k buffers
Swap: 0k total, 0k used, 0k free, 0k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1 root 18 0 2156 672 576 S 0.0 0.1 0:00.16 init
1512 root 19 0 2720 844 672 S 0.0 0.2 0:00.00 xinetd
3556 root 15 0 10988 3828 2272 S 0.0 0.7 0:01.56 sshd
3558 root 15 0 3616 1504 1272 S 0.0 0.3 0:00.02 bash
3599 root 15 0 2832 632 548 S 0.0 0.1 0:00.00 script
3600 root 15 0 2836 408 316 S 0.0 0.1 0:00.56 script
3601 root 15 0 3616 1504 1264 S 0.0 0.3 0:00.02 bash
3850 root 18 0 5684 700 424 S 0.0 0.1 0:00.00 saslauthd
3851 root 18 0 5684 440 164 S 0.0 0.1 0:00.00 saslauthd
3909 root 15 -4 2260 644 432 S 0.0 0.1 0:00.01 udevd
4055 root 15 0 1812 568 480 S 0.0 0.1 0:00.00 syslogd
5134 root 18 0 7200 1032 636 S 0.0 0.2 0:00.00 sshd
5279 root 18 0 4492 1100 556 S 0.0 0.2 0:00.00 crond
9588 root 18 0 3236 676 588 S 0.0 0.1 0:00.00 pure-ftpd
9720 root 18 0 12388 1464 340 S 0.0 0.3 0:00.00 nginx
9721 www 18 0 12672 2412 1008 S 0.0 0.5 0:00.00 nginx
9722 www 18 0 12568 1964 600 S 0.0 0.4 0:00.00 nginx
9726 root 18 0 44976 4564 1420 S 0.0 0.9 0:00.00 php-fpm
[root@server5 ~]# free
total used free shared buffers cached
Mem: 524288 58988 465300 0 0 0
-/+ buffers/cache: 58988 465300
Swap: 0 0 0
Thanks to
- lnmp.org for beautiful idea about the autoinstaller
- Junker @ vbfk.com for helping me out, you rock!
- Uncle G for free unlimited knowledge gateway
- WebHostingTalk for being my inspiration
- Few useful sites, forums, and wikis plus thousands spam sites that i cannot mention all
Troubleshooting
phpMyAdmin import database connection time out
Most of phpMyAdmin problem happened when importing a large database because by default i only set a few basic configurations so you can set your own configuration based on your needs. Here are the solutions:
Location: /etc/init.d/nginx.conf
client_max_body_size 8M
client_body_buffer_size 128k
Max body size accepted which effecting max upload limit is 8MB with 128kB temporary files written, add/change this value if you need to import database more than 8MB, otherwise you will get “Request Entity Too Large” error.
Location: /usr/lib/php.ini or /usr/lib64/php.ini
memory_limit = 256M
post_max_size = 8M
upload_max_filesize = 8M
Maximum memory usage during processing php script is 256MB, post_max_size value is nearly equal with NginX client_max_body_size, and upload_max_filesize is the upload size limit setting.
Location: /usr/html/yourphpmyadminfoldername/config.inc.php
$cfg['ExecTimeLimit'] = '0';
Add the above line to phpMyAdmin configurations to disabled execution time limit.
Location: /etc/php-fpm.conf
pm.max_children = 20
This setting is optional, but it is good if you’re increasing children worker to optimize php script process.
Cannot Login phpMyAdmin
You may get this error when trying to login to phpMyAdmin
#2002 Cannot log in to the MySQL server
Connection for controluser as defined in your configuration failed.
Solution:
edit config.inc.php and change localhost with 127.0.0.1
NginX 1.1.11 & 1.0.10
PHP 5.3.8 with PHP-FPM (Latest 5.3.x , faster for processing php script)
MySQL 5.5.19
phpMyAdmin 3.4.8
ionCube PHP Loader 4.0.11
Alternative PHP Cache (APC) 3.1.9
eAccelerator 0.9.6.1
XCache 1.3.2
Suhosin Extension 0.9.32.1
Imagick 3.0.1 (Optional)
FFMPEG 0.6.0 (Optional)
PureFTPD 1.0.35 (Optional)
Latest WordPress (Additional)
Preparation
Before you’re going to install it, set your domain a record in your domain control panel
Type Host Target
a record * Your IP address
a record domain.com Your IP address
a record www.domain.com Your IP address
If you want to use name server instead of ip based / public dns please check:
Setting Nameserver Based For Domain
Download and Unpack the auto installer
wget http://mirror.planehost.com/nginxauto-1.3.12.zip
unzip nginxauto-1.3.12.zip
Make the scripts executable
chmod +x centos.sh debuntu.sh vhost.sh
optional: create an installation log first before you start the installation process, so if there’s any error it would be easier to detect. If the installation is not complete or goes wrong, please send the log file to: log [att] serversreview.net
Here are some basic settings:
================================================================================
NGINX - PHP - MYSQL AUTO INSTALLER v1.3.12 FOR DEBIAN 6 & UBUNTU 10.10
================================================================================
Junker@vbfk.com & 2298@serversreview.net
For more information please visit
http://serversreview.net/nginx-auto-installer-php-mysql
================================================================================
Please input your preferred mysql root password: test
Please input your preferred ftp/sftp password: test
Please input your preferred phpmyadmin directory name: php
Type 'devv' for development version 1.1.11
Type 'stab' for stable version 1.0.10
Please choose your preferred NginX version: stab
Type 'sqlold' for older version 5.1.60
Type 'sqlnew' for latest version 5.5.19
Please choose your preferred MySQL version: sqlnew
Type 'phpold' for PHP 5.2.17
Type 'phpnew' for PHP 5.3.8
Please choose your preferred PHP version: phpnew
Type 'apc' for APC PHP
Type 'eaccel' for eAccelerator
Type 'xcache' for XCache
Please choose your preferred PHP Opcode Cacher: eaccel
Would you like to install Image Magick?[Y/n] y
Would you like to install FFMPEG?[Y/n] n
Would you like to install PureFTPD?[Y/n] y
Press any key to start the installation...
[CODE]
script log.txt
after the installation has finished, type
[CODE]exit
and it will generate ‘log.txt’ file
Install master script on a fresh OS box
For CentOS 5 (If you’re already using the previous version, the script will ask if you want to upgrade your current NginX version.)
./centos.sh
For Debian 6.0 and Ubuntu 10.10
./debuntu.sh
Add / Remove Domain
./vhost.sh
Main Apps Init command
Nginx
/etc/init.d/nginx { start | stop | restart }
PHP-FPM
/etc/init.d/php-fpm { start | stop | restart }
MySQL
/etc/init.d/mysql { start | stop | restart }
How much memory it consume?
Here are some proffs of memory usage:
256MB XEN CentOS 5.5
[root@server2 ~]# top
top - 04:36:56 up 3 days, 6:11, 1 user, load average: 0.00, 0.02, 0.04
Tasks: 113 total, 4 running, 109 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 262144k total, 187040k used, 75104k free, 7324k buffers
Swap: 262136k total, 1780k used, 260356k free, 110464k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1 root 15 0 10352 236 204 S 0.0 0.1 0:00.09 init
2 root RT -5 0 0 0 S 0.0 0.0 0:00.20 migration/0
3 root 34 19 0 0 0 S 0.0 0.0 0:00.08 ksoftirqd/0
4 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/0
5 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 events/0
6 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 khelper
7 root 12 -5 0 0 0 S 0.0 0.0 0:00.00 kthread
9 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 xenwatch
10 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 xenbus
15 root RT -5 0 0 0 S 0.0 0.0 0:00.29 migration/1
16 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/1
17 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/1
18 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 events/1
19 root RT -5 0 0 0 S 0.0 0.0 0:00.17 migration/2
20 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/2
21 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/2
22 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 events/2
23 root RT -5 0 0 0 S 0.0 0.0 0:00.22 migration/3
[root@server2 ~]# free
total used free shared buffers cached
Mem: 262144 186748 75396 0 7332 110456
-/+ buffers/cache: 68960 193184
Swap: 262136 1780 260356
256MB OpenVZ CentOS 5.6
[root@server5 ~]# top
top - 22:47:41 up 2:34, 1 user, load average: 0.52, 1.14, 0.89
Tasks: 22 total, 1 running, 21 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 524288k total, 59320k used, 464968k free, 0k buffers
Swap: 0k total, 0k used, 0k free, 0k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1 root 18 0 2156 672 576 S 0.0 0.1 0:00.16 init
1512 root 19 0 2720 844 672 S 0.0 0.2 0:00.00 xinetd
3556 root 15 0 10988 3828 2272 S 0.0 0.7 0:01.56 sshd
3558 root 15 0 3616 1504 1272 S 0.0 0.3 0:00.02 bash
3599 root 15 0 2832 632 548 S 0.0 0.1 0:00.00 script
3600 root 15 0 2836 408 316 S 0.0 0.1 0:00.56 script
3601 root 15 0 3616 1504 1264 S 0.0 0.3 0:00.02 bash
3850 root 18 0 5684 700 424 S 0.0 0.1 0:00.00 saslauthd
3851 root 18 0 5684 440 164 S 0.0 0.1 0:00.00 saslauthd
3909 root 15 -4 2260 644 432 S 0.0 0.1 0:00.01 udevd
4055 root 15 0 1812 568 480 S 0.0 0.1 0:00.00 syslogd
5134 root 18 0 7200 1032 636 S 0.0 0.2 0:00.00 sshd
5279 root 18 0 4492 1100 556 S 0.0 0.2 0:00.00 crond
9588 root 18 0 3236 676 588 S 0.0 0.1 0:00.00 pure-ftpd
9720 root 18 0 12388 1464 340 S 0.0 0.3 0:00.00 nginx
9721 www 18 0 12672 2412 1008 S 0.0 0.5 0:00.00 nginx
9722 www 18 0 12568 1964 600 S 0.0 0.4 0:00.00 nginx
9726 root 18 0 44976 4564 1420 S 0.0 0.9 0:00.00 php-fpm
[root@server5 ~]# free
total used free shared buffers cached
Mem: 524288 58988 465300 0 0 0
-/+ buffers/cache: 58988 465300
Swap: 0 0 0
Thanks to
- lnmp.org for beautiful idea about the autoinstaller
- Junker @ vbfk.com for helping me out, you rock!
- Uncle G for free unlimited knowledge gateway
- WebHostingTalk for being my inspiration
- Few useful sites, forums, and wikis plus thousands spam sites that i cannot mention all
Troubleshooting
phpMyAdmin import database connection time out
Most of phpMyAdmin problem happened when importing a large database because by default i only set a few basic configurations so you can set your own configuration based on your needs. Here are the solutions:
Location: /etc/init.d/nginx.conf
client_max_body_size 8M
client_body_buffer_size 128k
Max body size accepted which effecting max upload limit is 8MB with 128kB temporary files written, add/change this value if you need to import database more than 8MB, otherwise you will get “Request Entity Too Large” error.
Location: /usr/lib/php.ini or /usr/lib64/php.ini
memory_limit = 256M
post_max_size = 8M
upload_max_filesize = 8M
Maximum memory usage during processing php script is 256MB, post_max_size value is nearly equal with NginX client_max_body_size, and upload_max_filesize is the upload size limit setting.
Location: /usr/html/yourphpmyadminfoldername/config.inc.php
$cfg['ExecTimeLimit'] = '0';
Add the above line to phpMyAdmin configurations to disabled execution time limit.
Location: /etc/php-fpm.conf
pm.max_children = 20
This setting is optional, but it is good if you’re increasing children worker to optimize php script process.
Cannot Login phpMyAdmin
You may get this error when trying to login to phpMyAdmin
#2002 Cannot log in to the MySQL server
Connection for controluser as defined in your configuration failed.
Solution:
edit config.inc.php and change localhost with 127.0.0.1
