Run WordPress locally on your Ubuntu powered computer
- 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 runmysql -u rootseparately. It also now allows you to set a bind-address to your IP—instead of 127.0.0.1) - The folder
/var/wwwis now the webserver root. Own it first:chown -R username1 /var/www. www folder is now writable. - Load up
http://localhost/phpmyadminand create database (prompts for MySQL root password.) - Navigate to
/var/wwwand download WordPress:svn co http://svn.automattic.com/wordpress/tags/2.3.3/ . - Rename
wp-config-sample.phptowp-config.phpand 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.
- Here,
usernameis your login name on the computer; typicallyusername@computerthat you see when you open a Terminal window. [←]

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/wwwinstead. Of course, if setting execute bit recursively on all files under www isn’t a problem, then 755 suffice.
Mar 28, 08 at 12:18David, thanks. That’s a good suggestion indeed.
Apr 5, 08 at 18:28At Step 4: chown -R username1 /var/www
Apr 21, 08 at 02:16chown: `username@computername’: invalid user
What to do yani? thanks for any help….
Replace username with your username or login-name; do not use ‘username’ literally.
Apr 21, 08 at 09:24yeah, that’s what I did, with my exact username with the computer name.
Apr 21, 08 at 16:47I’m using Gutsy, i’m not sure if that has to do something.
Apr 21, 08 at 16:48No, 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.
Apr 21, 08 at 16:54It worked great! Many thanks!
Apr 21, 08 at 19:03