How to Install VMware Tools on Ubuntu 14.04

VMware Tools is a group of utilities and drivers that enhances the performance of the virtual machine’s guest operating system and improves interaction between the guest and the host when running on a VMware Esx/Esxi, VMware Player, VMware Server or VMware Workstation. This post will show you how to install VMware Tools on Ubuntu 14.04. There are multiple way to install VMware Tools into an Ubuntu VM. This post will describe how you can install VMware Tools from vSphere client installer.

1. Install required packages:

ehowstuff@ubuntu14:~$ sudo-get install build-essential linux-header-$(uname -r)

2. Login to vCenter using vsphere client, right clicking on the Ubuntu 14.04 VM, selecting “Guest”, and then choosing “Install VMware Tools”.

3. Mount the VMware Tools CD image to /media/cdrom

ehowstuff@ubuntu14:~$ sudo mount /dev/cdrom /media/cdrom
mount: block device /dev/sr0 is write-protected, mounting read-only

4. Copy the compressed VMware Tools installer files to /tmp in the local directory :

ehowstuff@ubuntu14:~$ cd /media/cdrom
ehowstuff@ubuntu14:/media/cdrom$ ls
manifest.txt  VMwareTools-8.3.7-341836.tar.gz
ehowstuff@ubuntu14:/media/cdrom$ cp VMwareTools-8.3.7-341836.tar.gz /tmp

5. Unmount the VMware Tools CD image :

ehowstuff@ubuntu14:/media/cdrom$ cd
ehowstuff@ubuntu14:~$ sudo umount /media/cdrom

6. Extract the compressed VMware Tools installer :

ehowstuff@ubuntu14:~$ cd /tmp
ehowstuff@ubuntu14:/tmp$ tar xzvf VMwareTools-8.3.7-341836.tar.gz

7. Change directories into the VMware Tools distribution by running the command:

ehowstuff@ubuntu14:~$ cd /tmp/vmware-tools-distrib/
ehowstuff@ubuntu14:/tmp/vmware-tools-distrib$

8. Install VMware Tools by running the command:

ehowstuff@ubuntu14:/tmp/vmware-tools-distrib$ sudo ./vmware-install.pl -d
Creating a new VMware Tools installer database using the tar4 format.

Installing VMware Tools.

In which directory do you want to install the binary files?
[/usr/bin]

What is the directory that contains the init directories (rc0.d/ to rc6.d/)?
[/etc]

What is the directory that contains the init scripts?
[/etc/init.d]

In which directory do you want to install the daemon files?
[/usr/sbin]

In which directory do you want to install the library files?
[/usr/lib/vmware-tools]

The path "/usr/lib/vmware-tools" does not exist currently. This program is
going to create it, including needed parent directories. Is this what you want?
[yes]

In which directory do you want to install the documentation files?
[/usr/share/doc/vmware-tools]

The path "/usr/share/doc/vmware-tools" does not exist currently. This program
is going to create it, including needed parent directories. Is this what you
want? [yes]

The installation of VMware Tools 8.3.7 build-341836 for Linux completed
successfully. You can decide to remove this software from your system at any
time by invoking the following command: "/usr/bin/vmware-uninstall-tools.pl".

Before running VMware Tools for the first time, you need to configure it by
invoking the following command: "/usr/bin/vmware-config-tools.pl". Do you want
this program to invoke the command for you now? [yes]

Initializing...

WARNING: A module identified as vsock has been found at
/lib/modules/3.13.0-24-generic/kernel/net/vmw_vsock/vsock.ko and at
/lib/modules/3.13.0-24-generic/kernel/net/vmw_vsock/vmw_vsock_vmci_transport.ko.
Leaving both modules in there could potentially cause a race condition when a
device is added.  We reccomend you remove one of them, run 'depmod -a' and then
re-run this configurator.


Stopping VMware Tools services in the virtual machine:
   Guest operating system daemon:                                      done
   Virtual Printing daemon:                                            done
   Unmounting HGFS shares:                                             done
   Guest filesystem driver:                                            done


update-rc.d: warning:  start runlevel arguments (S) do not match vmware-tools Default-Start values (2 3 5)
 Adding system startup for /etc/init.d/vmware-tools ...
   /etc/rc0.d/S36vmware-tools -> ../init.d/vmware-tools
   /etc/rc6.d/S36vmware-tools -> ../init.d/vmware-tools
   /etc/rcS.d/S38vmware-tools -> ../init.d/vmware-tools
The module vmmemctl has already been installed on this system by another
installer or package and will not be modified by this installer.  Use the flag
--clobber-kernel-modules=vmmemctl to override.


WARNING: This program cannot compile any modules for the following reason(s)...

- This program could not find a valid path to the kernel headers of the running
kernel.  Please ensure that the header files for the running kernel are
installed on this sytem.

[ Press Enter key to continue ]


The filesystem driver (vmhgfs module) is used only for the shared folder
feature. The rest of the software provided by VMware Tools is designed to work
independently of this feature.

If you wish to have the shared folders feature, you can install the driver by
running vmware-config-tools.pl again after making sure that gcc, binutils, make
and the kernel sources for your running kernel are installed on your machine.
These packages are available on your distribution's installation CD.
[ Press Enter key to continue ]


The fast network device driver (vmxnet module) is used only for our fast
networking interface. The rest of the software provided by VMware Tools is
designed to work independently of this feature.
If you wish to have the fast network driver enabled, you can install the driver
by running vmware-config-tools.pl again after making sure that gcc, binutils,
make and the kernel sources for your running kernel are installed on your
machine. These packages are available on your distribution's installation CD.
[ Press Enter key to continue ]


