How to Install WordPress in Ubuntu 13.10 Server

Last updated: October 29, 2013

If you’ve already installed LAMP (Linux, Apache, MySQL, PHP) or LNMP in Ubuntu Server, now it’s time to install wordpress on Ubuntu and get your site running!

WordPress is a popular blogging tool and a content management system (CMS) based on PHP and MySQL. It’s free and open-source. In the steps below the lines that the user needs to enter or customize will be in red in this tutorial!

1. Create MySQL Database and User for WordPress

If you’re using LAMP, install PhpMyAdmin to get a graphical way setting your MySQL Database.

To install PhpMyAdmin, run command below in Ubuntu server:

sudo apt-get install phpmyadmin

Choose apache2 webserver while the installing process and say NO to “Configure database for phpmyadmin with dbconfig-common?”

Once installed, run commands below to get it working:

sudo sh -c 'echo "Include /etc/phpmyadmin/apache.conf" >> /etc/apache2/apache2.conf' && sudo service apache2 restart

Now, go to http://UBUNTUSERVERIP/phpmyadmin/ in your client’s browser and type in root and the password you set when MySQL was installed to login.

phpmyadmin login

phpmyadmin login

Follow the steps below to create Database and user:

Step 1 – Click on Users then click Add User.
Step 2 – Type in your desired User name (wordpress is a good one) and ensure Use text field is selected. Ensure Host is set to Local from the drop down list and the text box will change to localhost and enter a Password and then confirm it in the Re-type box. Ensure the Password Use text field is also selected.
Step 3 – Click on Create database with same name and grant all priviliges.
Step 4 – Click on Go.

phpmyadmin create user and database

If you’re using LNMP (Linux, Nginx, MySQL, PHP), follow the steps below to create user & database (both are wordpress in commands below).

Step 1 – Run command in Ubuntu Server to log into MySQL Shell with MySQL root password:

mysql -u root -p

Step 2 – Create database, here I named it wordpress:

CREATE DATABASE wordpress;

Step 3 – Create a new user also named wordpress:

CREATE USER wordpress@localhost;

Step 4 – Set a password for this user:

SET PASSWORD FOR wordpress@localhost= PASSWORD("12345678");

Step 5 – Grant all privileges to the new user:

GRANT ALL PRIVILEGES ON wordpress.* TO wordpress@localhost IDENTIFIED BY '12345678';

Step 6 – Refresh MySQL:

FLUSH PRIVILEGES;

Exit MySQL shell:

exit

2. Download WordPress

On Ubuntu Server, run command below to download the latest wordpress package from its official site:

cd && wget http://wordpress.org/latest.tar.gz

Then uncompress it via command below:

tar -xzvf latest.tar.gz 

3. Setup WordPress Configuration

First copy the sample wordpress configuration file into a new config file:

cd && cp wordpress/wp-config-sample.php wordpress/wp-config.php

Then edit the file with command below:

vi wordpress/wp-config.php

Find the section that contains the field below and substitute in the correct name for your database, username, and password:

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

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

Press i to start editing, and Esc to end editing. Finally press Shift+: followed by wq and Enter to save and exit the file.

4 Copy the files

Now move WordPress files to webserver root directory:

For LAMP:

cd && sudo rsync -avP wordpress/ /var/www/

For LNMP:

cd && sudo rsync -avP wordpress/ /usr/share/nginx/html/

Give ownership of the directory to the apache/nginx user:

cd /var/www/  ###For nginx: cd /usr/share/nginx/html/

sudo chown www-data:www-data * -R 

sudo usermod -a -G www-data www-data

5. Install WordPress:

Now in your client’s web browser go to http://UBUNTUSERVERIP/wp-admin/install.php and install your wordpress site:

installing wordpress

Once done, if you still get “It Works!” Apache page. Run command below to edit dir.conf:

sudo vi /etc/apache2/mods-enabled/dir.conf

You will see a line of index files (index.html, index.php, index.cgi, etc) under the DirectoryIndex setting. Add index.php as the first item in the list.

After that, restart Apache server by:

sudo service apache2 restart

Now you can access your new website:

wordpress site

Twitter

I'm a freelance blogger who started using Ubuntu in 2007 and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please comment to let me know if the tutorial is outdated! And, notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me via ubuntuhandbook1@gmail.com Buy me a coffee: https://ko-fi.com/ubuntuhandbook1 |

13 responses to How to Install WordPress in Ubuntu 13.10 Server

  1. Thanks, up and running in five minutes

  2. Success! Thank you.

  3. Oddmund Johnsen December 1, 2013 at 8:01 pm

    Success! Thank you.

  4. Success. Thx a lot.

  5. Thank you very much very useful for us….sincerely thanks a lot

  6. Concise – perfect. Thank you.

  7. hello am having problems with the step 3 i cant edit it well

  8. just perfect

  9. nice for installing wordpres in ubuntu
    Thankyou

  10. well explained tutorial especially for nginx on latest ubuntu versions

    thanks

  11. Best tutorial i’ve found so far, thanks! – FYI its a lot easier to edit the wordpress/wp-config.php through a text editor than in the terminal

  12. I am sorry, but i cannot change the dir.conf content and as a result wordpress does not work properly. I have no edit permissions on this file. Any ideas?

    Thanks in advance!