Install WordPress Locally on Ubuntu Linux with LAMP
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.
Subscribe to TechTickle Feed | Join us on Facebook Page | Follow us on Twitter!



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