How To Set Up A WordPress VPS (Centos) With WebMin

Install & Configure Webmin On A Centos VPS:

Apart from Kloxo, Webmin is another superb Control Panel that lets you do virtually everything relating to the VPS.

Open up Putty, log into your account and enter the following command:

To Download the latest version of Webmin:

wget http://www.webmin.com/download/rpm/webmin-current.rpm

Note what the name of the folder is which is being downloaded. Currently, it is called “webmin-1.580-1.noarch”. So, to unpack & install Webmin run the following command:

rpm -U webmin-1.580-1.noarch.rpm

The installation takes just a couple of minutes and you will receive a confirmation message in the SSH client. Thereafter, login into http://your_IP_address:10000 as root with your root password.

Check Whether Php & MySQL are enabled in Webmin:

Occasionally, it is seen that PHP is not enabled in Webmin even though it is one of the modules that is supposed to be packaged. If PHP is not installed, then when you call for a PHP file from the browser, the file will download instead of rendering in the browser.

To check whether PHP is installed, run the following command in Putty:

rpm -qa |grep php

If no packages are listed, it means PHP is not installed.

To install PHP type

yum install php

Restart Apache with the following command:

/etc/init.d/httpd restart

Now Go to the File Manager of Webmin and create a file called phpinfo.php with the following code in it.


// Show all information, defaults to INFO_ALL
phpinfo();

// Show just the module information.
// phpinfo(8) yields identical results.
phpinfo(INFO_MODULES);

?>

Access the phpinfo.php file from the browser. If all is well, you should see a page with the PHP information on it.

Now Check Whether MySQL is installed with the following command:

rpm -q mysql

The reply will be self-explanatory.

Install MySQL by typing:

yum install mysql

Again restart the apache webserver by typing

/etc/init.d/httpd restart

You can create database through the Webmin interface.

Installing PHPMyadmin on Centos 6

Alternatively, you can install PHPMyadmin which is a great tool for managing databases:

Go to the PHPMyadmin site to see which is the latest version. Currently, it is 3.4.10.1-all-languages.tar.gz.

So, lets download the file:

wget http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/3.4.10.1/phpMyAdmin-3.4.10.1-all-languages.tar.gz

Now unpack it:

tar xvfz phpMyAdmin-3.4.10.1-all-languages.tar.gz

It will unpack to a folder called phpmyadmin in the root folder which is not accessible from the browser. So, we will copy its contents to another folder called “phpmyadmin” under /var/www/html/ with the following command:

cd /var/www/html

mkdir phpmyadmin

Now we copy from the contents of the root folder to this folder:

cp -R * /var/www/html/phpmyadmin

Restart apache webserver

/etc/init.d/httpd restart

Now, when you access your_domain/phpmyadmin, you will be greeted by the login page. Just login with your name as root and your root password. If there is a password problem, go to the webmin’s MySQL and reenter your password.

PHP extension problem:

Occasionally, even though PHP & MySQL are installed, you may get the dreaded “Your PHP installation appears to be missing the MySQL extension which is required by WordPress

This is a very peculiar problem. To solve it, open the phpinfo.php file to see the location of the php.ini file. Usually it is in the /etc folder and is shown as /etc/php.ini. Go to the file manager in webmin and open this file. Search for the word “extension” and see if the words “extension=mysql.so” is uncommented by use of the semi-colon “;” mark. If so, just delete the semi-colon. You can add a few more relevant extensions for good measure:

extension=php_mysqli.dll
extension=php_mysqli_mysqlnd.dll
extension=php_mysqli_libmysql.dll

Now save the file and restart apache with the command:

/etc/init.d/httpd restart

If it still doesn’t work, it may mean that the extensions are not loaded at all. So, download the extensions with the command:

yum install -y mysql mysql-server

yum install -y php php-mysql

yum -y install php-mbstring php-mcrypt php-gd

Restart Apache with the command

/etc/init.d/httpd restart

Hopefully, now you will be greeted with the WordPress Configuration page.

Setting up your name servers (DNS) with webmin:

First Check whether the BIND DNS SERVER is installed or not. By default, it is not installed. On the Menu at the left side, click on ‘BIND DNS Server’ under ‘Servers’.

You will be asked for permission to create the primary configuration file for BIND /etc/named.conf and give you options. Choose the default “Setup as an internet name server, and download root server information”.

Then, under “Existing DNS Zones”, click “Create master zone”. Enter your domain name and the IP address. Click the Create button and you will be taken to the “Edit Master Zone” page.

Now click the “Address” Records. The object is that when one enters the name of the domain with or without “www”, it should point to the VPS. There are four address records to be created:

(i) Leave the Name field blank and enter the IP address. Click “Create” and it will show the name of your website as the default with the IP address.

(ii) In the Name field, enter the words “www”. In the Address field, enter the IP address.

(iii) In the Name field, enter the words “ns1”. In the Address field, enter the IP address.

(iv) In the Name field, enter the words “ns2”. In the Address field, enter the IP address.

Then select the “Name Server Records”. For the Zone name, enter the name of the domain with a dot (.) after it. (This is required to avoid errors). In the Name server field, enter ns1._the_domain_name. with a dot (.) after it.

Repeat the exercise and enter ns1._the_domain_name. with a dot (.) after it.

Now click the ‘Apply Configuration’ link in the top right hand corner. Also Stop BIND & Restart it.

It may also be a good idea to reboot the VPS to ensure that all the settings settle down.

That’s it. As soon as the domain name resolves, you should be able to see the default apache-centos page.

To upload your own page, click on “File Manager” in the menu under “Others” and navigate to the root folder which is “/var/www/html”. Click on create a New File and save it as “index.html”.

If you want to have multiple domains, create name server records for each domain as shown above and then create a folder with the domain name in “/var/www/html” and upload the relevant files to it.

Add WordPress With SSH & Webmin:

Adding WordPress with SSH involves 5 simple steps:

(i) Download WordPress tar file onto your webserver:

wget http://wordpress.org/latest.tar.gz

(ii) Unzip the WordPress tar file. It will itself unload the files onto a directory called “wordpress”:

tar xzf latest.tar.gz

(iii) Go to the wordpress directory:

cd wordpress

(iv) Copy all the files from the wordpress directory to the folder created by Webmin

cp -R * /var/www/html/tax2.me

If you click the relevant folder, all the relevant wordpress files will be seen.

(v) Create a database with Webmin’s MYSQL or with PHPMyadmin

(vi) Begin WordPress Installation:

Now when you open your website url you will be greeted by a wordpress page prompting for information on your mysql database, password etc. Just fill in the information and your website will be ready to go.

Occasionally, the installer will be unable to create a configuration file. If that happens, just copy the code that wordpress shows you, create a file called wp-config.php and paste the code in it.

You can add wordpress to your other sites on the same server following the same procedure.

Change WordPress Permalinks:

For SEO purposes, you must change the permalinks to show the title of the post in the url. This is usually done through Settings > Permalinks.

However, this requires mod_rewrite rules to be inserted in the .htaccess file. So, just create a .htaccess file and add the following code in it.


RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

Now your permalinks will work.

If for some reason, you cannot create a .htaccess file, then simply enter the following under ‘custom structure’ in the permalinks settings:

/index.php/%year%/%monthnum%/%day%/%postname%/

8 thoughts on “How To Set Up A WordPress VPS (Centos) With WebMin

  1. Ketam

    Hi,
    Im using Webmin without Kloxo by following your guide.
    I attempt to change my WP permalink to Post name http://www.domain.com/sample-post/ . And I have update my .htaccess in my var/www/html too.

    However this error still insist.

    Not Found

    The requested URL /blog/ was not found on this server.

    Regards

  2. vps2.me

    Yes, Kloxo does not work on Ubuntu. Your options are:

    (i) Hassle your host to fix the template;

    (ii) Try another version of Ubuntu;

    (iii) Shift hosts. Try burstnet.eu. They are at the same price point as Virpus (after the 20% discount that they give) and offer vastly superior performance.

  3. Anand

    Well, I have to have Ubuntu because of a few software I need on my website and if I am not wrong Kloxo does not run on Ubuntu..

  4. vps2.me

    This really shouldn't be troubling you so much. Just to test, I installed Webmin on my 128MB RAM Vps and it literally took only a minute.

    There appears to be a problem with the template (the OS). Why don't you reinstall Centos 6 32 bit and retry. Alternatively, try Kloxo. You'll be up and running in literally a few moments.

  5. Anand

    Thanks for the message. I talked to my host and they fixed a few things up and now I can install RPM. But now after the first command, when I type "rpm -U webmin-1.580-1.noarch.rpm", I get the following message and error..Any ideas?

    http://imgur.com/yStp0

    Thanks for your help.

  6. vps2.me

    Well this means that rpm or "redhat packet manager" is not installed. This is a typical problem with super-budget hosts. It can only be installed by the host from the source media (CD).

    What distro are you running? Centos 6? If you are using 32 bit, try 64 bit. Or try another version of Centos.

  7. Anand

    Hi

    I am running this from the virtual SSH console on my Virpus server. The first command to download ran successfully. But when I do the second command "rpm -U webmin….", I get the error that says "rpm: command not found". Any idea what I need to do?

Leave a Reply

Your email address will not be published. Required fields are marked *