Install WordPress Locally on Ubuntu Linux with LAMP

Posted by Mani On July - 14 - 2010

wordpress logo Install Wordpress Locally on Ubuntu Linux with LAMPUndoubtedly, WordPress is the best softwares available for blogging. The ease with which you can manage it, is uncomparable to any other blogging platforms. These days, for self-hosted wordpress users, the webhosting companies provide one-click installers for wordpress, but there are times when you need it, installed on your computer locally.

The reasons may vary from regular users to test themes, to developers for theme designing and plugin development. This tutorial is intended to make a Linux user capable of installing WordPress on the localhost.

Dividing the complete process into tasks will make it easier for everyone to understand, so, lets begin!

#1. Lamp Installation

To have wordpress running on local host over Linux, you must setup a lamp server first. A web server is necessary to run a website, and so is the role of LAMP. We have already posted a tutorial on lamp installation.

#2. Download and Extract WordPress

Once you complete the setting up of web server over localhost, you can download the latest version of WordPress from official WordPress website.

After downloading WordPress (.zip or .tar.bz ), extract it in a folder (say wordpress) on your desktop and move the WordPress folder inside the /var/www/ directory. (You should have all the files inside /var/www/wordpress/). Your installation url will become http://localhost/wordpress/ where you can have access to your WordPress.

You can use the following command to extract it directly to /var/www/ . Choose the folder accordingly.
sudo tar zxvf wordpress-x.x.x.tar.gz --directory=/var/www/

#3. Create MySQL Database for WordPress

Create a new database for wordpress installation. You can use phpMyAdmin will make it simpler for you. Create a database with the database name wordpress, then create a new user: wpadmin with all privileges and password passwp.

If you are a linux terminal lover, then use the commands to create the database with username and password as mentioned above. In the linux terminal, type command mysql -u root -p and enter mysql’s root password when prompted. The, type these commands one by one (after mysql> ):

create database wordpress;
grant ALL PRIVILEGES  on wordpress.* to wpadmin@localhost identified by 'passwp';
flush privileges;
exit;

And a new database wordpress will be created with username wpadmin with all privileges and password passwp. Make sure you note down the username, password and database name.

Note: If you face problems to open WordPress url, then you must change permissions for /var/www/wordpress with this command as root:

chmod -c 777 -R /var/www/wordpress/

#4. Create Configuration File

Configuration file creation can be done manually or with the wordpress installation. To create the configuration file manually, open wp-config-sample.php and save it as wp-config.php after pasting the following lines of code:

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

The information added above is simply your database name, username for database access and password. Do not forget to save the edited file as wp-config.php, as mentioned above.

You can also create Configuration file while installing wordpress by running installation script first. Provide your Database name, Username for database and Password and give host to localhost. Same as we did manually. You may change Table prefix if you want to have more than one WordPress installation for same database otherwise leave it as it is.

#5. Install WordPress

Run the wordpress installation script by pointing your browser to http://localhost/wordpress/wp-admin/install.php. You are now one step away from installing WordPress locally on linux with LAMP!

Set the username and password for wordpress backend, where you will add and edit your posts. That’s it! You can login to wordpress backend at http://localhost/wordpress/wp-admin/ and to preview your new wordpress http://localhost/wordpress.

Good job! You have successfully installed wordpress on local server in linux in 5 simple steps.

Let me know if you face any problems during installation.

