Search

How to Install WordPress Locally on Ubuntu 14.04

Listen to this article

install-wordpress-ubuntuWhen I joined WisdmLabs, installing WordPress on Ubuntu was the first thing I had to do. Actually, the first thing I had to do was learn WordPress. And to learn it, I had to try things out, which meant I had to install it.

I was new to WordPress so I had to start by learning the very basics of the installation process. I read through quite a few sources, and compiled my own notes, which I’m presenting to you today as a blog post.

For of you who are in the same position I once was, this is a one stop guide to installing WordPress on Ubuntu.

Windows users worry not. The post- How to Install WordPress on Windows, should help you out.

Moving on.

Let’s begin with understanding the basics. We’ll learn the following:

  1. What is LAMP and how to install it
  2. How to create your database, and then,
  3. How to install WordPress.

[space]

What is LAMP?

LAMP (or a LAMP stack) is an open-source software bundle. LAMP is used to build dynamic web content or web applications. LAMP is an acronym for

  1. Linux- the operating system.
  2. Apache- the web server which accepts and serves web page requests.
  3. MySQL- the database management system which stores your website’s content.
  4. PHP- a server-side scripting language. WordPress is written in PHP. Apache interprets PHP to finally display the web content.

[su_note note_color=”#fffdb0″ text_color=”#000000″]A little piece of trivia: WordPress users tend to always associate P in LAMP with PHP. And while this is generally the case, in a LAMP stack P can stand for PHP, Perl or Python.[/su_note]

Now with Ubuntu you have Linux. So you need to install Apache, MySQL and PHP.

[space]

How to Install LAMP

For security reasons, it is recommended that you begin installation as a non-root user. If you do not have a non-root user account set up, this Ubuntu Initial Server Setup guide will be of help.

We’ll begin by updating our software to the latest versions.

sudo apt-get update

Install Apache

To install Apache use the following command:

sudo apt-get install apache2

[su_note note_color=”#fffdb0″ text_color=”#000000″]Quick tip: To check if Apache is installed hit http://localhost in your browser. If it reads ‘It works!’ then Apache is working.[/su_note]

Install MySQL

Use the below command:

sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql

During the installation you’ll be asked to set a password for ‘root’ user. This is the root user for your MySQL database management system. Set a password and continue.

Once the installation is complete, you have to run the below command to create the database directory structure:

sudo mysql_install_db

[su_note note_color=”#fffdb0″ text_color=”#000000″]Quick tip: Incase you forget your password this MySQL Password Reset guide will help you.[/su_note]

Install PHP

The last step to installing the LAMP stack is to install PHP.

sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt php5-curl php5-gd php5-xmlrpc
sudo service apache2 restart

With that we’re done with the default LAMP stack installation. Next, we have to create a database and install WordPress.

[space]

How to Create a Database and User

For every site you create you need a database. You already have MySQL installed, login using the root password

mysql -u root -p

Enter the password you had set at the time of MySQL installation to display the MySQL command prompt.

To create the database, use the below command in your MySQL command prompt:

CREATE DATABASE wdmdb;

It is recommended not to access the database using the MySQL root user. Hence we’ll be creating a new user (set your own username and password) and granting the user access to the database using the below commands:

CREATE USER wpuser@localhost IDENTIFIED BY 'pwd';
GRANT ALL PRIVILEGES ON wdmdb.* TO wpuser@localhost;

These commands should be followed by FLUSH PRIVILEGES to ensure that the changes are registered and then you can EXIT the MySQL command prompt.

Your database is now ready for your website, so you can now finally install WordPress 🙂

[space]

How to Install WordPress on LAMP?

Use the below commands to download the latest version of WordPress inside /www directory.

cd /var/www
sudo wget http://wordpress.org/latest.tar.gz
sudo tar -xzvf latest.tar.gz

Now in a browser open http://localhost/wordpress.

  1. Select your language of choice and click on ‘Continue’
  2. Next you’ll have to enter your database and user details to create the wp-config file. Click on ‘Let’s Go‘ and then enter the details- Database Name (wdmdb), User Name (wpuser), Password (pwd). The Database Host should be localhost. It is recommended to change the Table Prefix to other than wp_.
  3. Then click on ‘Submit‘ and then ‘Run the Install‘.
  4. Next, on the Welcome screen, add a site title, the admin username and password, your email address (uncheck ‘Allow search engines to index this site’ since it’s a local site) and click on ‘Install WordPress’.
  5. Success! Once you’re greeted by the ‘Success’ screen you’re good to go! WordPress has been successfully installed. You can login to your site by clicking on ‘Login‘, and entering your newly created admin username and password.

[su_note note_color=”#fffdb0″ text_color=”#000000″]Quick tip: In case you ever forget your WordPress admin password this Reset WordPress Admin Password using phpMyAdmin guide will help you.[/su_note]

You can now explore the dashboard settings, customize your site by installing a new theme or by adding the plugins you need. 🙂

[space]

Found this post helpful? Share your thoughts in the comment section below.

Rechal Cutinha

Rechal Cutinha

Leave a Reply

Your email address will not be published. Required fields are marked *

Get The Latest Updates

Subscribe to our Newsletter

A key to unlock the world of open-source. We promise not to spam your inbox.

Suggested Reads

Join our 55,000+ Subscribers

    The Wisdm Digest delivers all the latest news, and resources from the world of open-source businesses to your inbox.

    Suggested Reads