Setting up WordPress on Ubuntu

Lately I’ve been finding myself installing WordPress sites for numerous reasons. WordPress is a shocking versatile web site framework built on PHP if you just want to publish content extremely quickly. There’s typically a plug-in for any function that you’re looking for. In order to run WordPress on Ubuntu, you’ll need to do the following things:

Setup PHP

  1. Install PHP

Setup the database server

For instructions of how to manage MySQL, check out my MySQL cheatsheet

  1. Install MySQL
  2. Install the MySQL module for PHP on the web server
    sudo apt-get install libapache2-mod-php5
  3. Create a new user
  4. Create a new database
  5. Give the user access to the database

Set up the Web Server component

  1. Install Apache
  2. Download the latest version of WordPress anduncompress it
    sudo wget http://wordpress.org/latest.tar.gz
    tar -xvf latest.tar.gz
    
  3. Move your site to a new directory and give your Apache user access to that directory
    sudo mkdir /
    sudo cp -r wordpress //
    sudo chown -R www-data:www-data //
    
  4. Create an Apache configuration file for your site
    sudo nano /etc/apache2/sites-available/.conf
  5. Paste the following into yourconfig file and save it
    <VirtualHost *>
        DocumentRoot "//wordpress"
        ServerName 
        <directory "="" <directory="" name="" wordpress"="">
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Require all granted
        
    
  6. Enable the configuration
    sudo a2ensite .conf
  7. Enable the appropriate Apache mods
    Enable rewrite for pretty permalinks

    sudo a2enmod rewrite
  8. Reload Apache
    sudo service apache2 reload

Assuming you’ve already set up your DNS settings to point to the right server, you should be able to get started with setting up the site. When you go to http://, you should be able to start setting up the site.

These instructions work on the following configurations:

  • Ubuntu 14.04 and Apache 2.4