Skip to content

install wordpress on ubuntu

In this post I will provide instructions to install WordPress on ubuntu server.  This tutorial is aimed at those users who may want to install WordPress on a virtual server for development purposes.

A prerequisite for installing WordPress on your server, you will need to configure a LAMP server.  Once you have a configured your LAMP server, I also recommend you install PHPMyAdmin.

With the prerequisites out the way, you're ready to get underway with installing WordPress on your ubuntu server.

I recommend connecting to your server via SSH, and executing the following commands:

Get WordPress

Download the latest release of WordPress your user home directory.


Once the download is complete, uncompress the folder.

tar -xvzf latest.tar.gz

Delete the Index.html from the default Apache folder.

rm -f index.html

Move the uncompressed contents to the default Apache folder

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

Create Database

We will need to create the WordPress database. We'll do this directly in mySQL.

mysql -u root -p

Create the database and call it whatever you want. In my case I have just called it wordpress


Create a User, again this can be any name of your choice, I have chosen wpusr and any password of your choice

CREATE USER wpusr@localhost IDENTIFIED BY 'new_password_here';

Give the user full access to the newly created database

GRANT ALL ON wordpress.* to wpusr@localhost;

Refresh the database permissions table and exit.


Configure WordPress

We will now need to make amendments to the WordPresss configuration. First, we'll need to make a copy of wp-config-sample.php and create a new wp-config.php file.

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

Now edit the config file using the any text editor, in my example I have used nano

sudo nano /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’, ‘wordpress‘);

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

/** MySQL database password whatever your chosen password was */
define(‘DB_PASSWORD’, ‘password‘);

Change the permission of WordPress folder so that it functions correctly.

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

In order to be able to install any plugins or new themes on WordPress install you will need to enable the FTP server settings.

sudo chown -R www-data:www-data wordpress

We're almost ready to go now, all we need to do is restart the web server.

sudo service apache2 restart

You're now ready to access the WordPress site by navigating to it in your browser  i.e. ,  or whatever the address of DNS of your server is configured to.



Latest posts by Gary Woodfine (see all)