Undoubtedly, 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;
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.

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.
glad u like it rahul. Keep coming back for more
just installed and works great
thanks !
Would I be able to share this site with the other computers connected to my home network as well, or is it just visible from my computer?
Great post!
Micronations
Thanks! Keep visiting
Amiable post and this fill someone in on helped me alot in my college assignement. Say thank you you seeking your information.
Glad to know that it was useful!
Thank you so much, I got it right just by following your instructions!
You’re welcome Aniel. Keep visiting for more!
Thanks for the comment
wordpress is the best blogging platform ever-”,
WordPress is definitely the best blogging platform, no one can beat wordpress.:`
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?
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!
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.
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.
Sweet, simple and nice article keep up the good playa
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!
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?
Thank you so much mani!! It was easy peasy lemon squeezy!
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
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?
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?
Hi. Try using 127.0.0.1 for hostname. Username and password should be your ubuntu account.
@Tan Wei Song Beck,
many thanx for your help
it works!! \:D/
Awesome man that worked perfect.
I’ve install LAMP and install wordpress in localhost ubuntu, but why the error message deprecated in wordpress, how to handle it?
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 !
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
This was extremely useful for me. Thanks a bunch! I appreciate the effort you put into this!
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.
thanks mani , ur instructions regarding installation of wordpress is very simple and useful for me.
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