Suggested reading:
Convert Default Online Dictionary to Offline in Ubuntu 10.04 or Later!
Ubuntu comes with the default Dictionary, that can be accessed from the pathways “Applications → Office → Dictionary”. The only problem associated with it is that, it's an Online Dictionary, ...
READ MORE
Install LAMP on Ubuntu Maverick and Lucid with One Command
This is probably the simplest way to setup LAMP Server on Ubuntu. It's a single command based installation which allows you to install Apache web server, mysql, php on a ...
READ MORE
How to: Setup LAMP on Ubuntu
Web Server- To setup a web server and to run a website on a system(localhost) you have setup LAMP or WAMP first. If you are a Linux user, you have ...
READ MORE
LibreOffice 3.3 Stable Released; How to Install from PPA
The Document Foundation has launched the first stable release of LibreOffice, the free and Open Source office suite, forked from OpenOffice. The first release, LibreOffice 3.3 has been developed by ...
READ MORE
Install GIMP 2.6.11 in Ubuntu 10.04 & Ubuntu 10.10 from PPA
GNU image manipulation Program, commonly known as GIMP is a multi-platform tool to edit, compose or manipulate images. This free tool is one of the top competitors to Adobe Photoshop, mostly ...
READ MORE
Install VirtualBox 3.2.10 in Ubuntu 10.10 from Repository
Now that Ubuntu 10.10 Maverick Meerkat is available, there are some applications worth installing on your system. One such application is VirtualBox. Its a multi-platform software package; in case you ...
READ MORE
Ubuntu Radiance Theme for Google Chrome Looks Cool
You may have tried the Radiance to theme up Linux in Ubuntu. The light colored theme gives a cool look to the distro, but if you use Google Chrome as ...
READ MORE
Clementine 0.5 Released; Amarok 1.4 Inspired Cross-Platform Music Player
Clementine is a music player for Linux, Windows and Mac OSX users, inspired by Amarok 1.4, providing users with a fast and easy-to-use interface for searching and playing your music. We already ...
READ MORE
Convert Default Online Dictionary to Offline in Ubuntu
Install LAMP on Ubuntu Maverick and Lucid with
How to: Setup LAMP on Ubuntu
LibreOffice 3.3 Stable Released; How to Install from
Install GIMP 2.6.11 in Ubuntu 10.04 & Ubuntu
Install VirtualBox 3.2.10 in Ubuntu 10.10 from Repository
Ubuntu Radiance Theme for Google Chrome Looks Cool
Clementine 0.5 Released; Amarok 1.4 Inspired Cross-Platform Music

Article by

Mani is a coder passionate about working in open-source projects. You can follow him on Twitter or Join him on Facebook

Mani has written 30 articles for us at TechTickle.