The vmblock module enables dragging or copying files from within a host and
dropping or pasting them onto your guest (host to guest drag and drop and file
copy/paste).  The rest of the software provided by VMware Tools is designed to
work independently of this feature (including guest to host drag and drop and
file copy/paste).

If you would like the host to guest drag and drop and file copy/paste features,
you can install the driver by running vmware-config-tools.pl again after making
sure that gcc, binutils, make and the kernel sources for your running kernel
are installed on your machine. These packages are available on your
distribution's installation CD.
[ Press Enter key to continue ]

The module vmci has already been installed on this system by another installer
or package and will not be modified by this installer.  Use the flag
--clobber-kernel-modules=vmci to override.

The module vsock has already been installed on this system by another installer
or package and will not be modified by this installer.  Use the flag
--clobber-kernel-modules=vsock to override.

The module vmxnet3 has already been installed on this system by another
installer or package and will not be modified by this installer.  Use the flag
--clobber-kernel-modules=vmxnet3 to override.

The module pvscsi has already been installed on this system by another
installer or package and will not be modified by this installer.  Use the flag
--clobber-kernel-modules=pvscsi to override.

No X install found.

Creating a new initrd boot image for the kernel.
update-initramfs: Generating /boot/initrd.img-3.13.0-24-generic
Starting VMware Tools services in the virtual machine:
   Switching to guest configuration:                                   done
   Guest operating system daemon:                                      done
   Virtual Printing daemon:                                            done

The configuration of VMware Tools 8.3.7 build-341836 for Linux for this running
kernel completed successfully.

You must restart your X session before any mouse or graphics changes take
effect.

You can now run VMware Tools by invoking the following command:
"/usr/bin/vmware-toolbox" during an X server session.

To enable advanced X features (e.g., guest resolution fit, drag and drop, and
file and text copy/paste), you will need to do one (or more) of the following:
1. Manually start /usr/bin/vmware-user
2. Log out and log back into your desktop session; and,
3. Restart your X session.

Enjoy,

--the VMware team

Note: The -d switch assumes that you want to accept the defaults. If you don’t use -d switch, kindly choose the default for all questions.

9. Once installed, reboot the virtual machine :

ehowstuff@ubuntu14:~$ sudo reboot

Three Command to Check your Ubuntu Version

Checking what version of Ubuntu you are running is very easy. From my own experience, there are multiple ways to check the Ubuntu version. You can either check from graphical interface version, or from command line in the local terminal session or via SSH. The following result has been tested from the command line that was run from the command remotely over SSH.

1. Check ubuntu version using “cat /etc/issue” command :

ehowstuff@ubuntu14:~$ cat /etc/issue
Ubuntu 14.04 LTS \n \l

2. Check Ubuntu version using “cat /etc/lsb-release” command :

ehowstuff@ubuntu14:~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04 LTS"

3. Check Ubuntu version using “lsb_release -a” command :

ehowstuff@ubuntu14:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04 LTS
Release:        14.04
Codename:       trusty

or you can have more option to filter out the result :

ehowstuff@ubuntu14:~$ lsb_release -d
Description:    Ubuntu 14.04 LTS
ehowstuff@ubuntu14:~$ lsb_release -c
Codename:       trusty
ehowstuff@ubuntu14:~$ lsb_release -r
Release:        14.04

Additionaly, you can check all the info regarding kernel version :

ehowstuff@ubuntu14:~$ uname -a
Linux ubuntu14 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

or

ehowstuff@ubuntu14:~$ cat /proc/version
Linux version 3.13.0-24-generic (buildd@panlong) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) ) #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014

How to Enable Root Login on Ubuntu 14.04

By default, the Root account password is locked in Ubuntu and you will not able to login as Root directly or use the su command to become the Root user. The root user doesn’t have a password set. The steps to enable the root account is very simple. But it is not recommended because it may cause very serious trouble to your system because login as Root means you can do anything.

Issue this command to enable root login on Ubuntu 14.04. You will prompted for a new Unix password. Second password for confirmation :

sudo passwd root

Example :

login as: ehowstuff
ehowstuff@192.168.0.114's password:
Welcome to Ubuntu 14.04 LTS (GNU/Linux 3.13.0-24-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

  System information as of Sun Apr 27 23:49:57 MYT 2014

  System load:  0.15              Processes:           68
  Usage of /:   3.8% of 31.37GB   Users logged in:     0
  Memory usage: 3%                IP address for eth0: 192.168.0.114
  Swap usage:   0%

  Graph this data and manage this system at:
    https://landscape.canonical.com/

4 packages can be updated.
1 update is a security update.

Last login: Sun Apr 27 23:49:57 2014
ehowstuff@ubuntu14:~$ sudo passwd root
[sudo] password for ehowstuff:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
ehowstuff@ubuntu14:~$

Red Hat Enterprise Linux 7 Release Candidate now becomes publicly available

Red Hat announced Wednesday that Red Hat Enterprise Linux 7 Release Candidate (RC) is now publicly available for testing.

A pre-release build of Red Hat Enterprise Linux 7, Red Hat Enterprise Linux 7 RC offers a near-final look at Red Hat’s operating system crafted for the open hybrid cloud, building upon the feedback collected during the beta program for Red Hat Enterprise Linux 7.

Last week, Red Hat announced availability of Red Hat Enterprise Linux 7 RC, which retains key capabilities that have made Red Hat Enterprise Linux synonymous with security and stability in the open enterprise world, like SELinux, while providing flexibility and agility required in an operating system to tackle the challenges of modern infrastructure and next-generation computing.

Red Hat Enterprise Linux 7 RC runs applications in isolated and secure lightweight containers utilizing SELinux and resource management, enables users to configure, monitor and manage services and system-wide resources with systemd and OpenLMI management infrastructure. With the default XFS file system, you can scale to 500TB and experience additional file-system enhancements with ext4, parallel NFS, GFS2, NFS v4, and Btrfs.

It also identifies and optimizes difficult application performance problems with improved tools like Tuna, SystemTap, Performance Co-pilot, and Thermostat, and achieves faster and more responsive networking performance with support for 40Gb Ethernet links and TCP improvements like Fast Open and Early Retransmit. Red Hat Enterprise Linux 7 RC improves the desktop experience with the new GNOME 3 desktop, upgraded Network Manager, and WiGig wireless support.

Vital for helping Red Hat’s strategic partners facilitate full certification of their applications and systems with Red Hat Enterprise Linux 7, Red Hat Enterprise Linux 7 RC is now accessible to all interested parties, from end users to enterprises, seeking to gain insight into how Red Hat redefines the enterprise operating system.

Red Hat Enterprise Linux 7 RC includes expanded Windows interoperability capabilities, including integration with Microsoft Active Directory domains, significant file system enhancements, including XFS as the default, scaling to support file systems up to 500 TB, improved subsystem management through OpenLMI, and virtual machine (VM) migration from Red Hat Enterprise Linux 6 hosts to Red Hat Enterprise Linux 7 hosts without downtime or VM modification.

Click here for full story

Facebook, Google, Intel, Microsoft, NetApp, Qualcomm, VMware And The Linux Foundation Form New Initiative To Prevent The Next Heartbleed

The OpenSSL Heartbleed disaster definitely opened up many people’s eyes to how underfunded and understaffed many of the open source projects the web relies on are. To prevent the next Heartbleed, Facebook, Google, Intel, Microsoft, NetApp, Qualcomm, VMware and The Linux Foundation today announced the “Core Infrastructure Initiative.” This initiative will fund and support important open source projects “that are in need of assistance.”

While it’s not clear how much money each of the participants is contributing, the Linux Foundation — which organized this program — says this is a “multi-million dollar project” and should be seen as the industry’s collective response to the Heartbleed crisis. The Linux Foundation will administer the initiative’s funds.

Unsurprisingly, the OpenSSL project will be the first to receive fellowship funding from the initiative. The idea behind the fellowships is to allow key developers to work on these projects full-time. Besides the funding, the projects that will receive support from the initiative will also get other forms of assistance to improve their security, including outside reviews, security audits, computing and test infrastructure, travel and other support.

Considering the importance of a project like OpenSSL, it is indeed somewhat shameful that it only received about $2,000 per year in donations. Money alone, of course, may not have been enough to help catch the Heartbleed bug, so it’s good to see that the participating companies are also dedicating test resources to this project.

“Just as The Linux Foundation has funded Linus Torvalds to be able to focus 100% on Linux development, we will now be able to support additional developers and maintainers to work full-time supporting other essential open source projects,” said Jim Zemline, the executive director of the Linux Foundation in a statement today.

The idea behind open source, of course, is to get as many people as possible to produce high-quality code that is also secure. Many of the projects we rely on day in and day out, however, have grown so complex that having only a few part-time developers working on them isn’t enough to ensure their quality and security. The Linux Foundation acknowledges as much today.

“The most recent Coverity Open Scan study of software quality has shown that open source code quality surpasses proprietary code quality. But as all software has grown in complexity – with interoperability between highly complex systems now the standard – the needs for developer support has grown.”

Looking ahead, the Core Infrastructure Initiative plans to move away from what is clearly a reactive post-crisis mode to a more proactive mode. Going forward, the initiative will focus more strongly on proactive reviews that identify the need of the most important projects — hopefully before the next Heartbleed crisis hits.

Click here for full story

How to Fix 403 forbidden error at Nginx

Nginx is a alternate web server for Apache and capable to handle large traffic of the websites on your virtual private server (VPS) or on your dedicated server. Nginx work well with PHP-FPM on CentOS 5.x and also CentOS 6.x. But most of the Nginx newbie struggling to get it run perfectly and hit by “403 forbidden error”. This “403 forbidden error” means that the webpage that you trying to access is forbidden or you don’t have permission to access certain part of the website. This article is meant for the linux server administrator who is supposed to have some basic knowledge on administering the linux server and also may useful for those who start to have VPS or dedicated server.

Sample error :

2014/04/18 23:18:34 [error] 11933#0: *5 directory index of "/usr/share/nginx/html/" is forbidden, client: 192.168.0.1, server: www.ehowstuff.local, request: "GET / HTTP/1.1", host: "www.ehowstuff.local"

Possible reasons and common errors :

a) Directory index is not properly defined
b) Permissions are not set correctly
c) php-fpm Permissions not configured correctly

One of the most popular reason for “403 forbidden error” using Nginx is that the folder directory permissions are not set and also directory index are not the server block.

Solution :
1. Verify the document root was set 755 permissions to your directory accordingly
2. Add index index.php; In the server block.
3. makesure “fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;” as been added :

