How To Install WordPress On Ubuntu

WordPress is a popular blogging tool powered by PHP and MySQL. WordPress has many features including plug-in support, customizable templates, and widgets that can be re-arranged easily without inserting a single PHP or HTML code. It can be easily customized into a content management system (CMS).

In this guide we will show you how to install the latest WordPress version locally on a system running Ubuntu 11.10/12.04 or older. To be able to install WordPress on Ubuntu, you need first to install a web server supporting PHP and MySQL. You can find  a tutorial explaining how to install LAMP (Linux,  Apache, MySQL, PHP) on Ubuntu.

WordPress Installation

1. Download first the latest WordPress version (currently v3.2.1) using this command from the terminal:


2. Extract the archive file with this command:

tar -xzvf latest.tar.gz

3. Create now a folder for WordPress in the /var/www directory using this command:

sudo mkdir /var/www/wordpress

4. Now move all WordPress files to this created folder using this command:

sudo cp -r ~/wordpress/* /var/www/wordpress

5. If you are installing WordPress in a subdirectory not in the root directory (/var/www), then edit the apache2.conf file with this command:

sudo gedit /etc/apache2/apache2.conf

And at the end of the file, insert this line:

AddType application/x-httpd-php .html

Save the file and close it.

6. Restart now Apache with this command:

sudo /etc/init.d/apache2 restart

7. Now we need to create a new MySQL database with a user having all privileges for accessing it. These details will be then inserted in the config file for WordPress. To create a new database, you may use phpMyAdmin, or simply run this command to login to the MySQL server (use the password you assigned to your MySQL server during LAMP installation):


8. Create now a new database with this command (replace WordPress with any other name of your choice):


If the command is successful, the returned output will be similar to this:

mysql> CREATE DATABASE WordPress;
Query OK, 1 row affected (0.01 sec)            

9. Add now a new user with this command (replace “username” with any name of your choice):

CREATE USER username;

10. Assign a strong password to this new user with this command (replace “123” with your own password):

SET PASSWORD FOR ‘username’ = PASSWORD(‘123’);

11. Grant now this user all privileges for the created database with this command:


WordPress –> Replace it with the name of the created MySQL database.
username –> Replace it with the username you have just created.
123 –> Replace it with the password you assigned to the MySQL user.

12. Once you finish, run this command to exit the MySQL server:


13. Rename now the wp-config-sample.php file to wp-config.php using this command:

sudo cp /var/www/wordpress/wp-config-sample.php /var/www/wordpress/wp-config.php

Note: If you are installing in another directory, then correct the given path to your own.

14. Edit now the wp-config.php file with this command:

sudo gedit /var/www/wordpress/wp-config.php

Insert now your MySQL settings you have just created by replacing:

database_name_here   —> with the database name you have created. For this tutorial, it’s named “WordPress“.
username_here  —> with the MySQL user you have created earlier.
password_here  —> with the password you assigned to the MySQL user.

Save your file and close it.

15. Open now one of these two links to set up your WordPress admin details (you will be redirected automatically):



16. Fill now in the following web forms, then click Install WordPress:

  • Site Title
  • Username
  • Password
  • Your E-mail

17. Login now to the admin section using the password you selected to start managing your blog:

18. Congratulations! Your WordPress blog is now successfully installed. Your blog is live at this link:


The admin section can be accessed here:


go to  root directory
~$ sudo -i

connect to server
root@your-System-Product-Name:~# ssh
[ OK ]
root@wordpress:~# cd /var
root@wordpress:/var# cd www
root@wordpress:/var/www# ls
ls  command

list of directory
ls command

sudo cp /var/www/blog/wp-config-sample.php /var/www/wordpress/wp-config.php

sudo cp /var/www/blog/wp-config-sample.php /var/www/blog/wp-config.php
sudo gedit /var/www/blog/wp-config.php

GRANT ALL PRIVILEGES ON blog3.* TO root@localhost IDENTIFIED BY ‘root’;
GRANT ALL PRIVILEGES ON blog.* TO root@localhost IDENTIFIED BY ‘root’;


19 thoughts on “How To Install WordPress On Ubuntu

  1. I’ve been browsing on-line more than 3 hours as of late,
    but I by no means discovered any fascinating article like yours.
    It is beautiful price enough for me. Personally, if all site owners and bloggers made just right content material
    as you did, the web shall be much more useful than ever before.

  2. Just desire to say your article is as amazing.
    The clearness to your post is just cool and that i could suppose you’re a professional in this subject.
    Fine along with your permission allow me to grasp your RSS feed to stay updated with imminent
    post. Thanks 1,000,000 and please carry on the enjoyable work.

  3. Do you have a spam issue on this blog; I also am a blogger, and
    I was wanting to know your situation; many of us have developed some nice practices and we are looking to exchange solutions with others, why not shoot me
    an email if interested.

  4. obviously like your website but you have to take a look at the spelling on several of
    your posts. A number of them are rife with spelling issues and I in finding it very troublesome to inform the reality nevertheless I’ll certainly
    come back again.

  5. It’s perfect time to make some plans for the long run and it’s time to be happy.
    I have learn this post and if I may just I desire to counsel you
    few fascinating issues or advice. Maybe you could write subsequent articles referring to this
    article. I wish to learn even more issues about it!

  6. sports shop says:

    Write more, thats all I have to say. Literally, it
    seems as though you relied on the video to make your point.
    You clearly know what youre talking about, why waste your intelligence on just posting videos
    to your site when you could be giving us something
    informative to read?

  7. you are in point of fact a good webmaster. The site loading speed is amazing.
    It sort of feels that you are doing any unique trick.
    In addition, The contents are masterwork. you’ve performed a great activity in this topic!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s