33 Responses to “Install WordPress Locally on Ubuntu Linux with LAMP”

  1. Rahul says:

    Thank you Mani for this wonderful and a useful post :) This is what I might have looked for in near future as I have now started using Linux as primary OS ! thanks :) will install it ASAP :) keep up the good work.

  2. NCJames says:

    Great post! :D

    Micronations

  3. WP Themes says:

    Amiable post and this fill someone in on helped me alot in my college assignement. Say thank you you seeking your information.

  4. aniel says:

    Thank you so much, I got it right just by following your instructions!

  5. Track Lighting Kits  says:

    wordpress is the best blogging platform ever-”,

  6. WordPress is definitely the best blogging platform, no one can beat wordpress.:`

  7. Matthias says:

    Hey, great instructions. With your step-by-step run-through of LAMP and WordPress installation, I could easily set up my localhost and install WordPress on it. Now there’s just one thing that keeps me from enjoying it: whenever I try to install themes or plugins, or delete them, it asks me for my FTP credentials to proceed (Hostname, FTP username, FTP password).

    Do you know why this happens? Shouldn’t it not happen at all, since I’m running a localhost?

    • Mr. Tickle says:

      Hi Matthias, thanks for the feedback. The solution to your problem lies with the permissions of folders where you’hv installed WordPress. I suggest you to make it 777. May be you missed one command from the tutorial..
      chmod -c 777 -R /var/www/wordpress/

      Let me know if there are issues. Thanks!

      • Nikola says:

        I have the very same problem and did run the permission line. They are still no updating. I also do not have the LAMP installation but installation of apache and mysql. Could that be the problem ? Any idea how can I fix it? By the way great tutorial, I will be definitely back for more.

        • Craig says:

          You could pass it host of 127.0.0.1:(your FTP port#) with root username and password–that would probably do the job and it shouldn’t have any major security concerns if you’re just using it as a local dev server. Hopefully someone more knowledgeable than I will weigh in and correct me if I’m mistaken.

  8. j3rg says:

    Sweet, simple and nice article keep up the good playa

  9. Richard says:

    Hi
    I have WP installed on my localhost server (Lampp) on Ubuntu10.04
    & cannot install plugin as I get:
    To perform the requested action, WordPress needs to access to your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.
    Hostname
    FTP Username
    FTP Password
    Connection Type
    Connection Type FTP FTPS (SSL)

    Now I forget the details! (except localhost server!)

    I tried chmod -c 777 -R /var/www/wordpress/ at terminal but I still get the error message!

    So I am stuck & I may have to delete the whole thing & start again! Oh dear!!

    I didn’t use your instruction to install WP in the first place but it seems a great tutorial-thanks
    (I am a linux/ubuntu newbie-I do have Xampp localhostserver running on a Vista PC & that is all fine! :-) )

  10. RobertR says:

    Hey!
    I bet, that chmod right operator might be recursive -R option, but this does not help…

    Any solutions without installing odd FTP server. Does OpenSSH works for this?

  11. Thank you so much mani!! It was easy peasy lemon squeezy!

  12. Onirik says:

    I had the same error message with chmod -c 777 -R /var/www/wordpress/
    So i put sudo before and it was good…

    sudo chmod -c 777 -R /var/www/wordpress/

    Now i’m stuck with the FTP and plugins install

  13. Right. WordPress is working. I can write posts, and if I go to my wordpress home in my browser get my main page.

    However, none of my other pages appear (Get a not found error). I don’t really know what’s going on! It seems like the server isn’t set up to redirect the URL to the post.

    Any ideas?

  14. MBRedline says:

    I’m getting the same thing that a lot of people here are having

    Hostname: ___________
    FTP Username: _______
    FTP Password: _______

    I have tried every username and password combination that I have used on anything since installing LAMP and WP

    So I am thinking I may have the host name wrong … I thought it was “localhost” is that not correct?

  15. Nancy says:

    I’ve install LAMP and install wordpress in localhost ubuntu, but why the error message deprecated in wordpress, how to handle it?

  16. Robert says:

    Finally found the answer here is the fix and the website:desk.stinkpot.org:8080/tricks/index.php/2009/01/wordpress-wants-ftp-information-to-update-plugins/

    wordpress wants ftp information to update plugins

    January 30th, 2009 by Lawrence David

    if you get these errors when trying to have wordpress automatically update your plugins:

    “To perform the requested action, connection information is required”

    “Failed to connect to FTP Server“

    try making sure that your webserver owns your wordpress directory. i fixed everything by going to the root of my wordpress directory and entering:

    /home/wordpress/> sudo chown -R www-data:www-data *

    This fix worked like a charm for me no more ftp message yeah !

  17. Prithvi says:

    I just installed LAMP and wordpress following your instructions. EVerything worked fine but when I opened http://localhost/wordpress showed me BLANK screen. Please help :(

  18. Brad says:

    This was extremely useful for me. Thanks a bunch! I appreciate the effort you put into this!

  19. SmugAdmin says:

    I am pondering and searching for a scanner which will be beneficial for hand drawn animation.

    I need it to… :

    be compatible with linux

    be quick

    great for scanning a lot of drawings

    NOT distort or alter the quality of my drawings as I want to put the drawings into finished animation.

    I am basically looking for a scanner which will work for my operating system; Ubuntu Linux, and give me the professional quality which you see with television aired 2d animation shows.

  20. ashutosh says:

    thanks mani , ur instructions regarding installation of wordpress is very simple and useful for me.

  21. toto says:

    i followed your guide but http://localhost/wordpress/ always gets me a 404 error that it cant find it.
    are you sure i dont need to create virtualhost or modify other apache settings?
    i am using fedora 16

Leave a Reply

About Me

Welcome to TechTickle! A blog that features Latest technology news, Linux tutorials, Updates related to Social Media, Website & Software reviews and Open Source. We are a group of ordinary individuals, with an extra ordinary quality of sharing our passion and, reaching out to the people in nook and corner. Read more About TechTickle!

Twitter

    Subscribe to E-mail Updates: