This tutorial will guide you step-by-step how to install WordPress on either VPS or Dedicated server with LAMP (Linux, Apache, MySQL and PHP) stack. Unlike in cPanel which you can do every thing via your browser, this method will be done via bash command using your favorite SSH client which for me I use Putty. The process is basically painless but for some newbies this could be new stuff to learn. So, if you feel having all the skill and knowledge are adequate to do the main topic of this article, so stop here this is just not for you. Otherwise, simply read on and I make sure the whole process is as easy as a piece of cake.
Unlike in Nginx, installing WordPress in Apache server is pretty much easier and straight forward. Yet, I believe this tutorial is also applicable to all other Apache-based server but in this guide I use Ubuntu.
As a refresh, WordPress is world’s number one CMS script and blogging platform that is widely used by millions bloggers around the world.
This guide will let you know how to manually install fresh WordPress blog on a VPS or Dedicated server with Apache.
- A server running either Ubuntu or Debian. In this example I use Ubuntu 12.04.
- You’ll need either Putty in Windows or Terminal in Mac and Linux to access your server via SSH connection.
- In this example I will use Putty. If you do so, make sure you know where to download it and how to use it. Read: Using Putty To SSH To Your Server From Windows.
- You have to also know all basic commands useful to SSH-ing your server. Read: Most common Unix command to manage unmanaged server.
- Make sure you have installed: Apache, PHP5, MySQL, and Postfix.
- Create new virtual hosts file to your Apache server for the domain name of your blog.
- You may also setup Bind9 DNS software first or may be later after you add your website into your server.
How To Install WordPress
Step 1 – As usual, login to your server via SSH connection. If you didn’t change it yet, it should be in port 22 otherwise use your defined port. If you did follow my previous guide about all essential basic configuration for Ubuntu server, then you should login using your username instead of root. Once logged in, type su, hit Enter on your keyboard then type in your root password.
Step 2 – Go to the directory where you will place all website’s files there. Usually it should be named as “htdocs” or “public_html”. In my case I use “htdocs” which is located at /var/www/domain.com/htdocs/. Use this command:
– Replace “domain.com” with your own domain name;
– Replace “htdocs” with “public_htm” if you do prefer to use public_html.
As in my previous tutorial I also created index.html test file, so we may also need to remove it first using “rm index.html” command as shown in screenshot pic above.
Step 3 – Next, downloading WordPress main script package. The command is simple:
Step 4 – Alright, so you now have the WordPress package file. But first, you have to also extract it first. Use this command:
tar --strip-components=1 -xvf latest.tar.gz
Then remove that “latest.tar.gz” file you’ve already extracted, not quite necessary but it will save some space in your server:
Once done, you can also test to see what files are inside your root public_html or htdocs folder by using “ls” command:
Step 5 – Next, as WordPress needs MySQL database, then you should create one along with new MySQL user having all privileges granted to that database. Read: Top most common MySQL basic commands. Or shortly, here I re-mention the necessary command as below:
Login to main MySQL screen at first. In this case I use root:
mysql -u root -p
Type in the password.
Once you are in MySQL screen, here you can create new database for your blog. Use this command:
CREATE DATABASE databasename;
**change databasename with your own database name. You better not use space in the name. In this example I use “myblog”:
If you wish to use space you can use underscore e.g: wp_456.
So you have created new database. Next, you have to create new MySQL username and grant full access to that new database. This is considered safer than using your root login. Use this command:
GRANT ALL ON databasename.* TO sqluser@localhost IDENTIFIED BY 'password';
**change databasename, sqluser and password with your own. For example:
GRANT ALL ON myblog.* TO sawiyatidb@localhost IDENTIFIED BY 'pass1234';
In that example I create “sawiyatidb” as my user for database named “myblog” while pass1234 is the password for user sawiyatidb.
That’s it. You must remember: database name, database username and its password. Once done, exit MySQL screen by typing “\q“.
Step 6 – Finally, you can proceed the WordPress installation wizard. Open your favorite web browser (I use Firefox) then visit your blog’s url / domain name. You should now see default WordPress installation wizard. First thing, you’ll be asked to create configuration file or wp-config.php
Next,.. just click the “Let’s Go” button.
So next,.. here it is the part where you have to provide Database Name, MySQL Username, its password, while you can leave Database Host and Table prefix as it is.
Click on the Submit button.You’ll then see an error saying that the wizard can’t write the wp-config.php file. Don’t worry that’s not a big problem.
Now go back to your server and create one by typing this command but make sure you are in “htdocs” or “public_html” folder already:
Then copy paste the code supplied in the wizard to the wp-config.php file you are editing in Nano editor.
then paste it to Nano editor. In putty all you have to do is just a right-click.
Once done, hit Control+O to save then Control+X to exit. Then go back to your web browser to continue the installation..
Finally hit the “Run the Install” button. In the next section you have to define admin username and its password to login to your blog. I’m sure you are already understand exactly what is it.
Finally,.. hit the “Install WordPress” button.
That’s it. Now you can login to your new blog and congratulation..
Voila.. Your new WordPress site is now ready. You can login to Admin Dashboard area as usual via “http://domain.com/wp-admin”.
See? The process is pretty simple and easy. However if you have any question regarding this topic, simply drop a comment below.