Love The Way I Work

WordPress Installation on Ubuntu with LAMP

in Blogging/Linux/Tutorial/Ubuntu/Wordpress by

This tutorial is how to install WordPress on Ubuntu Linux Desktop using LAMP. Why ? One reason is that you can do a lot of developing (playing around) much quicker as there is no need to use ftp. If You like me, play around with WordPress as a developer (perhaps you create your own theme or plugin), you should install WordPress locally in your Ubuntu Linux Desktop.

You do not need to convert your Ubuntu Desktop into Ubuntu Server. You only need install addition packages that you need to run WordPress on your Ubuntu Linux desktop.

Get ready?! Let?s start to install WorPress on Ubuntu Linux desktop.

Install LAMP

You can view my previous post about LAMP Installation On Ubuntu, if you have not already done so.

Download WordPress

You can download WordPress from their official website into your Ubuntu desktop.

Extract your WordPress archieve into your server directory

sudo tar zxvf wordpress-x.x.x.tar.gz --directory=/var/www/

Prepare MySQL Database for WordPress

Create a database for WordPress on your Ubuntu, as well as a MySQL user who has all privileges for accessing and modifying it. You can use phpMyAdmin to make it easier 😉

  • First create dababase: wordpress
  • Then create a new user: wordpress with password: wordpresspassword

Write down the values you used for databasename, wordpressusername, hostname, and password for future purpose 😉

Configure WordPress Setting

Copy the wp-config-sample.php file to wp-config.php. Open and edit wp-config.php file

// ** MySQL settings ** //
define('DB_NAME', 'wordpress');
define('DB_USER', 'wordpress');
define('DB_PASSWORD', 'wordpresspassword');
define('DB_HOST', 'localhost');

Run the Install Script

Using your favorite web browser (Firefox by default), visit wp-admin/install.php within the directory into which you just installed WordPress on your web site. For example: point your browser to http://localhost/wordpress/wp-admin/install.php

Preview your New WordPress

Point your browser to http://localhost/wordpress.

Well done! You have your own WordPress on Your Ubuntu Linux Desktop.

