How To Install WordPress on Ubuntu: Part 1

November 24, 2009 by
Filed under: HowTo, linux, Ubuntu, web development 

In this first part of How To Install WordPress on Ubuntu, I'm going to show some of the things you need to do to prepare your system for the actual WordPress installation. I'll cover the steps of installing WordPress itself in Part 2.

Install LAMP

LAMP stands for Linux, Apache, MySQL, php. This is the basic web server setup you need to host a website. Even though you won't be hosting the site out to the internet, you'll need to have LAMP installed and configured to run WordPress on your computer. This tutorial assumes that you already have Ubuntu installed. Then, install LAMP on Ubuntu.

Configure Apache websites

Once you have LAMP installed and configured, you may want to set up your website to run from a directory under your user ID instead of /var/www. This can be done with some basic Apache http server configuration.

Change Apache run user and run group

In order for the WordPress automatic update function to work, the username running WordPress must match the username running Apache. You can change the Apache username by editing some parameters in the /etc/apache2/envvars file. Hit <Alt><F2> on your keyboard and enter the command

Affiliate Link
gksudo gedit /etc/apache2/envvars

In the text editor that comes up, change the following two lines

export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data

and replace www-data with your user ID and default group (your default group most likely has the same name as your user ID. For my case, this would be linerd and linerd.) Save the file and restart Apache with

sudo /etc/init.d/apache2 restart

If you get an error like "apache2: Could not determine the server's fully qualified domain name, using 127.0.0.1 for localhost," you can fix it with this command.

echo "ServerName localhost" | sudo tee /etc/apache2/conf.d/fqdn

Then reload Apache and the error should be gone.

sudo /etc/init.d/apache2 reload

If you end up having trouble with phpMyAdmin, then you need to add your ID to the www-data group.

sudo adduser yourid www-data

Continue on to How To Install WordPress on Ubuntu: Part 2

Comments

13 Responses to “How To Install WordPress on Ubuntu: Part 1”

  1. CTown says:

    By the way, what I did to get to the adminmyphp dashboard is (found on https://help.ubuntu.com/community/phpMyAdmin):

    sudo dpkg-reconfigure -plow phpmyadmin

    Then I used the username "root" to log back in.

  2. jeff says:

    *phpmyadmin

  3. Kirsten says:

    Okay. Another snag for me. Before I edit envvars, http://localhost/phpmyadmin/ works. After editing for my id and group, it does not. Restoring to www-data fixes this. Any insight to what I may be doing wrong?

    • Linerd says:

      It looks like you need to add your userID to the www-data group. I had done that as I was trying to get WordPress to work properly and forgotten about it after I made the change to envvars. So make the change to /etc/apache2/envvars as shown in the post. Then add your usedID to the www-data group. You can do this through the menus from System→Administration→Users and Groups, or from the terminal with:

      sudo adduser yourid www-data

      Then restart Apache with

      sudo /etc/init.d/apache2 restart

      Thanks for helping to debug my blog post! Looks like I have an update to make.

      • jeff says:

        tried doing this still cant acces popmyadmin unless i change id and group back to www-data

        • Louise says:

          I did this but phpmyadmin is not responding when I enter my username and password, it just resets the log in screen
          any thoughts will be much appreciated

          • Linerd says:

            Try clearing your browser cache. If that doesn't do it, then you may be able to reset your password with

            sudo dpkg-reconfigure phpmyadmin

            Restart mySQL with

            sudo restart mysql

            And then restart Apache with

            sudo /etc/init.d/apache2 restart

            Finally, clear your browser cache again and give it another try.

          • Louise says:

            Thanks Linerd, i tried this and the blue configuration screens come up etc but I'm not asked to change or set the password, tried clearing cache and restarting Apache anyway though but no luck.

          • Linerd says:

            Just to be sure, you're trying to log in as root, correct?

            To reset the root password, try

            sudo dpkg-reconfigure -phigh phpmyadmin

            The first screen should ask if you want to reinstall the database for phpmyadmin. Say "Yes". The next screen will ask you for a password for the administrative account (root). Enter the password you want, tab to OK and hit Enter. The next screen will ask about web server configuration. Make sure "apache2" is selected with a * (highlight and hit the space bar if it's not marked). Then OK.

            Then clear your browser cache and see if you can get in. If that doesn't work, I'm stumped.

          • Louise says:

            Thanks Linerd!

            It's all working now, ended up reinstalling phpmyadmin and clearing cache etc again as you suggested.

            Thanks for the guides, they're really great, especially for newbies like me!

  4. Story added...

    This story has been submitted to fsdaily.com! If you think this story should be read by the free software community, come vote it up and discuss it here:

    http://www.fsdaily.com/EndUser/http_tuxtweaks_com_2009_11_how_to_install_wordpress_on_ubuntu_part_1

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>