Weblog Archive

Run WordPress locally on your Ubuntu powered computer

Tue, 25 Mar 2008 at 18:02 • Filed under Linux, Noteworthy, Server side, Web apps
  • Install Apache: sudo apt-get install apache2
  • Install PHP: sudo apt-get install php5 libapache2-mod-php5
  • Intall MySQL: sudo apt-get install mysql-server (The new MySQL now guides you to set a root password during this process—no need to run mysql -u root separately. It also now allows you to set a bind-address to your IP—instead of 127.0.0.1)
  • The folder /var/www is now the webserver root. Own it first: chown -R username1 /var/www. www folder is now writable.
  • Load up http://localhost/phpmyadmin and create database (prompts for MySQL root password.)
  • Navigate to /var/www and download WordPress: svn co http://svn.automattic.com/wordpress/tags/2.3.3/ .
  • Rename wp-config-sample.php to wp-config.php and edit it to enter database information. Optionally, increase PHP memory to, say, 96MB: define('WP_MEMORY_LIMIT', '96MB');. Enable caching, if you like—add this line: define('WP_CACHE', true); in it.

Now I have a local web server running on my Ubuntu powered desktop—complete with a local version of my site, and proudly powered by WordPress.

Update: You’ll need to set /var/www folder writable by server: sudo chmod -R 755 www.

Credits: Much of the LAMP installation part was referred from this simple and excellent Howto Forge article. I’ve skipped tasks that are now automated; and added those that weren’t covered in the referred article.

  1. Here, username is your login name on the computer; typically username@computer that you see when you open a Terminal window. []

,

[ Ads ]

Related posts

Following list is auto-generated, based on this post's context as possibly related. You may, however, occasionally find some in this list unrelated, but nevertheless, we sincerely hope that you'll enjoy them too.

8 responses to “Run WordPress locally on your Ubuntu powered computer”

  1. David Collantes said:

    You’ll need to set /var/www folder writable by server: sudo chmod -R 755 www

    This will set the execute bit as well. Normally the files will be owned by the user the web server runs as, which by default is apache (on apache servers, or www, depending on the Linux ‘flavour’). In such case, it would be better to do:

    sudo chmod -R ug+rwx /var/www

    instead. Of course, if setting execute bit recursively on all files under www isn’t a problem, then 755 suffice.

  2. Chetan said:

    David, thanks. That’s a good suggestion indeed.

  3. deuts said:

    At Step 4: chown -R username1 /var/www
    chown: `username@computername’: invalid user
    What to do yani? thanks for any help….

  4. Chetan said:

    Replace username with your username or login-name; do not use ‘username’ literally.

  5. deuts said:

    yeah, that’s what I did, with my exact username with the computer name.

  6. deuts said:

    I’m using Gutsy, i’m not sure if that has to do something.

  7. Chetan said:

    No, you don’t use the computer name—sorry, if I have been unclear. It would be just this: chown -R username /var/www

    (It just means that you as a user are owning the folder so you could have permission to add, edit or delete files to/from it. Also, do follow David’s update.)

    Works fine in Gutsy—that’s the one I use too.

  8. deuts said:

    It worked great! Many thanks!