How to Install WordPress on Ubuntu 13.04 Server

Last updated: November 3, 2013

Wordpress
Already installed LAMP or LEMP (Nginx with PHP, Mysql) on your Ubuntu Server? This time I’m going to show you how to install WordPress CMS.

WordPress is a popular blogging tool and a content management system (CMS) based on PHP and MySQL. It’s free and open-source.

To install WordPress, first login your Ubuntu Server as root, then follow the steps below:

1.) Create Mysql Database and User for WordPress.

  • First log into Mysql as root user:
    mysql -u root -p
  • Type in the root password to get past.

  • Create a database. Change database-name in code to whatever you want.
    CREATE DATABASE database-name;
  • Create an user. Change database-user in code to whatever you want.
    CREATE USER database-user@localhost;
  • Give a password to the user just created. Change password-here in code.
    SET PASSWORD FOR database-user@localhost= PASSWORD("password-here");
  • Grant all privileges to the new user.
    GRANT ALL PRIVILEGES ON database-name.* TO database-user@localhost IDENTIFIED BY 'password-here';
  • f.) Finally, refresh Mysql:
    FLUSH PRIVILEGES;
  • g.) Exit Mysql sell
    exit

2.) Download WordPress and setup the configuration.

  • Download the latest wordpress:
    wget http://wordpress.org/latest.tar.gz

    Then extract:

    tar -xzvf latest.tar.gz
  • Copy the sample configuration file to make a backup.
    cd wordpress && cp wp-config-sample.php wp-config.php
  • Edit the configuration file:
    vi wp-config.php

    Press I to start editing, Esc to stop editing. Press :, then type wq to save and exit, type q! to exit without save.

    Then change the section of database-name, database-user, password-here.

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

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

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

3.) Setup the permissions.

    Give ownership of the directory to the apache or nginx user by running following commands one by one:

    sudo rsync -avP ~/wordpress/ /var/www/
    cd /var/www/
    sudo chown www-data:www-data * -R 
    sudo usermod -a -G www-data username

4.) Finally in your browser go to IP or domain/wp-admin/install.php and start installing.

Enjoy!

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 [email protected] Buy me a coffee: https://ko-fi.com/ubuntuhandbook1

5 responses to How to Install WordPress on Ubuntu 13.04 Server

  1. I follow this tutorial for installing wordpress in my vps. I don’t get any error while installing. After all process when I go to my-ip/wp-admin/install.php I get a not found message.

    It says: The requested URL /wp-admin/install.php was not found on this server.

    Plz give me a solution.

    • You need one more step to copy the files:

      sudo rsync -avP ~/wordpress/ /var/www/

      If you use the nginx as the web server, you may change the /var/www/ directory

  2. For the last part:

    sudo usermod -a -G www-data username

    What user is this in your example?