This brief tutorial shows you how to install WordPress 4.0.1 on Ubuntu 14.04 / 14.10. As you may probably know, WordPress is the king among content management systems (CMS). If you’re reading this post, it’s probably because you have a WordPress blog or want to learn how to install WordPress.

WordPress depends on the LAMP or LEMP stack. The LAMP stack include Linux, Apache2 or Nginx, MySQL or MariaDB and PHP. This post is going to show you how to install it with LAMP support, that is Linux, Apache2, MySQL and PHP. This is the easiest way to get WordPress working on Ubuntu.

You may also use MariaDB instead of MySQL or Nginx instead of Apache2, but this tutorial is going to be focusing on install WordPress with Apache2 and MySQL support.

So, before we can even go any further, let’s go and install the LAMP stack.

  • Installing the LAMP stack on Ubuntu

To install the LAMP stack on Ubuntu, go and read this post or click on the link

After installing LAMP, go and download WordPress file and begin configuring it.


  • Downloading WordPress Content

At this point you should have a working LAMP stack installed on Ubuntu if you followed the steps from the link above. If you haven’t, please go back to the link above and follow the tutorial on how to install LAMP.

After that, run the commands below to download WordPress content.

cd /tmp/ && wget

Next, run the commands below to extract the downloaded archived file.

tar -xvzf latest.tar.gz

Then copy WordPress content to the default Apache2 root directory. When Apache2 gets installed on Ubuntu, a default root directory (/var/www/html) is created. In the default root directory, there’s also a file called index.html. This file is there to verify that Apache2 is working.

It’s recommended to delete the file after copying WordPress content.

sudo mv wordpress/* /var/www/html/


  •  Creating WordPress Database

After copying WordPress content, let’s go and create a WordPress database. WordPress needs database to store its content. To do that, follow the steps below.

Run the commands below to sign onto the database. When prompted for a password, type the root password you created in the earlier tutorial on LAMP.

mysql -u root -p

Next, run the commands below to create a new database called wpdb.


Next, run the commands below to create a new database user called wpuser with a new password.

CREATE USER wpuser@localhost IDENTIFIED BY 'new_password_here';

Then run the commands below to give the user full access to the newly created database you created earlier.

GRANT ALL ON wpdb.* to wpuser@localhost;

Finally, run the commands below to refresh the database permissions table and exit.



  • Configuring WordPress

After that, go and make a copy of the wp-config-sample.php and create a new file called wp-config.php. WordPress uses the new file to connect to the database and perform other functions.

To do that, run the commands below

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

Open the newly created file and configure the database setting in it, then save and exit.

sudo vi /var/www/html/wp-config.php

// ** MySQL settings – You can get this info from your web host ** //
/** The name of the database for WordPress */
define(‘DB_NAME’, ‘wpdb‘);

/** MySQL database username */
define(‘DB_USER’, ‘wpuser‘);

/** MySQL database password */
define(‘DB_PASSWORD’, ‘password‘);

Save the file and you’re done.

The next thing to do is grant Apache2 web server permissions to manage content in the root directory.  To do that, run the commands below.

sudo chown -R www-data:www-data /var/www/html/
sudo chmod -R 755 /var/www/html/

Finally, restart Apache2 web server and test your settings.

sudo service apache2 restart

Open your browser and go to the server using its IP address or hostname and you should see WordPress default setup page.

Follow the page wizard until you’ve finished configuring WordPress.

wordpress ubuntu 14.10