WordPress Installation on Ubuntu with LAMP

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!

  • Pingback: Planeta Ubuntu » WordPress Installation on Ubuntu with LAMP()

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

    Now when you try http://yourblog.com 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 http://yourblog.com

    Of course, when you want to refer to your blog which is not local, you will type http://www.yourblog.com

  • kus

    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.

  • 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.

  • Pingback: Planeta Ubuntu » WordPress Installation on Ubuntu with LAMP ? supriyadisw dot net()

  • William

    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.

  • Hi William, thanks for ur correction. Thanks a bunch!

  • I wonder if I can do the exact same thing in SLES10, without phpmyadmin. I want to install WP on our office. Any advise?

  • tyleestuff

    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.

  • Hi tyleestuff, you should install MySQL first. Please view my post about MySQL installation in LAMP Installation On Ubuntu.

    Have a great day and gud lak!

  • Pingback: My New Direction » Blog Archive » Installing WordPress on Ubuntu LTS()

  • Tyler

    Awesome. Helped me A LOT!

  • 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…

  • Pingback: WoProt()

  • Hello your post is delightful. I will definitely read your blog.. bye

  • Pingback: LAMP + WordPress Installation On Ubuntu Linux - Quick Tutorial()

  • 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.

  • Brian

    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(http://www.joinerfam.us/blog/wordpress/). Any suggestions?

  • Ken

    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 ;^)

  • Mel B

    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?
    http://www.apachefriends.org/en/xampp.html 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

  • 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 😉

  • Mel B

    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

  • 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…

  • Mel B

    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

  • 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.

  • 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.

  • 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

  • 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

  • Coby

    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.



  • 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.

  • Coby: Thanks for sharing.

    Mel B: Yes, You’re right 😉

  • 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

  • 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!

  • 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 @ wwww.jjmacey.net/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

  • 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”

  • Adam

    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.

  • evilbuntu

    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


  • I can’t install it for some reason. I’ll post the error later today.

  • Pingback: Installing WordPress « Klikvnet99’s Weblog()

  • Pingback: Installing WordPress()

  • sielkentjakk

    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?

  • sielkentjakk


    I write sudo tar zxvf wordpress-2.5.1.tar.gz –directory=/var/www/ in my terminal

  • sielkentjakk

    wrong again.

    I write:
    sudo tar zxvf wordpress-2.5.1.tar.gz –directory=/var/www/

  • Pingback: Inanis.net » Blog Archive » WordPress is cool…. and IE6 renders this blog incorrectly.()

  • ginoxy

    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 ?

  • Amber

    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?

  • Amber

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

    Then it worked!

  • Great! Thanks for sharing 😀

  • Thanks much. I was following this https://help.ubuntu.com/community/WordPress but yours did the trick. 🙂

  • Andrew

    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.

  • Wonderful set of instruction. Thanks a lot

  • SCP

    Great write up!! What is the command to extract the WP filed directly to your root directory? I have tried numberous commands, but it keeps creating the directory “/var/www/wordpress”. I want my site to be http://www.example.com, not http://www.example.com/wordpress.


  • Pingback: Installing WordPress | Guide for Blogs and Wordpress()

  • Pingback: WordPress Installation Techniques | Guide for Blogs and Wordpress()

  • Pingback: Techie Haven » My forray into LAMP and setting up my own wordpress site()

  • 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?

  • Pingback: technology idea » Blog Archive » why william, why?()

  • Mike

    Hi everyone,

    If you are having problems with:

    Did you…

    This page has your answer:
    I’ve searched long and hard, but this is atested, working, fully functional method.. dated 12/11/08. Do it. You’re welcome.

  • 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.

  • Pingback: Blog->Dimitrovski » Blog Archive » WordPress na Linux-u - odnosno Ubuntu/Kubuntu-u()

  • 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.

  • Pingback: Moving From Blogger To Wordpress - Maintaining Permalinks, Traffic & SEO()

  • Michael

    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.

  • Pingback: Desktop Diary with LAMP and WordPress « Strug’s Blog()

  • Alain

    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!

  • Pingback: Finally Installed! WordPress! Phew!!!!! « Ubuntu Tips and Tricks()

  • 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 ?


  • I like the tutorial, thanks for making it.

  • Is LAMP from the same makers as WAMP?

  • I think dis post is goin to be useful

  • Pingback: 5 Steps for Wordpress Preparation | RepeatGeek()

  • Pingback: ????????? WordPress ?? ????????? ?????????? « ???????????? ????()

  • I am now moving on to ubuntu from windows thanks for informational post.

  • Pingback: Blogger to WordPress « Vbloginfinity's Blog()

  • Pingback: ????????? Wordpress ? ??????? | intelligent fitness()

  • Pingback: WordPress???? | ????()

  • umuthvr

    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 .

  • Pingback: WordCamp Chile 2010 » Abiertas inscripciones a Talleres()