location ~ \.php$ {
    try_files $uri =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

How to Setup WordPress on Nginx, PHP-FPM and MySQL

WordPress website can be served using Apache or NGINX. Apache is the most popular Web server and most widely used for WordPress blogging platform. Apache is a great option and has served many of the world’s largest Web sites. Alternate web server for Apache is Nginx, pronounced “Engine X”. Nginx is an open source web server and a reverse proxy server for HTTP, SMTP, POP3 and IMAP protocols. Many websites and the web developer have moved to NGINX because it’s scalable, low resources, can handle many users concurrency and good website performance. For largest and busiest website, i would suggest you to host you websites and blog on Virtual Private Server (VPS) or dedicated server and run NGINX as a web server. Assumed that MySQL has been prepared and configured for WordPress and was tested on CentOS 6.5.

1. Prepared Nginx Repository :

[root@vps ~]# vi /etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1

2. Install NGINX, PHP, php-fpm amd MySQL server :

[root@vps ~]# yum install nginx php php-cli php-mysql php-gd php-xml php-fpm mysql mysql-server -y

3. Open /etc/php.ini and set cgi.fix_pathinfo=0:

[root@vps ~]# vi /etc/php.ini
..
..
; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI.  PHP's
; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok
; what PATH_INFO is.  For more information on PATH_INFO, see the cgi specs.  Setting
; this to 1 will cause PHP CGI to fix its paths to conform to the spec.  A setting
; of zero causes PHP to behave as before.  Default is 1.  You should fix your scripts
; to use SCRIPT_FILENAME rather than PATH_TRANSLATED.
; http://www.php.net/manual/en/ini.core.php#ini.cgi.fix-pathinfo
cgi.fix_pathinfo=0
..
..

4. Set date.timezone in /etc/php.ini :

[Date]
; Defines the default timezone used by the date functions
; http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone
date.timezone = "Asia/Kuala_Lumpur"

5. This server configuration was setup for PHP-FPM use a UNIX Socket.

[root@vps ~]# vim /etc/php-fpm.d/www.conf

Specify .sock path :

..
listen = /var/run/php-fpm.sock
..

Change user to run php-fpm :

..
user = nginx
..
..
group = nginx
..

6. Backup NGINX config file :

[root@vps ~]# cp -p /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak

7. Create sites-available folder under /etc/nginx :

[root@vps ~]# mkdir /etc/nginx/sites-available

8. Adjust NGINX Worker Processes & Connections. NGINX workers equal the number of processors :

Check Number CPU on your VPS server :

[root@vps ~]# lscpu | grep '^CPU(s)'
CPU(s):                1

or

[root@vps ~]# cat /proc/cpuinfo | grep processor
processor       : 0
..
worker_processes  1;
..
..
worker_connections  1024;
..

Configure nginx.conf as below :

user  nginx;
worker_processes  1;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    gzip  on;
    gzip_types text/css text/x-component application/x-javascript application/javascript  text/javascript text/x-js text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;

    
    include /etc/nginx/sites-available/*.conf;
}

9. Create common.conf and wordpress.conf under /etc/nginx/conf.d/ folder :

[root@vps ~]# vim /etc/nginx/conf.d/common.conf
[root@vps ~]# vim /etc/nginx/conf.d/wordpress.conf
[root@vps ~]# vim /etc/nginx/conf.d/common.conf

Add the following :

# Global configuration file.
# ESSENTIAL : Configure Nginx Listening Port
listen 80;
# ESSENTIAL : Default file to serve. If the first file isn't found,
index index.php index.html index.htm;
# ESSENTIAL : no favicon logs
location = /favicon.ico {
    log_not_found off;
    access_log off;
}
# ESSENTIAL : robots.txt
location = /robots.txt {
    allow all;
    log_not_found off;
    access_log off;
}
# ESSENTIAL : Configure 404 Pages
error_page 404 /404.html;
# ESSENTIAL : Configure 50x Pages
error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root /usr/share/nginx/html;
    }
# SECURITY : Deny all attempts to access hidden files .abcde
location ~ /\. {
    deny all;
}
# PERFORMANCE : Set expires headers for static files and turn off logging.
location ~* ^.+\.(js|css|swf|xml|txt|ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
    access_log off; log_not_found off; expires 30d;

Explanation :

listen 80; 

-Specifies the listening port of the server.

index index.php index.html index.htm;

-Specifies the default file to serve (WordPress index.php). For HTML sites, please include index.html & index.htm;.

location = /robots.txt {allow all;} 

-Allows the access to robots.txt

Create wordpress.conf :

[root@vps ~]# vim /etc/nginx/conf.d/wordpress.conf

Add the following :

# WORDPRESS : Rewrite rules, sends everything through index.php and keeps the appended query string intact
location / {
    try_files $uri $uri/ /index.php?q=$uri&$args;
}

# SECURITY : Deny all attempts to access PHP Files in the uploads directory
location ~* /(?:uploads|files)/.*\.php$ {
    deny all;
}
# REQUIREMENTS : Enable PHP Support
location ~ \.php$ {
    # SECURITY : Zero day Exploit Protection
    try_files $uri =404;
    # ENABLE : Enable PHP, listen fpm sock
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
# PLUGINS : Enable Rewrite Rules for Yoast SEO SiteMap
rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last;
rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;

Explanation :

try_files $uri $uri/ /index.php?q=$uri&$args 

-rewrite rule required to allow you to choose your custom permalink structure on WordPress.

location ~* /(?:uploads|files)/.*\.php$ {deny all;} 

-this will prevent malicious code from being uploaded and executed from the WordPress media directory.

location ~ \.php$ {...}

-since WordPress is a php site, we need to tell NGINX how to a pass our php scripts to PHP5.

try_files $uri =404; 

-this is a security rule, you only want to either serve a determined php file or go to a 404 error.

10. Create a virtual server under /etc/nginx/sites-available/ directory :

[root@vps ~]# vi /etc/nginx/sites-available/ehowstuff.local.conf

Assumed that you want to configure a WordPress site with www.ehowstuff.local domain, please setup as below :

server {
    server_name ehowstuff.local;
    rewrite ^/(.*)$ http://www.ehowstuff.local/$1 permanent;
}

server {
        server_name www.ehowstuff.local;
        root /var/www/html/wordpress;
        access_log /var/log/nginx/www.ehowstuff.local.access.log;
        error_log /var/log/nginx/www.ehowstuff.local.error.log;
        include conf.d/common.conf;
        include conf.d/wordpress.conf;
}

Please change the following for virtual server ehowstuff.local.conf :

server_name: Define the server block for the URL.
root: Where you keep your website file
access log & error log: Paths for your logs

11. Start php-fpm and nginx :

[root@vps ~]# /etc/init.d/php-fpm start
Starting php-fpm:                                          [  OK  ]
[root@vps ~]# /etc/init.d/nginx start
Starting nginx:                                            [  OK  ]

12. Make php-fpm and nginx start at boot :

[root@vps ~]# chkconfig php-fpm on
[root@vps ~]# chkconfig nginx on

13. Verify that the required port already present.

[root@vps ~]# netstat -plunt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      1042/rpcbind
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      3174/nginx
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      1096/sshd
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      3394/mysqld
tcp        0      0 :::111                      :::*                        LISTEN      1042/rpcbind
tcp        0      0 :::22                       :::*                        LISTEN      1096/sshd
udp        0      0 0.0.0.0:111                 0.0.0.0:*                               1042/rpcbind
udp        0      0 0.0.0.0:793                 0.0.0.0:*                               1042/rpcbind
udp        0      0 :::111                      :::*                                    1042/rpcbind
udp        0      0 :::793                      :::*                                    1042/rpcbind

Download Ubuntu 14.04 LTS for Server and Desktop

Ubuntu is completely free to download, use and share. Ubuntu 14.04 LTS has been released on 17 April, 2014. Ubuntu is distributed on two types of images, desktop image and server image. The desktop image allows you to try Ubuntu on graphical user interface which most end users want to use. But in server image, graphical user interface will not install.

Release Notes :
https://wiki.ubuntu.com/TrustyTahr/ReleaseNotes

Full Download Link :
http://releases.ubuntu.com/14.04/

There are four images available which two for server and two for desktop.

1. Server install image for 64-bit PC (AMD64)
http://releases.ubuntu.com/14.04/ubuntu-14.04-server-amd64.iso

2. Server install image for PC (Intel x86)
http://releases.ubuntu.com/14.04/ubuntu-14.04-server-i386.iso

3. Desktop image for 64-bit PC (AMD64)
http://releases.ubuntu.com/14.04/ubuntu-14.04-desktop-amd64.iso

4. Desktop image for PC (Intel x86)
http://releases.ubuntu.com/14.04/ubuntu-14.04-desktop-i386.iso

How to Install Varnish Cache With Apache On CentOS 6.5

Varnish is an open source web accelerator (also called a HTTP reverse proxy) designed for content-heavy dynamic web sites to speed up web server’s performance. Typical Web server will handles all the request and returning a response to the client. But with Varnish cache, it will serve the saved copy page instead of re-requesting the same revisited page from web server. This will reduced the server load and increased the response times. For those who plan to run a virtual private server (VPS) and also run a dedicated web server, hope that this article will help. This article will describe how to install and configure Varnish Cache with Apache on CentOS 6.5.

1. Setup varnish repo :

[root@centos6 ~]# wget http://repo.varnish-cache.org/redhat/varnish-3.0/el6/noarch/varnish-release/varnish-release-3.0-1.el6.noarch.rpm
[root@centos6 ~]# rpm --nosignature -i varnish-release-3.0-1.el6.noarch.rpm

2. Install Varnish and Apache :

[root@centos6 ~]# yum install varnish -y
[root@centos6 ~]# yum install httpd -y

3. Make both program start at boot :

[root@centos6 ~]# chkconfig --level 345 varnish on
[root@centos6 ~]# chkconfig --level 345 httpd on

4. Configure apache to listen to port 8080 :

[root@centos6 ~]# vi /etc/httpd/conf/httpd.conf

Modify below :

Listen 8080

5. Configuring Varnish Cache :

[root@centos6 ~]# vim /etc/sysconfig/varnish
..
..
# # Main configuration file. You probably want to change it :)
VARNISH_VCL_CONF=/etc/varnish/default.vcl
#
# # Default address and port to bind to
# # Blank address means all IPv4 and IPv6 interfaces, otherwise specify
# # a host name, an IPv4 dotted quad, or an IPv6 address in brackets.
# VARNISH_LISTEN_ADDRESS=
#VARNISH_LISTEN_PORT=6081
VARNISH_LISTEN_PORT=80
#
# # Telnet admin interface listen address and port
VARNISH_ADMIN_LISTEN_ADDRESS=127.0.0.1
VARNISH_ADMIN_LISTEN_PORT=6082
#
# # Shared secret file for admin interface
VARNISH_SECRET_FILE=/etc/varnish/secret
#
# # The minimum number of worker threads to start
VARNISH_MIN_THREADS=50
#
# # The Maximum number of worker threads to start
VARNISH_MAX_THREADS=1000
#
# # Idle timeout for worker threads
VARNISH_THREAD_TIMEOUT=120
#
# # Cache file location
VARNISH_STORAGE_FILE=/var/lib/varnish/varnish_storage.bin
#
# # Cache file size: in bytes, optionally using k / M / G / T suffix,
# # or in percentage of available disk space using the % suffix.
VARNISH_STORAGE_SIZE=1G
#
# # Backend storage specification
VARNISH_STORAGE="file,${VARNISH_STORAGE_FILE},${VARNISH_STORAGE_SIZE}"
#
# # Default TTL used when the backend does not specify one
VARNISH_TTL=120
#
# # DAEMON_OPTS is used by the init script.  If you add or remove options, make
# # sure you update this section, too.
DAEMON_OPTS="-a ${VARNISH_LISTEN_ADDRESS}:${VARNISH_LISTEN_PORT} \
             -f ${VARNISH_VCL_CONF} \
             -T ${VARNISH_ADMIN_LISTEN_ADDRESS}:${VARNISH_ADMIN_LISTEN_PORT} \
             -t ${VARNISH_TTL} \
             -w ${VARNISH_MIN_THREADS},${VARNISH_MAX_THREADS},${VARNISH_THREAD_TIMEOUT} \
             -u varnish -g varnish \
             -S ${VARNISH_SECRET_FILE} \
             -s ${VARNISH_STORAGE}"
#
..
..

Add the following in /etc/varnish/default.vcl :

[root@centos6 ~]# vim /etc/varnish/default.vcl
backend default {
  .host = "127.0.0.1";
  .port = "8080";
}

6. Start Varnish and Apache ”

[root@centos6 ~]# service varnish start
Starting Varnish Cache:                                    [  OK  ]
[root@centos6 ~]# service httpd start
Starting httpd:                                            [  OK  ]

7. verify varnish and Apache running on the correct port :

[root@centos6 ~]# netstat -plunt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      1042/rpcbind
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      21729/varnishd
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      1075/sshd
tcp        0      0 127.0.0.1:6082              0.0.0.0:*                   LISTEN      21728/varnishd
tcp        0      0 :::111                      :::*                        LISTEN      1042/rpcbind
tcp        0      0 :::80                       :::*                        LISTEN      21729/varnishd
tcp        0      0 :::8080                     :::*                        LISTEN      1182/httpd
tcp        0      0 :::22                       :::*                        LISTEN      1075/sshd
udp        0      0 0.0.0.0:111                 0.0.0.0:*                               1042/rpcbind
udp        0      0 0.0.0.0:793                 0.0.0.0:*                               1042/rpcbind
udp        0      0 :::111                      :::*                                    1042/rpcbind
udp        0      0 :::793                      :::*                                    1042/rpcbind

8. Verify the Varnish by running the following command.

[root@centos6 ~]# curl -I http://www.ehowstuff.local
HTTP/1.1 200 OK
Server: Apache/2.2.15 (CentOS)
X-Powered-By: PHP/5.3.3
X-Pingback: http://www.ehowstuff.local/xmlrpc.php
Content-Type: text/html; charset=UTF-8
Content-Length: 7990
Accept-Ranges: bytes
Date: Sun, 13 Apr 2014 15:41:41 GMT
X-Varnish: 1889373153
Age: 0
Via: 1.1 varnish
Connection: keep-alive

9. ApacheBench performance test without Varnish Cache

[root@centos6 ~]# ab -k -n 1000 -c 50 http://www.ehowstuff.local:8080/
This is ApacheBench, Version 2.3 < $Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking www.ehowstuff.local (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests


Server Software:        Apache/2.2.15
Server Hostname:        www.ehowstuff.local
Server Port:            8080

Document Path:          /
Document Length:        0 bytes

Concurrency Level:      50
Time taken for tests:   217.545 seconds
Complete requests:      1000
Failed requests:        81
   (Connect: 0, Receive: 0, Length: 81, Exceptions: 0)
Write errors:           0
Non-2xx responses:      1000
Keep-Alive requests:    0
Total transferred:      318518 bytes
HTML transferred:       20331 bytes
Requests per second:    4.60 [#/sec] (mean)
Time per request:       10877.237 [ms] (mean)
Time per request:       217.545 [ms] (mean, across all concurrent requests)
Transfer rate:          1.43 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    3  12.1      0      65
Processing:   219 10822 17202.8   3275   61139
Waiting:      218 10802 17210.6   3228   61138
Total:        239 10825 17201.5   3275   61139

Percentage of the requests served within a certain time (ms)
  50%   3275
  66%   4513
  75%   5570
  80%  12099
  90%  40539
  95%  60069
  98%  60103
  99%  60200
 100%  61139 (longest request)

10. ApacheBench performance test with Varnish Cache

[root@centos6 ~]# ab -k -n 1000 -c 50 http://www.ehowstuff.local/
This is ApacheBench, Version 2.3 < $Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking www.ehowstuff.local (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests


Server Software:        Apache/2.2.15
Server Hostname:        www.ehowstuff.local
Server Port:            80

Document Path:          /
Document Length:        7990 bytes

Concurrency Level:      50
Time taken for tests:   0.227 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Keep-Alive requests:    1000
Total transferred:      8565396 bytes
HTML transferred:       8221710 bytes
Requests per second:    4410.08 [#/sec] (mean)
Time per request:       11.338 [ms] (mean)
Time per request:       0.227 [ms] (mean, across all concurrent requests)
Transfer rate:          36888.79 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    1   3.2      0      19
Processing:     7   10   1.7     10      18
Waiting:        1    4   2.3      4      15
Total:          7   11   4.1     10      31

Percentage of the requests served within a certain time (ms)
  50%     10
  66%     10
  75%     11
  80%     11
  90%     12
  95%     13
  98%     27
  99%     31
 100%     31 (longest request)

11. Result on Steps (9) and (10) shows that Apache with Varnish serve faster response than running Apache standalone.

 

How to Display processlist in MySQL

MySQL databases are great database in internet. It’s commonly used in WordPress and Drupal blog. When you are monitoring the performance of a WordPress or Drupal blog, do not forget to monitor the MySQL queries using existing tools including mytop, mtop and also running a SHOW PROCESSLIST from the mysql client command line. It will show all the queries are running and how long they take. The command SHOW PROCESSLIST actually shows you which threads are running in realtime. You can also can get this information from the mysqladmin processlist command and from the INFORMATION_SCHEMA PROCESSLIST table. If you have the PROCESS privilege, you can see all threads. Otherwise, you can see only your own threads. However, if you really need to investigate or monitor overall website performance issue, please also look at other aspects of the system such memory and swapping as well as CPU utilization.

Here is an example of SHOW PROCESSLIST output:

show processlist;
mysql> show processlist;
+----+---------------+-------------------+-------------+---------+------+-------+------------------+
| Id | User          | Host              | db          | Command | Time | State | Info             |
+----+---------------+-------------------+-------------+---------+------+-------+------------------+
| 23 | root          | localhost         | NULL        | Query   |    0 | NULL  | show processlist |
| 46 | wordpressuser | 192.168.0.5:38876 | wordpressdb | Sleep   |   69 |       | NULL             |
| 51 | root          | localhost         | wordpressdb | Sleep   |   34 |       | NULL             |
+----+---------------+-------------------+-------------+---------+------+-------+------------------+
3 rows in set (0.00 sec)

Alternately you can run as below :

mysql> SHOW PROCESSLIST\G
*************************** 1. row ***************************
     Id: 23
   User: root
   Host: localhost
     db: NULL
Command: Query
   Time: 0
  State: NULL
   Info: SHOW PROCESSLIST
*************************** 2. row ***************************
     Id: 46
   User: wordpressuser
   Host: 192.168.0.5:38876
     db: wordpressdb
Command: Sleep
   Time: 73
  State:
   Info: NULL
*************************** 3. row ***************************
     Id: 51
   User: root
   Host: localhost
     db: wordpressdb
Command: Sleep
   Time: 38
  State:
   Info: NULL
3 rows in set (0.00 sec)

You have an option to run processlist in mysqladmin command. Below example show processlist every two second :

mysqladmin -u root -p -i 2 processlist

Example :

[root@mysql-server ~]# mysqladmin -u root -p -i 2 processlist
Enter password:
+----+------+-----------+----+---------+------+-------+------------------+
| Id | User | Host      | db | Command | Time | State | Info             |
+----+------+-----------+----+---------+------+-------+------------------+
| 6  | root | localhost |    | Query   | 0    |       | show processlist |
+----+------+-----------+----+---------+------+-------+------------------+

+----+------+-----------+----+---------+------+-------+------------------+
| Id | User | Host      | db | Command | Time | State | Info             |
+----+------+-----------+----+---------+------+-------+------------------+
| 6  | root | localhost |    | Query   | 0    |       | show processlist |
+----+------+-----------+----+---------+------+-------+------------------+

+----+------+-----------+----+---------+------+-------+------------------+
| Id | User | Host      | db | Command | Time | State | Info             |
+----+------+-----------+----+---------+------+-------+------------------+
| 6  | root | localhost |    | Query   | 0    |       | show processlist |
+----+------+-----------+----+---------+------+-------+------------------+

+----+------+-----------+----+---------+------+-------+------------------+
| Id | User | Host      | db | Command | Time | State | Info             |
+----+------+-----------+----+---------+------+-------+------------------+
| 6  | root | localhost |    | Query   | 0    |       | show processlist |
+----+------+-----------+----+---------+------+-------+------------------+

How to Secure your MySQL On VPS or Dedicated Server

Running a WordPress on a Virtual private Server or dedicated server is not an easy as running a WordPress on shared hosting server. There are a few things need to install and configure. Basically you will need web server(Apache, Nginx or Lighttpd) and database server(MySQL). The most popular database for WordPress platform is MySQL. Installation of the MySQL is very easy, but most of the webmaster will facing difficulties on the configuration part. Therefore i have prepared the article that will cover configuring and securing your MySQL on Virtual private Server(VPS) or on dedicated server. MySQL database is actually the brain of your website or blog. It will store all the configuration information, the posts, comments, login information, user information and etc. This article assumed that you already installed the MySQL server on your VPS or dedicated server and then you may proceed to configure and harden it as below :

1. Run pre-install mysql script, mysql_secure_installation. This will do the following :

a) Set the root password ensures that nobody can log into the MySQL root user without the proper authorization.
b) Remove anonymous users
c) Remove test database and access to it
d) Normally, root should only be allowed to connect from ‘localhost’. Disallow root login remotely if you want. However i prefer to disallow it later

[root@mysql-server ~]# /usr/bin/mysql_secure_installation




NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!


In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] n
 ... skipping.

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...



All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

2. List of MySQL users, make sure all users have password :

mysql> SELECT User,Host,Password FROM mysql.user;
+---------------+-------------+-------------------------------------------+
| User          | Host        | Password                                  |
+---------------+-------------+-------------------------------------------+
| root          | localhost   | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
| root          | mysql       | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
| root          | 127.0.0.1   | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
| wordpressuser | 192.168.0.5 | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
+---------------+-------------+-------------------------------------------+
4 rows in set (0.00 sec)

3. Set a strong password for the MySQL root account and also existing user account :

Existing user account :

mysql> select Host,User,Password from user;
+-------------+---------------+-------------------------------------------+
| Host        | User          | Password                                  |
+-------------+---------------+-------------------------------------------+
| localhost   | root          | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
| mysql       | root          | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
| 127.0.0.1   | root          | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
| 192.168.0.5 | wordpressuser | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
+-------------+---------------+-------------------------------------------+
4 rows in set (0.00 sec)

Set new strong password :

mysql> set password for 'root'@'localhost'=password('newstrongpassword');
mysql> set password for 'root'@'127.0.0.1'=password('newstrongpassword');
mysql> set password for 'wordpressuser'@'192.168.0.5'=password('newstrongpassword');

4. Make sure logging such as general_log, slow_query_log and log-error has been enabled in mysql :

[root@mysql-server ~]# vim /etc/my.cnf
[mysqld]
..
..
..
general_log_file=/var/log/mysql/mysqld.log
general_log=1
slow_query_log_file=/var/log/mysql/mysqld.slow.log
slow_query_log=1

[mysqld_safe]
log-error=/var/log/mysql/mysqld.error.log
...
..

Create folder for mysql log and change the folder owner to mysql:

[root@mysql-server ~]# chown -R mysql:mysql /var/log/mysql

Verify the logs :

[root@mysql-server ~]# ll /var/log/mysql
total 12
-rw-r----- 1 mysql mysql 3547 Apr  7 16:57 mysqld.error.log
-rw-rw---- 1 mysql mysql  373 Apr  7 16:58 mysqld.log
-rw-rw---- 1 mysql mysql  174 Apr  7 16:57 mysqld.slow.log

This Will help administrators to monitor critical events and helps in troubleshooting.

Reference : http://dev.mysql.com/doc/refman/5.7/en/server-logs.html

Once you have done above configuration, make sure yo restart the mysqld service :

[root@mysql-server ~]# service mysqld restart
Stopping mysqld:                                           [  OK  ]
Starting mysqld:                                           [  OK  ]

Note : This configuration and hardening practice is very basic, you can fine tune your database based on your expected security level and also you can implement host iptables, physical firewall protection and operating system hardening in order to protect the MySQL server. You may refer to “Securing and Hardening Linux Dedicated Server

How to Install WordPress on Remote MySQL

WordPress is an open source content management system (CMS) and popular blogging platform in the world based on PHP and MySQL platform. WordPress can be install on multiple way, either using dedicated server, virtual private server(VPS) or the cheapest way is running on shared hosting. When come to decision to run the wordpress on dedicated server or on VPS, the next question would be whether to run a web service and database service on single or multiple server. We have an option to combine it or to split it. For high performance wordpress website, i would suggest you to run web server(Apache, NGINX, Lighttpd) and database server (MySQL) on different server. Below steps should provide the basic steps how you can setup the wordpress on remote MySQL.

server1 = 192.168.0.5 = Apache server
server2 = 192.168.0.6 = Remote MySQL server

1. Login as a root on server1 then download latest wordpress file and extract the file :

[root@server1 html]# cd /var/www/html
[root@server1 html]# wget http://wordpress.org/latest.tar.gz
[root@server1 html]# tar xzvf latest.tar.gz

2. Login to server2, create the database for the wordpress :

[root@server2 ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.1.73 Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database wordpressdb;
Query OK, 1 row affected (0.00 sec)

mysql> create user 'wordpressuser'@'192.168.0.5' identified by 'password';
Query OK, 0 rows affected (0.00 sec)

mysql> grant all on wordpressdb.* to 'wordpressuser'@'192.168.0.5';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> show grants for 'wordpressuser'@'192.168.0.5';
+------------------------------------------------------------------------------------------------------------------------+
| Grants for wordpressuser@192.168.0.5                                                                                   |
+------------------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'wordpressuser'@'192.168.0.5' IDENTIFIED BY PASSWORD '*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19' |
| GRANT ALL PRIVILEGES ON `wordpressdb`.* TO 'wordpressuser'@'192.168.0.5'                                               |
+------------------------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)

3. Once step 2 above has been done, login again to server1, test the connectivity to database server :

[root@server1 html]# mysql -u wordpressuser -p -h 192.168.0.6
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.1.73 Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| test               |
| worpressdb         |
+--------------------+
3 rows in set (0.00 sec)

4. Still on server1, copy the config.php file :

[root@server1 ~]# cp /var/www/html/wordpress/wp-config-sample.php /var/www/html/wordpress/wp-config.php

5. Modify the config.php file and enter the database informations and remote mysql server details :

[root@server1 ~]# vi /var/www/html/wordpress/wp-config.php
define('DB_NAME', 'wordpressdb');

/** MySQL database username */
define('DB_USER', 'wordpressuser');

/** MySQL database password */
define('DB_PASSWORD', 'password');

/** MySQL hostname */
define('DB_HOST', '192.168.0.6');

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');

6. To install, navigate the browser to http://servername/wordpress/.

http://192.168.0.5/wordpress/