New users who want to learn how to install WordPress on Ubuntu 15.04 server can continue reading below. This tutorial is going to show users how to install WordPress on Ubuntu server to power a WordPress blog or website. It’s going to be short and easy, and very handy for anyone who is just started out with installing and configuring WordPress.

Before you start reading below, I am assuming you’ve installed Ubuntu and have root or administrative access to the server. If not, you may not be able to apply everything written below. So, please go back and first install Ubuntu, then login as a root user.

After doing that, continue below.

One thing to remember is WordPress needs the LAMP/LEMP stack to function. The LAMP or LEMP stack is a representation of free opensource software and servers that enable web services. It’s the most popular opensource stack that powers most of the websites online today.

It consist of Linux OS, Apache2 or Nginx or other opensource webservers, MySQL or MariaDB database server and PHP. These are the bare-rock of most of the websites running online today. So before WordPress functions, you need to enable the LAMP stack.

Now that you’ve installed Ubuntu 15.04, continue below to learn how to install Apache2, MySQL and PHP.

First, update your Ubuntu server. To do that, run the commands below.

sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get autoremove

You may have to restart your Ubuntu server after running the commands above. After restarting, continue installing the LAMP stack.

  • Installing Apache2

To install apache2, run the commands below.

sudo apt-get install apache2

  • Installing MySQL

After installing Apache2, run the commands below to install MySQL.

sudo apt-get install mysql-server mysql-client

After installing MySQL, run the commands below to secure the MySQL server.

sudo mysql_secure_installation

When prompted, follow the guide below.

Next, choose Yes for the rest of the prompts until you’re done.

  • Enter current password for root (enter for none): Type root password
  • Change the root password? N
  • Remove anonymous users? Y
  • Disallow root login remotely? Y
  • Remove test database and access to it? Y
  • Reload privilege tables now? Y


  • Installing PHP5 and other modules

After installing the database server, run the commands below to install PHP5 and other PHP modules.

sudo apt-get install php5 libapache2-mod-php5

More PHP modules can be installed using the commands below. For WordPress to function correctly, you may have to install the modules below.

sudo apt-get install php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl

At this point, Apache2, MySQL and PHP are installed and ready for WordPress.

To install WordPress, use the commands below to download the latest version.

cd /tmp/ && wget

Then run the commands below to extract the downloaded file.

tar -xvzf latest.tar.gz

Since the default Apache2 root directory on Ubuntu server is at /var/www/html, we need to copy WordPress content to that location, the root directory. Everything in that directory is what the webserver will retrieve.

To copy WordPress content to Apache2 root directory, run the commands below.

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

One thing to verify is to make sure a test page called index.html isn’t in the root directory. If you see it there, delete it. This can become a bit of a confusion to new users.

After copying WordPress content to the root directory, go and create WordPress database. WordPress needs database to store its content. So go and create one. To do that, follow the steps below.

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.



After creating the database, make a copy of wp-config-sample.php and create a new wp-config.php file. The new file will contain WordPress database connection parameters.

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

After that, open and edit the new file using the commands below.

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

Then make the changes in the file by entering the WordPress database, username and password you created earlier. Then save the file and exit.

// ** 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‘);

Finally, change the permission of WordPress folder so that it functions correctly. To do that, run the commands below.

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

Restart Apache2 webserver by running the commands below.

sudo service apache2 restart

You’re now ready to access WordPress page. Open your browser and browse to the server name or IP address. You should see WordPress default setup page like the one below.

wordpress ubuntu 14.10


Follow WordPress