😀 Happy New Year!


  1. If you’ve come this far, you can have the following in your /etc/hosts: localhost

    Now when you try in your browser, you will be served from your local server (wordpress installation). In fact, you could configure (in Options section of) your local wordpress installation WordPress address (URI) and Blog address(URI) as

    Of course, when you want to refer to your blog which is not local, you will type

  2. apakah tutorial membuat databank sql merupakan tutorial terpisah?

    kupikir ada baiknya disertakan, dan oh iyah untuk pengguna pemula kayak aku mungkin lebih suka dengan tutorial pake gui nya saja.

  3. Well, I’ve done a similar thing on my debian system but there’s one small problem, the php function mail() is invoked which doesen’t work. You can also mention that you can export your database with your webhost phpmyadmin, and you can install it in your local machine
    apt-get install phpmyadmin
    sudo apt-get install phpmyadmin (#ubuntu)

    That’ what I’ve done and then pull out bluefish and hack away at the code.

  4. The extraction of WordPress didn’t work for me at first using
    “tar zxvf wordpress-x.x.x.tar.gz –directory=/var/www/”.

    By prefacing the command with “sudo” it worked first time.

  5. Hi, and let me first say thank you for the wonderful tutorial. When I try to run the install script it comes up with a page that says:
    Your PHP installation appears to be missing the MySQL which is required for WordPress.

  6. Nice.
    I’m having a trouble: “Your PHP installation appears to be missing the MySQL which is required for WordPress.”.
    Don’t know if is php that can’t login in mysql, or is a mysql-php binding problem…

  7. I totally need to do this. This tutorial sounds exactly like what I need. I like to mess around with my themes alot and it would be great if they broke on a local copy instead of one that can be seen by the masses (ok so my boyfriend is the only one that looks at it but thats just a tiny detail)

    Anyway, thanks for the tutorial.

  8. Problem: I can access the blog from my home internet connection, as it points to ( a local address). However, I can’t view it froma public internet connection outside of my house no matter what address I use in the wp-config.php file, I get an error( Any suggestions?

  9. Had to grant access to wordpress database inside MySQL by issuing command:

    grant all on wordpress.* to wordpress;

    (DB is wordpress and user is wordpress ;^)

  10. I have copied your instructions for installing wordpress and Lamp on Ubuntu. I was wondering since I have (XAMPP) installed if you could have a tutorial for installing wordpress using xampp? it istalls the following:

    XAMPP is an easy to install Apache distribution containing MySQL, PHP and Perl. XAMPP is really very easy to install and to use – just download, extract and start.

    Is it feasable? I am pretty new at this and any help would be appreciated. I could really use wordpress installed on my local machine for testing also joomla and geeklog as I run several website and use all 3 of them.
    Mel B

  11. Brian: You can not access your local server from public internet connection useless you put your server on public IP. You can access your local server from your internal internet only. CMIIW

    Mel B: Thanksfor your suggestion. I will explore this stuff. Gud lak for you 😉

  12. Hello Supriyadi
    Everything works with Lamp so far, But after I install wordpress and get to the part to create a Data Base I am lost. I can’t seem to start the (phpMyAdmin) I don’t know how. I have tried in the browser and from the command line. any help would be appreciated.
    Thank you
    Mel B

  13. Mel B: First you should make sure that your mysql server was running, try to type:

    sudo /etc/init.d/mysql status

    or you can type instead:

    sudo /etc/init.d/mysql restart

    Then you can create a new database your your wordpress, eg.

    mysql -u root [enter]
    mysql> create database wordpress;

    Gud lak…

  14. supriyadisw Thank You Thank You! I finally got it working and was able to bring up the Mysql and create a data base. Thanks again for a fine tutorial even a novice like me managed with a little help from you. Thanks again
    Mel B

  15. Hi,

    I’ve got several Joomla! Sites, and SMF Forums hosted. As well as, a WordPress Blog.

    I’ve got LAMP running on my Linux Mint PC. I can show Apache, PHP, and MySQL going. Linux Mint is Ubuntu with a lot of add-ons. Check it out.

    I’ve run into a problem. Using Firefox I can launch phpmyadmin create a new “wordpress” database, but need to add a name for a Database, and the # of fields.

    I can send you an ImageShack photo of what happens if you would like.

    It has been a while since I have run LAMP on my machine, as I have gone to hosted services. However, to play with WordPress I think that I need to run it locally.

    I think that you know what I mean.

  16. Hello supriyadisw
    I have another question. Everything is working fine using Localhost/mywordpress in my browser. my machine is on my home network with 2 other computers. I would like to be able to access wordpress from one of the other computers on my local network I type in which is the IP address that has wordpress on it. so I type and get the following error
    Warning: Cannot modify header information – headers already sent by (output started at /var/www/mywordpress/wp-content/themes/beautiful-sunrise-10/functions.php:72) in /var/www/mywordpress/wp-includes/pluggable.php on line 391

    line 391 is: header(“Location: $location”);
    I also have joomla installed on the same machine and I can access it using why can’t I access wordpress?
    Thank You
    PS I am not worried about security this is a private home network.

  17. JJMacey: Could you send the screenshot to my email please?

    Mel B: Hi, I think you got problem with beautiful-sunrise-10 theme. Try to use default theme instead. let me know if your error still exist.

    Thanks a bunch

  18. Yes I think you are right. I went back to the default theme and it worked OK. will have to try other themes to see if I have the same problem.
    Mel B

  19. Ubuntu has WordPress in their repositories and it installs by default to /usr/share/wordpress.

    I had to make a symlink from /usr/share/wordpress to /var/www/wordpress

    sudo ln -s /usr/share/wordpress /var/www/wordpress

    I also had to create a dummy file called /etc/wordpress/config-localhost.php so the install would proceed. Ubuntu has some script in /etc/wordpress/wp-config.php that says “do not edit” and that requires this file, so I added the lines that set up MySQL and left the others alone.



  20. hello Cody
    I also am aware of the Ubuntu wordpress and have used it But it is a older version in the ubuntu repositories and not the latest one.also there is a very good easy to follow tutorial in the ubuntu community on how to install it for local use or as a remote. Between it and supriyadisw tutorial you can do about any type of installation of wordpress on Ubuntu.

  21. supriyadisw,

    I’ve taken a screen shot of what I mean by “Naming” a MySQL data base, and “Number of Fields”. It seems that I need to do this before I can set-up a “wordpress” data base, then run WP.

    I’ll send you the shot of my Desktop via e-mail. As of right now then I run http://localhost/wordpress/ I get this.

    There doesn’t seem to be a wp-config.php file. I need this before we can get started. Need more help? We got it. You can create a wp-config.php file through a web interface, but this doesn’t work for all server setups. The safest way is to manually create the file.

    Thanks in advance for your response.

    Phoenix, Arizona

  22. JJMacey: Thanks for email me. I think you need to create wp-config.php manually. You can copy wp-config.php from wp-config-sample.php. Then you need to edit the file to match with your database information.

    // ** MySQL settings ** //
    define(‘DB_NAME’, ‘wordpress’);
    define(‘DB_USER’, ‘root’);
    define(‘DB_PASSWORD’, ”);
    define(‘DB_HOST’, ‘localhost’);

    That configuration should works for the default mysql server on ubuntu. Then try to open your local wordpress http://localhost/wordpress.

    Gud lak!

  23. supriyadisw,

    I did get WP installed on my local machine. I first installed Drupal because I had successfully done that before, then remembered what to do.

    Basically, I ignored the MySQL request to add a name and number of tables to my new wordpress database. Then edited wp-config-sample.php with the needed information and saved it as wp-config.php. All good now!

    Thanks for your help! Now that I have a “clone” of my hosted WP Blog @ on my machine I want to edit the Theme and Image.

    Do you know any good tutorials?

    Again, thanks for the exchange here.


    Phoenix, Arizona

  24. Wow I managed to get WP running on VMWARE!

    I used a very cool VMware image by the The Canned OS Project called “Grandma’s LAMP”. Its essentially a VMWARE “appliance”/ disk image (xubuntu) fully set up with all the LAMP stuff you need to get going. Just a matter of untaring WP and adding the data base with phpmyadmin!

    Check out all the details at

    Note: I’m not linked to the canned OS project – I’m just a newbie whose’s thrilled to bits that I got WP running on my own machine using “Grandma’s LAMP”

  25. Hi i have wordpress installed and it all works great from inside my network, but when i try to connect from the internet the page loads fine but all the post links and such are still using the internal address. How can i fix this?? Thank you.

  26. hi i am having trouble where i am supposed to point my browser to the install file.

    its telling me the file is not present on my server, but i can physically go in and see it.

    this is the second time i am installing wordpress on my machine for a project and any help is greatly appreciated, i am on a time frame


  27. I tried to install wp but something failed. I have downloaded wp to my desktop but when i try to extract it to my server directory I get this message. I write sudo tar zxvf wordpress-x.x.x.tar.gz –directory=/var/www/ in my terminal and get this message in return.
    tar: wordpress-2.5.1.tar.gz: Cannot open: No such file or directory
    tar: Error is not recoverable: exiting now
    tar: Child returned status 2
    tar: Error exit delayed from previous errors

    What should I do?

  28. hello i have installed wordpress on mysql on ubuntu and everything went fine but today when i want to log in again i forgot the password so what can i do ?

  29. I’m also running on ubuntu. I have made symlinks to /var/www/ and to public_html in my home directory. The latter is the only way I could get it to show up at http://localhost/wordpress/ But when I point to http://localhost/wordpress/wp-admin/install.php, I get the following errors:

    Warning: require_once(/etc/wordpress/wp-settings.php) [function.require-once]: failed to open stream: No such file or directory in /etc/wordpress/wp-config.php on line 20

    Fatal error: require_once() [function.require]: Failed opening required ‘/etc/wordpress/wp-settings.php’ (include_path=’.:/usr/share/php:/usr/share/pear’) in /etc/wordpress/wp-config.php on line 20

    Any suggestions?

  30. ok. I had to remove a symlink from /usr/share/wordpress/wp-config.php to /etc/wordpress/wp-config.php.

    Then it worked!

  31. Hi. I followed your instructions and I got my wordpress server running so I can access it locally via http://localhost/wordpress, but I cannot access it via another computer on the network even though I can get to the default Apache test page by going to But when I try to go to, I get a 104 error, unable to connect to server. What do I need to do to get access to my blog from the outside? Thanks.

  32. hi, I’m almost there but there’s a big gap in your guide at the “Prepare MySQL Database for WordPress” part, it doesn’t tell you how to do that at all and now I’m stuck.

    I followed the LAMP guide which worked fine, but without including a guide on how to configure mysql for wordpress other than create a db for wordpress’ I’m totally stuck. how do i create a db for wordpress?

  33. I’m stuck with the MYSQL part of this procedure.

    “Prepare MySQL Database for WordPress

    Create a database for WordPress on your Ubuntu, as well as a MySQL user who has all privileges for accessing and modifying it. You can use phpMyAdmin to make it easier 😉

    * First create dababase: wordpress
    * Then create a new user: wordpress with password: wordpresspassword

    Write down the values you used for databasename, wordpressusername, hostname, and password for future purpose 😉 ”

    I created a new database ok.

    Something went wrong when I created the user, so when I go to the install script I get an error message telling me the username or password is incorrect.

  34. Thanks for the info, it help me alot with with WP installation.

    BTW, what plugin are you using for your “solcial share” bar. ie the digg it, facebook it, google etc.

  35. William wrote, about a year ago:

    The extraction of WordPress didn’t work for me at first using
    “tar zxvf wordpress-x.x.x.tar.gz –directory=/var/www/”.

    By prefacing the command with “sudo” it worked first time.

    You can get around this by creating a group, call it ‘wordpress’ if you like but any name will do. Make your user account a member of that group, then change ownership of /var/www and its files and subdirectories to the same group. Now you can manipulate anything in /var/www without needing root access.

    Note: I do not advise this on computers that are not secure.

  36. good day,

    I’m following your tutorial but I got an error that I cannot resolve or find a resolution somewhere. When I try to run the install script, using a browser at http://localhost/wordpress/wp-admin/install.php , I got this fatal error message:
    “Call to undefined function is_admin() in /var/www/wordpress/wp-admin/includes/comment.php on line 159”

    did someone run into that problem before and know a solution? I’m a complete beginner with wordpress!

  37. Hi, i tried the tutorial. it worked smoothly for me. It was really great.
    Though there is problem after that: i tried installing a theme but i get an error or rather warning message :
    Warning: file(/var/www/wordpress/wp-content/themes/magzine/style.css) [function.file]: failed to open stream: No such file or directory in /var/www/wordpress/wp-includes/theme.php on line 180

    Warning: implode() [function.implode]: Bad arguments. in /var/www/wordpress/wp-includes/theme.php on line 180

    now when i preview the page, i don’t get anything. How do i rectify it ?

  38. i was downloaded lamp and i finished download. but i have a wordpress page how can i edit it from my localhost ?thank you for directions .

Leave a Reply

Your email address will not be published.


Latest from Blogging


Web Hosting

Web hosting is one type of Internet Hosting service which makes the
Go to Top