Centmin Mod was created and tested to work as standalone Nginx, PHP-FPM and MariaDB MySQL stack without the use of any control panels. The goal of the Centmin Mod menu based installation was to make it easier to manage without the aid of a control panel. Centmin Mod definitely doesn't work with WHM/Cpanel, Plesk or DirectAdmin. I am unsure if it will work with Webmin, ISPConfig or Kloxo. If you do try this yourself, please do on a test server environment only and not your live production web servers.
Centmin Mod was born from extensive modification of the original Centmin script. As such there was never any intention of within the original Centmin or my Centmin Mod script for purposes of shared hosting with multiple end users using individual FTP usernames to manage sites and domains.
Centmin Mod like original Centmin script, was intended for a single root user/administrator to manage multiple or single web site domains on a VPS or dedicated server. By default, in current version of Centmin Mod there is no security in place to protect one site domain vhost account from access to another domain vhost account. As such, current Centmin Mod script isn't suited to shared hosting where you provide to admin users other than yourself with site ftp/ssh access. All users would be able to access each site account. Of course this doesn't prevent you from modifying Centmin Mod script and structure to support shared hosting yourself if you know what you're doing. Note: I won't be able to provide any help if you do such modifications though.
For future Centmin Mod script versions, I do plan to add such support eventually but it's definitely something planned way into the future. So not anything that will be available anytime soon. Centmin Mod is provided for free and as is, so I am only working on Centmin Mod in my free time.
For now most folks do not need to install FTP, instead just use native SFTP to upload to Centmin Mod installed servers using SFTP supported client i.e. Filezilla - documentation and google tutorials http://lmgtfy.com/?q=filezilla+sftp+connect+server+tutorial. A few example tutorials:
First read the FAQ and following info pages for Nginx, MariaDB MySQL, PHP (php-fpm) and CSF Firewall (highly recommended to install when prompted). These will give a better understanding of the Centmin Mod setup.
Preferably, use CentOS 6.0 - 6.3 operating system where possible. Centmin Mod has only just started testing with CentOS 6.4 so needs more time testing. If you want to test CentOS 6.4 yourself on a test server first, you will need to edit centmin.sh and change the tested version line before installing and/or running centmin.sh.
From
TESTEDCENTOSVER='6.3'
To
TESTEDCENTOSVER='6.4'
You can provide feedback and suggestions on Centmin Mod Google+ Community
If possible, setup a test server or virtualised server via Virtualbox or VMWare to test out Centmin Mod before doing install on live server. For quick tests, you can easily setup a 512MB memory, 16GB hard disk storage Secured Cloud VM server instance using SecuredServers.com Cloud with costs starting from US$0.025 per hour. Benchmarks on Secured Cloud VM instance here.
Secured Cloud VM setup tip: To make your Centmin Mod install web accessible on Secured Cloud VMs, they have their own firewall enabled in Secured Cloud VM customer admin area that only allows port 22 and 3389 by default. For Centmin Mod installs, you can disable Secured Cloud VM's firewall and let Centmin Mod CSF firewall take over.
You'll need a VPS or dedicated server with full root user + SSH2 telnet access to install Centmin Mod. Logged in as root user via SSH2 telnet type these commands:
1. Download latest version of Centmin Mod from (you can find latest version info here) and download at http://vbtechsupport.com/920/. Download link will later move to centminmod.com domain.
cd /usr/local/src wget http://vbtechsupport.com/centminmenu/centmin-v1.2.2-eva2000.22.zip
2. Extract files and change to centmin-v1.2.2mod directory and chmod +x centmin.sh bash script.
unzip centmin-v1.2.2-eva2000.22.zip cd centmin-v1.2.2mod chmod +x centmin.sh
3. Run centmin.sh menu based installer and if this is first time installing, select option #1 for Centmin Install. If you are upgrading a server which already previously had Centmin Mod installed, you DO NOT need to run option #1, instead run option #4 and then #5 for upgrading Nginx web server and upgrading PHP. Run option #11 for MariaDB 5.2.x upgrades only when a new MariaDB 5.2.x version is mentioned on the official web site at changelog.html
./centmin.sh
Note:
If you are upgrading a server which already previously had Centmin Mod installed, you DO NOT need to run option #1 (in fact as of Centmin Mod v1.2.2-eva2000.14 it will be impossible to run option #1 as the script will detect previous install of Centmin Mod and abort the script), instead run option #4 and then #5 for upgrading Nginx web server and upgrading PHP. You only need to run these if you upgrading to new Nginx or PHP version. If your existing Centmin Mod install has the same versions for Nginx and PHP, no need to even run those menu options.
Menu option #4 will upgrade Nginx web server by prompting you to enter the Nginx version you want to install. You may receive 404 Not Found errors on php pages after Nginx upgrade. If you do, run Menu option #5 to upgrade/reinstall PHP version. You will find the latest stable and development versions on Nginx.org. The Nginx upgrade routine will do a preliminary YUM update check to make sure any new Centmin Mod options have their required YUM installed software prior to the upgrade.
You can also use the menu option #4 to downgrade Nginx versions as well just by entering a Nginx version you want. For Centmin Mod, I would stick with the stable version Nginx v1.1.xx to v1.2.xx as there are changes to nginx.conf etc which Centmin Mod caters to in it's configuration files, which earlier Nginx versions won't support.
Nginx upgrade process will also backup your existing Nginx conf directory and file via 3 options in centmin.sh: NGINXBACKUP='y', NGINXCONFDIR='/usr/local/nginx/conf', NGINXBACKUPDIR='/usr/local/nginxbackup'. You will find backups of previous Nginx versions in timestamped directories located within /usr/local/nginxbackup.
Menu option #5 will upgrade your PHP version to whatever version you enter at the prompt. You'll find latest PHP versions stable releases on the top right corner column on php.net. But as of this moment, stick with PHP 5.3.x as PHP 5.4.x seems to have problems with some extensions such as Xcache, APC, Suhosin and FFMPEG PHP extensions. APC v3.1.11+ and Xcache v2.0x seem to work with PHP 5.4.x but double check that your intended PHP scripts work with PHP 5.4.x.
Upgrading PHP involves some additional steps if you had installed any of the following PHP extensions, Xcache, APC, Suhosin, FFMPEG, Memcache or generally any extension which required you to manually load a *.so file into php.ini. The reason why is the PHP upgrade routine will backup your existing php.ini which is at /usr/local/lib/php.ini and save backup to /usr/local/lib/php.ini-oldversion_timestamp and then overwrite that php.ini file with latest php.ini supplied by PHP tarbal download package.
The PHP upgrade process will then do a DIFF comparison check between new /usr/local/lib/php.ini and saved backup at /usr/local/lib/php.ini-oldversion_timestamp and display all the changes and differences between the file. There's a 60 second delay on the screen so you can use that opportunity to copy or note the changes for your own records. Usually, the changes will highlight what PHP extensions were installed previously and what is missing in the new php.ini.
All you have to do is re-install those PHP extensions via menu options listed below - for Suhosin and FFMPEG install is fine:
The PHP upgrade process also backs up and overwrites your existing php-fpm configuration file /usr/local/etc/php-fpm.conf to /usr/local/etc/php-fpm.conf-oldversion_timestamped. It will prompt you and ask if you want to overwrite and backup the php-fpm.conf file. This is to ensure updated php-fpm.conf changes make it into your server's php-fpm configuration.
Menu option #11 will upgrade your MariaDB 5.2.x MySQL server version. But unlike Nginx and PHP upgrade routines, it will not prompt for MariaDB version. The version that is upgraded to is determined by what is set in centmin.sh for the following variables:
Set to version you want to upgrade to:
MDB_VERONLY='5.2.14' MDB_BUILD='122'
Set to existing version you are already using:
MDB_PREVERONLY='5.2.12' MDB_PREBUILD='115'
So centmin.sh will look like this for MariaDB 5.2.12 Build 115 upgrade to MariaDB 5.2.14 Build 122.
# Define current MariaDB version
MDB_VERONLY='5.2.14'
MDB_BUILD='122'
MDB_VERSION="${MDB_VERONLY}-${MDB_BUILD}" # Use this version of MariaDB ${MDB_VERONLY}
# Define previous MariaDB version for proper upgrade
MDB_PREVERONLY='5.2.12'
MDB_PREBUILD='115'
MDB_PREVERSION="${MDB_PREVERONLY}-${MDB_PREBUILD}" # Use this version of MariaDB ${MDB_VERONLY}
Please stick with only the latest MariaDB 5.2.x version tested and listed on official web site at changelog.html. I can not guarantee that higher versions which have not been tested by me to work 100%.
Before upgrading it is highly recommended to backup all your mysql databases using mysqldump
backup
mysqldump -u mysqlusername -p mysqldatabasename > /path/to/mysqldatabasename_backup_date.sql
restore
mysql -u mysqlusername -p mysqldatabasename < /path/to/mysqldatabasename_backup_date.sql
Centmin Mod releases are tested from fresh installs as well as upgrades with both latest PHP (php-fpm) 5.3.x and 5.4.x versions . But PHP (php-fpm) 5.3.x is the default installed PHP version for best PHP script compatibility. Not all PHP scripts out there are coded to support PHP 5.4.x, so I've left the choice of PHP versions up to the end user. You can choose to either use PHP 5.3.x or 5.4.x yourself and it would be up to you to make sure your PHP scripts support PHP 5.4.x. You can always downgrade to PHP 5.3.x later on and upgrade again to PHP 5.4.x whenever you want.
You'll find latest PHP versions stable releases on the top right corner column on php.net.
There are 2 methods you can choose to use PHP (php-fpm) 5.4.x:
Method 1.
Start fresh Centmin Mod install with latest PHP 5.4.x version by editing centmin.sh and changing the PHP_VERSION variable to appropriate PHP version. So to go from PHP 5.3.22 to PHP 5.4.14, you'd edit centmin.sh BEFORE running fresh installation and change the variable
from
PHP_VERSION='5.3.22' # Use this version of PHP
to
PHP_VERSION='5.4.14' # Use this version of PHP
Then do the first time fresh install as per FAQ guide
Method 2.
Upgrading an existing Centmin Mod install base from PHP 5.3.x to PHP 5.4.x by running centmin.sh script and selecting menu option #5 and specifying the PHP version you want to upgrade (or downgrade to) i.e. specify PHP 5.4.14 or PHP 5.3.24. More specific upgrade details outlined in FAQ Guide.
You can do this via Centmin Mod menu options #2 & #3. Full details here.
Remember to check your domain name's DNS is properly configured at both your domain registrar & web server end (NSD) by running domain name through these 3 dns test sites
From Centmin Mod v1.2.2-eva2000.15 and onwards, logging is automatically done when you run centmin.sh. A log directory is defined by variable CENTMINLOGDIR='/root/centminlogs' in inc/centminlogs.inc. When run menu option, the entire process will be logged to a time stamped text log file named ${CENTMINLOGDIR}/centminmod_${SCRIPT_VERSION}_${DT}_*.log so you can review the logs for error messages etc
ls -lhrt /root/centminlogs/ total 7.3M -rw-r--r-- 1 root root 4.3M Apr 14 17:14 centminmod_1.2.2-eva2000.15_140412-151749_install.log -rw-r--r-- 1 root root 1.7M Apr 14 17:44 centminmod_1.2.2-eva2000.15_140412-173219_php_upgrade.log -rw-r--r-- 1 root root 30K Apr 14 17:44 centminmod_1.2.2-eva2000.15_140412-173219_apc_reinstall.log -rw-r--r-- 1 root root 89K Apr 14 17:45 centminmod_1.2.2-eva2000.15_140412-173219_memcached_reinstall.log -rw-r--r-- 1 root root 24K Apr 14 17:46 centminmod_1.2.2-eva2000.15_140412-173219_suhosin_install.log -rw-r--r-- 1 root root 17K Apr 14 17:49 centminmod_1.2.2-eva2000.15_140412-173219_ffmpeg_install.log -rw-r--r-- 1 root root 1.3M Apr 14 18:02 centminmod_1.2.2-eva2000.15_140412-173219_nginx_upgrade.log -rw-r--r-- 1 root root 23K Apr 14 18:31 centminmod_1.2.2-eva2000.15_140412-183136_nsd_reinstall.log
Old method (prior to v1.2.2-eva2000.15): If you're testing Centmin Mod installation on a test server and want to log the entire output of the process to a log file, you can use script command before running centmin.sh.
Type this command before running centmin.sh
script -f centminv122mod.log
Run centmin.sh which will invoke the full menu and select options you wan to run i.e. option #1
./centmin.sh
When you finished running centmin.sh hit exit option then at command prompt type exit command, this finishes the log and writes everything to centminv122mod.log which you can download and review.
exit
To change timezone before install, edit centmin.sh and find and change the ZONEINFO variable. For after install changes and more on ZONEINFO variable read the full guide here.
Time it takes varies depending on what software you opt to install, the server's network connectivity speed and the type of VPS or dedicated server you install it on. More powerful servers will take less time to install. The faster your server's network connectivity, the faster it downloads software (YUM/RPMs). On my local virtualbox test server (Xeon W3540 @3.5Ghz 2 cores allocated, 1.5GB memory, SATAII disk) for CentOS 5.5, 5.6 and 6.0, for full install for all prompted default options it takes roughly 20-22 minutes to install. On centminmod.com's cluster of 512MB / 1GB Burst OpenVZ based VPSes with 2 core Xeon E5520, the same full install took nearly 55 minutes. You may think that is a long time, but remember in most cases you'll be optimised post-install time ready to go as opposed to usual YUM/RPM install, you could spend hours post-install on getting everything optimised settings wise.
Centmin Mod Nginx auto installer has been tested on CentOS 5.5, 5.6, 5.7, 6.0, 6.1, 6.2 and 6.3 64bit and CentOS 6.0 to 6.3 32bit so far. Earlier Centmin Mod script has also been successfully tested with Scientific Linux 6.0 64bit. But current full menu supported version of Centmin Mod have not been tested with Scientific Linux 6.
Centmin Mod has personally been tested on mainly on local Virtualbox servers, Parallels Virtuozzo and OpenVZ based VPS servers. As of October 15, 2012, also successfully tested on Secured Cloud VMWare instances which are great for quick tests - a 512MB ram, 16GB hard disk VM instance only costs around US$0.025 per hour! Reports from Centmin Mod users have confirmed working installations also on Xen and KVM based VPS servers as well. I intend to also personally test Centmin Mod Nginx auto installer on Xen and KVM based VPS servers shortly.
Note: If you are using Xen Paravirtualization and are running a 32bit OS on a 64bit host node, then you must uncomment the #ARCH_OVERRIDE='i386' line of the script, else it will not function correctly. (to uncomment, simply remove the hash - #).
Currently, only testing Debian for MariaDB 5.2.x Mysql tuning and optimisation and for the Debian version of my mysqlmymonlite.sh server stats gathering script. But there's a definite possibility that in future, I'll write up a Debian version once I have Centmin Mod version settled in terms of features and stability. As for a FreeBSD Nginx auto installer script, there's no plans right now. But that can change.
Put simply, MariaDB 5.2.x MySQL server currently has the best performance mix for both MyISAM and InnoDB storage engines in MySQL. You can read benchmarks I did on my blog Part 1 and Part 2. While it may not make as much difference for VPS and dedicated servers with low memory and cpu core count specifications, MariaDB 5.2.x uses Percona's XtraDB InnoDB engine so has same or somewhat better InnoDB performance as Percona but MariaDB is the only MySQL version which still focuses on MySQL core improvements as well as improvements to MyISAM engine.
As at May 18th, 2013, latest Centmin Mod v1.2.3 beta has MariaDB 5.5 MySQL default support as outlined here.
Note: MariaDB 5.5.30 currently has a bug when a host is configured to have both ipv6 and ipv4 enabled you may get 'Error establishing a database connection' with your web apps i.e. wordpress when connecting via localhost. If you use 127.0.0.1 instead of localhost it works fine. This bug is fixed in next MariaDB 5.5.31 release (bug reported).
yum -q -y install postfix
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package postfix.x86_64 2:2.6.6-2.2.el6_1 will be installed
--> Processing Dependency: mysql-libs for package: 2:postfix-2.6.6-2.2.el6_1.x86_64
--> Finished Dependency Resolution
Error: Package: 2:postfix-2.6.6-2.2.el6_1.x86_64 (base)
Requires: mysql-libs
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
This is a problem with MariaDB 5.2 RPM packages on CentOS 6.x which usually provides mysql-libs but to install MariaDB 5.2 you have to uninstall mysql-libs which postfix requires. This is fixed with MariaDB 5.5 packages as it includes the dependencies that CentOS 6.x mysql-lib usually provide.
As at May 18th, 2013, latest Centmin Mod v1.2.3 beta has MariaDB 5.5 MySQL default support as outlined here.
Note: MariaDB 5.5.30 currently has a bug when a host is configured to have both ipv6 and ipv4 enabled you may get 'Error establishing a database connection' with your web apps i.e. wordpress when connecting via localhost. If you use 127.0.0.1 instead of localhost it works fine. This bug is fixed in next MariaDB 5.5.31 release (bug reported).
Centmin Mod will very soon be moving to MariaDB 5.5 base installs by default for this very reason as well as the better performing MariaDB 5.5 server. Testing is currently being done with MariaDB 5.5. For updates as to when MariaDB 5.5 support comes to Centmin Mod, please follow me on Twitter or via Centmin Mod Google+ Page.
Example of successful install of postfix with test MariaDB 5.5 on Centmin Mod install
mysqladmin ver mysqladmin Ver 9.0 Distrib 5.5.25-MariaDB, for Linux on x86_64 Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc, 2009 Monty Program Ab This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL license Server version 5.5.25-MariaDB Protocol version 10 Connection Localhost via UNIX socket UNIX socket /var/lib/mysql/mysql.sock Uptime: 5 sec Threads: 1 Questions: 1 Slow queries: 0 Opens: 33 Flush tables: 1 Open tables: 26 Queries per second avg: 0.200
yum install postfix Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package postfix.x86_64 2:2.6.6-2.2.el6_1 will be installed --> Finished Dependency Resolution Dependencies Resolved ========================================================================= Package Arch Version Repository Size ========================================================================= Installing: postfix x86_64 2:2.6.6-2.2.el6_1 base 2.0 M Transaction Summary ========================================================================= Install 1 Package(s) Total download size: 2.0 M Installed size: 9.7 M Is this ok [y/N]: y Downloading Packages: postfix-2.6.6-2.2.el6_1.x86_64.rpm | 2.0 MB 00:01 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : 2:postfix-2.6.6-2.2.el6_1.x86_64 1/1 Installed: postfix.x86_64 2:2.6.6-2.2.el6_1 Complete!
This depends on various factors including, what you choose to install software wise at installation time, opting to install Xcache or APC cache for php opcode caching, Memcached servers - choice between 1 or 2 instances, whether you choose to use MySQL.com community release default MySQL 5.0.x/5.1 or higher memory usage but better performing MariaDB 5.2.x based MySQL server and dependent on the CentOS operating system version and whether it's 32bit or 64bit. 64bit will generally use more memory than 32bit. For VPS based servers, it will also depend on what type of virtualization is implemented. OpenVZ based VPS out of box used more memory if left unchecked due to default stack sizes. Check out my BuyVM.net VPS review on my blog here.
On centminmod.com OpenVZ based VPS servers, if you selected 'y' to <256MB installation prompts at install time, with full software install - Nginx v1.1.x, PHP 5.3.8 PHP-FPM, MariaDB 5.2.9, APC cache, 1x Memcached server instance, CSF firewall, NSD DNS, siege bench and Python 2.72 the idle memory usage falls between 112-130MB.
Below is sample output for one of my OpenVZ VPS - note there's several active SSH/SFTP connections as well. PHP-FPM and MariaDB MySQL server are the biggest consumers of memory in default Centmin Mod installation. You could tune them even more for less memory usage, but at the expense of performance.
--------------------------------
base mem usage
total used free shared buffers cached
Mem: 1024 24 999 0 0 0
-/+ buffers/cache: 24 999
Swap: 0 0 0
--------------------------------
Starting system logger: [ OK ]
total used free shared buffers cached
Mem: 1024 26 997 0 0 0
-/+ buffers/cache: 26 997
Swap: 0 0 0
--------------------------------
Starting xinetd: [ OK ]
total used free shared buffers cached
Mem: 1024 27 996 0 0 0
-/+ buffers/cache: 27 996
Swap: 0 0 0
--------------------------------
Starting saslauthd: [ OK ]
total used free shared buffers cached
Mem: 1024 28 995 0 0 0
-/+ buffers/cache: 28 995
Swap: 0 0 0
--------------------------------
Starting sendmail: [ OK ]
Starting sm-client: [ OK ]
total used free shared buffers cached
Mem: 1024 31 992 0 0 0
-/+ buffers/cache: 31 992
Swap: 0 0 0
--------------------------------
Starting sshd: [ OK ]
total used free shared buffers cached
Mem: 1024 31 992 0 0 0
-/+ buffers/cache: 31 992
Swap: 0 0 0
--------------------------------
[ OK ] crond: [ OK ]
total used free shared buffers cached
Mem: 1024 32 991 0 0 0
-/+ buffers/cache: 32 991
Swap: 0 0 0
--------------------------------
Starting lfd:[ OK ]
total used free shared buffers cached
Mem: 1024 41 982 0 0 0
-/+ buffers/cache: 41 982
Swap: 0 0 0
--------------------------------
Starting php-fpm done
total used free shared buffers cached
Mem: 1024 72 951 0 0 0
-/+ buffers/cache: 72 951
Swap: 0 0 0
--------------------------------
Starting nginx: [ OK ]
total used free shared buffers cached
Mem: 1024 73 950 0 0 0
-/+ buffers/cache: 73 950
Swap: 0 0 0
--------------------------------
Starting MySQL.. SUCCESS!
total used free shared buffers cached
Mem: 1024 123 900 0 0 0
-/+ buffers/cache: 123 900
Swap: 0 0 0
--------------------------------
memcached start
total used free shared buffers cached
Mem: 1024 125 898 0 0 0
-/+ buffers/cache: 125 898
Swap: 0 0 0
--------------------------------
When I started modifying the original Centmin script for my own needs, the first thing I did was add command shortcuts to Centmin Mod. Normally, to edit server configuration files or start/stop/restart services in SSH2 telnet, you need to type in lengthy commands.
With command shortcuts, if you opted to install them at Centmin Mod installation time, you'll be able to type a one word command to perform the entire action. Of course, the software needs to be installed for command lines to work i.e. memcached or csf need to have been installed. The command shortcuts invokes the nano linux text editor, you can read up more about nano here and here.
Below are a list of command shortcuts:
Unfortunately, I haven't gotten my head around rewrite rules and regex as yet. Best place to ask for help for Apache rewrite/htaccess conversions to equivalent Nginx rewrite rule would be on Nginx's official forums at http://forum.nginx.org/. I am actively looking at compiling a list of standard working Nginx rewrite rules for various software like, wordpress & drupal perma links, vBulletin, xenforo, IPB forums and other software. Appropiate credit/linking to contributor and their site will be given on the compiled list page. So if you'd like to contribute to such a list, feel free to contact me.
When I started modifying the original Centmin script for my own needs, I had a very specific configuration in mind for Nginx, PHP-FPM, and MariaDB. They would be custom tuned settings wise from out of the box installations - ready to hit the ground running with optimised specific settings.
RPM/YUM while faster for installation, wouldn't satisfy my goals in that you'd spend alot more time after installation trying to customise each and every software. I also use Amazon EC2, Rackspace Cloud, GoGrid based cloud server hosting for testing as well for my Apache equivalent bash auto install script which I wrote from ground up prior to finding Centmin (alot of the Centmin Mod functions were ported over from my Apache bash auto installer sript - including the above command shortcut feature).
The Apache version like Centmin Mod, aimed at reducing the amount of post-install time in customising settings for all software. Afterall, cloud server hosting charges by the hour, so less time post-install configuring equals less costs incurred. So basically, some software is source compiled for this reason - weighing up a more lengthy install process for nearly zero time post-install custom configuration process. The other reason for source compile for Nginx, PHP-FPM, Xcache, APC, Memcached etc is that these are constantly updated with new versions and rather than be reliant on and waiting for YUM REPO/RPM binary updates which always lag behind the new releases, source compilation allowed much more timely updates.
Some of Centmin Mod's installed software will have their own access and error logs which maybe useful for diagnosing errors or give info, notes, or warning notices.
Note: There's no support provided by me for diagnosing such errors which may occur for various reasons including misconfiguration of installed php/mysql scripts or applications.
In SSH2 telnet you can use tail command to view the last X number of lines in the file.
For example for viewing last 10 lines in the file for:
For Nginx access and error logs:
tail -10 /usr/local/nginx/logs/access.log tail -10 /usr/local/nginx/logs/error.log
For specific domainname.com access and error log:
tail -10 /home/nginx/domains/domainname.com/log/access.log tail -10 /home/nginx/domains/domainname.com/log/error.log
For other system error logs located at /var/log:
list /var/log files in ascending time order so the most recently modified files are at the bottom
ls -lhrt /var/log total 2.7M -rw------- 1 root root 0 Aug 29 15:33 tallylog -rw------- 1 root root 0 Aug 29 15:33 spooler drwx------ 3 root root 4.0K Aug 29 15:35 samba drwxr-xr-x 2 root root 4.0K Aug 29 15:35 mail -rw-r--r-- 1 root 500 0 Oct 8 18:13 dmesg.old -rw------- 1 root 500 0 Oct 8 18:13 boot.log -rw-r--r-- 1 root 500 0 Oct 8 18:14 dmesg drwx------ 2 root root 4.0K Oct 8 18:14 httpd drwxr-xr-x 2 root root 4.0K Oct 8 19:08 php-fpm -rw-rw---- 1 mysql root 2.3K Oct 9 12:38 mysqld.log -rw------- 1 root root 9.2K Oct 26 10:48 yum.log -rw------- 1 root utmp 94K Nov 7 22:59 btmp drwxr-xr-x 2 root root 4.0K Nov 8 00:00 sa -rw------- 1 root root 269K Nov 8 21:39 messages -rw------- 1 root root 110K Nov 8 23:08 secure -rw-rw-r-- 1 root utmp 43K Nov 8 23:08 wtmp -rw-r--r-- 1 root root 144K Nov 8 23:08 lastlog -rw------- 1 root root 69K Nov 8 23:08 lfd.log -rw------- 1 root root 332K Nov 8 23:08 maillog -rw------- 1 root 500 1.6M Nov 8 23:10 cron
For PHP-FPM error log:
tail -10 /var/log/php-fpm/www-error.log
For MySQL / MariaDB error log:
tail -10 /var/log/mysqld.log
For CSF firewall LFD log:
tail -10 /var/log/lfd.log
For Mail log:
tail -10 /var/log/maillog
For Cron job logs:
tail -10 /var/log/cron
You need to edit /usr/local/nginx/conf/conf.d/virtual.conf and find the very first instance of these lines
include /usr/local/nginx/conf/staticfiles.conf; include /usr/local/nginx/conf/php.conf; #include /usr/local/nginx/conf/phpstatus.conf; include /usr/local/nginx/conf/drop.conf; #include /usr/local/nginx/conf/errorpage.conf;
Uncomment and enable by remove # hash in front of phpstatus.conf
So this
#include /usr/local/nginx/conf/phpstatus.conf;
becomes
include /usr/local/nginx/conf/phpstatus.conf;
save /usr/local/nginx/conf/conf.d/virtual.conf, then restart Nginx
service nginx restart
or if you installed centmin mod shortcuts http://centminmod.com/faq.html#commandshortcuts you can use this command
ngxrestart
then install lynx via yum
yum -q -y install lynx
then run this command whenever you want to see php-fpm usage stats
lynx --dump http://127.0.0.1/phpstatus
You'll get output like below
pool: www process manager: static start time: 28/Jun/2012:21:24:51 +0400 start since: 75 accepted conn: 196 listen queue: 0 max listen queue: 0 listen queue len: 0 idle processes: 4 active processes: 1 total processes: 5 max active processes: 1 max children reached: 0
PHP Status explained:
To increase or decrease Memcached server's allocated memory size, you will need to edit /etc/init.d/memcached start up file's MEMSIZE=8 variable. The variable assigns memory in MegaBytes (MB), so MEMSIZE=8 is equal to 8MB. If you want to allocate 256MB to Memcached server(s), then edit and change variable to MEMSIZE=256 and then restart memcached server:
service memcached restart
or via command shortcut
memcachedrestart
Since Centmin Mod v1.2.2-eva2000.09, installation automatically sets up a /etc/cron.daily/diskalert daily cron job script to monitor your disk space usage. By default the script will alert you to when disk space usage is >90% on any one partition on your server and sends email to root user unless you edit the script at /etc/cron.daily/diskalert to set the EMAIL='youremail@email.com' address. You can also change the preset warning percentage threshold by editing /etc/cron.daily/diskalert and changing ALERT='90' to different percentage.
It is important to monitor disk space usage - to be able to see how much free disk space you have left. It is sometimes one of the more commonly overlooked metrics on VPS or dedicated servers.
Common errors you may come across while installing or using Centmin Mod on CentOS operating system:
Problem: If you forget to make centmin.sh script executable via chmoding it or setting it's permissions to 755 via FTP/SFTP you'll get permission denied message for centmin.sh. Make sure you are running centmin.sh as root administrative user.
./centmin.sh: Permission denied
Solution: in SSH2 telnet as root admin user chmod centmin.sh or via FTP/SFTP set 755 permissions on centmin.sh
chmod +x centmin.sh
Problem: Nginx upgrade option fails - nginx tarball file not found.
Compiling nginx... --2011-10-07 14:48:5-- http://nginx.org/download/nginx-.tar.gz Resolving nginx.org... 206.251.255.63 Connecting to nginx.org|206.251.255.63|:80... connected. HTTP request sent, awaiting response... 404 Not Found 2011-10-07 14:48:53 ERROR 404: Not Found. tar: nginx-.tar.gz: Cannot open: No such file or directory tar: Error is not recoverable: exiting now tar: Child returned status 2 tar: Error exit delayed from previous errors ./centmin.sh: line 1789: cd: nginx-: No such file or directory make: *** No rule to make target 'clean'. Stop. Would you like to compile nginx with IPv6 support? [y/n]
Solution: You didn't enter the correct nginx version number when prompted when you ran nginx upgrade option.
ie. enter 1.0.8 or 1.1.5 at prompt
--------------------------------------------------------
Centmin 1.2.2-eva2000.02 - http://centminmod.com
Menu/Mods Author: eva2000 (vbtechsupport.com)
Centmin Original Author: BTCentral (btcentral.org.uk)
--------------------------------------------------------
Centmin Menu
--------------------------------------------------------
1). Centmin Install
2). Add Nginx vhost domain
3). NSD setup domain name DNS
4). Nginx Upgrade
5). PHP Upgrade
6). XCache Re-install
7). APC Cache Re-install
8). XCache Install
9). APC Cache Install
10). Memcached Server Re-install
11). MariaDB 5.2 Upgrade
12). Install ioping.sh vbtechsupport.com/1239/
13). SELinux disable
14). Setup Logrotate for Nginx
15). Setup Logrotate for PHP-FPM
16). Change SSHD Port Number
17). Exit
--------------------------------------------------------
Enter option [ 1 - 17 ] 4
--------------------------------------------------------
**********************************************************************
* Nginx Update script - Included in Centmin Extras
* Version: 1.2.2-eva2000.02 - Date: 08/10/2011 - Copyright 2011 BTCentral
**********************************************************************
This software comes with no warranty of any kind. You are free to use
it for both personal and commercial use as licensed under the GPL.
Nginx Upgrade - Would you like to continue? [y/n] y
Install which version of Nginx? (version i.e. 1.0.6): 1.1.5
Problem: MySQL server not starting up, I get the following error message:
Starting MySQL................................ ERROR! Manager of pid-file quit without updating file.
Solution: Run the following commands:
Check mysql error log for unsupported mysql variable options you may have added or changed in /etc/my.cnf after Centmin Mod initial installation
Command to run in ssh2 telnet as root user:
tail -30 /var/lib/mysql/`hostname`.err | sed -e "s/`hostname`/yourserverhostname/g"
Also check:
tail -30 /var/log/mysqld.log | sed -e "s/`hostname`/yourserverhostname/g"
Check MySQL server status to see if it's running or stopped
Command to run in ssh2 telnet as root user:
service mysql status
If MySQL status says stopped but there's still mysql* processes showing up in first command below, run the second command to kill any lingering mysql processes preventing mysql to start up properly
1st command
ps aux |grep mysql |awk '{print $2, $7, $8, $9, $10, $11, $12}' | grep -Ev grep
2nd command
kill -9 `ps aux |grep mysql |awk '{print $2}'`
Restart MySQL server
Command to run in ssh2 telnet as root user:
service mysql restart
Problem: I can't connect to the installed Memcached server instance on 127.0.0.1 port 11211 ?
Solution: Steps to follow:
1. Check if memcached server is running and that php was successfully compiled with memcache extension (which it would of been when you said YES to memcached server install prompt).
Command to check memcached server running:
ps ax | grep memcached | grep -Ev grep
output showing memcached server running:
ps ax | grep memcached | grep -Ev grep 3210 ? Ssl 0:00 /usr/local/bin/memcached -d -m 8 -l 127.0.0.1 -p 11211 -c 2048 -t 4 -n 48 -f 1.05 -u nobody
Command to check memcache extension loaded with phpinfo:
php -i | grep memcache
output showing memcache php extension loaded and installed:
php -i | grep memcache memcache memcache support => enabled memcache.allow_failover => 1 => 1 memcache.chunk_size => 32768 => 32768 memcache.compress_threshold => 20000 => 20000 memcache.default_port => 11211 => 11211 memcache.hash_function => crc32 => crc32 memcache.hash_strategy => consistent => consistent memcache.lock_timeout => 15 => 15 memcache.max_failover_attempts => 20 => 20 memcache.protocol => ascii => ascii memcache.redundancy => 1 => 1 memcache.session_redundancy => 2 => 2 Registered save handlers => files user sqlite memcache
2. If you installed CSF firewall when prompted, the default memcached 11211 port would of been set to allow the memcached server through CSF firewall. If you didn't install CSF firewall, then you may have ip tables enabled running and it is blocking 11211 port so need to add a rule to allow memcached port 11211 through iptables.
Confirm if iptables is blocking 11211 port, by temporarily shutting down iptables service with command
service iptables stop
Now check if you can connet to your memcached server on default 127.0.0.1 and port 11211. If you can connect when iptables is stopped, then you need to allow port 11211 through iptables with either command or iptables file edit.
Start iptables service again
service iptables start
Command for iptables to allow port 11211
iptables -A INPUT -p tcp --dport 11211 -j ACCEPT
or edit /etc/sysconfig/iptables and add after the default port 22 line
-A INPUT -m state --state NEW -m tcp -p tcp --dport 11211 -j ACCEPT
restart iptables
service iptables restart
Problem: Tried upgrading MariaDB MySQL and it's still stuck on MariaDB 5.2.10 ?.
rpm -qa | grep MariaDB MariaDB-devel-5.2.10-107.el5.x86_64 MariaDB-client-5.2.10-107.el5.x86_64 MariaDB-server-5.2.10-107.el5.x86_64 MariaDB-shared-5.2.10-107.el5.x86_64 MariaDB-test-5.2.10-107.el5.x86_64
Solution: For a bried period during Centmin Mod's early versions, I used a YUM repo for MariaDB 5.2.x installs, but it never gets updated in timely manner and latest version was MariaDB 5.2.10. So I switched back to manual install and updates via RPM binaries. If you have MariaDB 5.2.10 still showing up after trying to run menu option to upgrade MariaDB 5.2.10, please follow below suggestions
1. Edit centmin.sh file and find these 3 settings and edit it to which ever MariaDB version and build you are stuck on. In this case 5.2.10 and build 107
# Define previous MariaDB version for proper upgrade
MDB_PREVERONLY='5.2.10'
MDB_PREBUILD='107'
MDB_PREVERSION="${MDB_PREVERONLY}-${MDB_PREBUILD}" # Use this version of MariaDB ${MDB_VERONLY}
2. Then run MariaDB upgrade menu option #11
--------------------------------------------------------
Centmin 1.2.2-eva2000.15 - http://centminmod.com
--------------------------------------------------------
Centmin Menu
--------------------------------------------------------
1). Centmin Install
2). Add Nginx vhost domain
3). NSD setup domain name DNS
4). Nginx Upgrade
5). PHP Upgrade
6). XCache Re-install
7). APC Cache Re-install
8). XCache Install
9). APC Cache Install
10). Memcached Server Re-install
11). MariaDB 5.2 Upgrade
12). Install ioping.sh vbtechsupport.com/1239/
13). SELinux disable
14). Setup Logrotate for Nginx
15). Setup Logrotate for PHP-FPM
16). Change SSHD Port Number
17). Multi-thread compression: pigz,pbzip2,lbzip2,p7zip etc
18). Suhosin PHP Extension install
19). Install FFMPEG and FFMPEG PHP Extension
20). NSD Re-install
21). Exit
--------------------------------------------------------
Enter option [ 1 - 21 ] 11
--------------------------------------------------------
3. When prompted for path to save downloads, enter /svr-setup to keep your version inline for future updates and reinstalls.
Where do you want the downloads stored ? Enter path to download directory (i.e. /usr/local/src) /svr-setup
4. After upgrade process you will be return to Centmin Mod menu, exit it and run the command to check your MariaDB MySQL server has been updated to latest version.
rpm -qa | grep MariaDB
rpm -qa | grep MariaDB MariaDB-shared-5.2.12-115.el5.i386 MariaDB-test-5.2.12-115.el5.i386 MariaDB-client-5.2.12-115.el5.i386 MariaDB-server-5.2.12-115.el5.i386 MariaDB-devel-5.2.12-115.el5.i386