Prerequisite: You’ll want to set up a lamp server as outlined here.

Famous 5-Minute Install:

If that’s all working, the next thing you’ll want to do is grab WordPress

  1. Download and unzip the WordPress package if you haven’t already.
  2. We first need to find out what the root directory of your server is. This information is gerneraly found in the Apache configuration files here: /etc/apache2/sites-available/. In new versions of Ubuntu the root directory can be viewed here:

    vim /etc/apache2/sites-available/000-default.conf

    Here we can see that the document root is set to var/www/html/. We either need to edit this file or install WordPress here. I will so the latter.

    cd /var/www/
    sudo chown html/
    cd html/
    wget http://wordpress.org/latest.tar.gz
    tar -zvxf latest.tar.gz

  3. Create a database for WordPress on your web server, as well as a MySQL user who has all privileges for accessing and modifying it.
  4. During the Ubuntu installation process, the wizard asked you to specify a “root” password for MySQL. You’ll need that now, as we’re about to create a database for WordPress to use. The process for doing so is explained over on the WordPress codex, and goes a little something like this:

    $ mysql -u root -p
    Enter password:
    Welcome to the MySQL monitor. Commands end with ; or g.
    ... ETC ...

    Now, you’ll create the new database:

    mysql> CREATE DATABASE wordpress;

    Next, set up a database user:

    mysql> GRANT ALL PRIVILEGES ON wordpress.*
        -> TO "wp_user"@"localhost"
        -> IDENTIFIED BY "password";

    Clean up after yourself, and you’re done:

    mysql> FLUSH PRIVILEGES;
    mysql> EXIT

  5. (Optional) Find and rename wp-config-sample.php to wp-config.php, then edit the file (see Editing wp-config.php) and add your database information.
  6. I needed to create this as the installer (in Step 5) could not write this file (for some unknown reason):

    cp wp-config-sample.php wp-config.php
    vim wp-config.php

  7. Upload the WordPress files to the desired location on your web server:
    1. If you want to integrate WordPress into the root of your domain (e.g. http://example.com/), move or upload all contents of the unzipped WordPress directory (excluding the WordPress directory itself) into the root directory of your web server.
    2. If you want to have your WordPress installation in its own subdirectory on your website (e.g. http://example.com/blog/), create the blog directory on your server and upload the contents of the unzipped WordPress package to the directory via FTP.
    3. Note: If your FTP client has an option to convert file names to lower case, make sure it’s disabled.

    All the WordPress files will be unpacked into a subdirectory of your website called wordpress. I prefer my blog to live at the root directory of my website, so I’ll be moving all these up one level:

    cd /var/www/html/
    mv wordpress/* .

    The empty wordpress directory can be removed:

    rm -r wordpress/

  8. Run the WordPress installation script by accessing the URL in a web browser. This should be the URL where you uploaded the WordPress files.
    1. If you installed WordPress in the root directory, you should visit: http://example.com/
    2. If you installed WordPress in its own subdirectory called blog, for example, you should visit: http://example.com/blog/

    Since my document root is set to /var/www/html/, I can access the installer using either of the following:

    Note that using http://localhost:8080 will load the http://localhost:8080/index.html file by default.

    Once you have loaded the correct page you should see the following, and can press “Let’s go!” to proceed with the installation. (You might need to create the wp-config.php manually as outlined in Step 3):

That’s it! WordPress should now be installed.

Note: You might need to delete or rename the original index file:
mv index.html index.html.bak

Advertisements