![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWh-_kFRdl_e-J8ayPCK_TCOD5vikrcqWzyLcUbEzn9shQdu121QjNCT65ss8neuLqADtGx52yHZxxeMD2gO-bWfi3B3iJkHbNIWFCQfP-i8VbfCu2Y11ZUHAiUrUZz4mecONhtECTuwAR/s1600/ubuntu-wordpress.png)
In this guide we will show you how to install the latest WordPress version locally on a system running Ubuntu 11.10 (Oneiric Ocelot) or Ubuntu 11.04 (Natty Narwhal). To be able to install WordPress on Ubuntu, you need first to install a web server supporting PHP and MySQL. You can findhere a tutorial explaining how to install LAMP (Linux, Apache, MySQL, PHP) on Ubuntu.
WordPress Installation
1. Download first the latest WordPress version (currently v3.2.1) using this command from the terminal:
wget http://wordpress.org/latest.tar.gz
2. Extract the archive file with this command:
tar -xzvf latest.tar.gz
3. Create now a folder for WordPress in the /var/www directory using this command:
sudo mkdir /var/www/wordpress
4. Now move all WordPress files to this created folder using this command:
sudo cp -r ~/wordpress/* /var/www/wordpress
5. If you are installing WordPress in a subdirectory not in the root directory (/var/www), then edit the apache2.conf file with this command:
sudo gedit /etc/apache2/apache2.conf
And at the end of the file, insert this line:
AddType application/x-httpd-php .html
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYsceNVhaAN4OLtJiiLVRY2urjdc27_lgKetvsU5Mm2ZQuCoUgJCg63uHKOop0pqZKFIJ03awvECt1RBWBYvAhCIwnb0L_S8Rf37OP4XYTaOzpVzXuup14rGdTbechKBzzYp8WmxLx_rnU/s400/apache2.conf-edit.png)
Save the file and close it.
6. Restart now Apache with this command:
sudo /etc/init.d/apache2 restart
7. Now we need to create a new MySQL database with a user having all privileges for accessing it. These details will be then inserted in the config file for WordPress. To create a new database, you may use phpMyAdmin, or simply run this command to login to the MySQL server (use the password you assigned to your MySQL server during LAMP installation):
mysql>
8. Create now a new database with this command (replace WordPress with any other name of your choice):
CREATE DATABASE WordPress;
If the command is successful, the returned output will be similar to this:
mysql> CREATE DATABASE WordPress;
Query OK, 1 row affected (0.01 sec)
9. Add now a new user with this command (replace "username" with any name of your choice):
CREATE USER username;
10. Assign a strong password to this new user with this command (replace "123" with your own password):
SET PASSWORD FOR 'username' = PASSWORD('123');
11. Grant now this user all privileges for the created database with this command:
GRANT ALL PRIVILEGES ON WordPress.* TO 'username' IDENTIFIED BY '123';
- WordPress --> Replace it with the name of the created MySQL database.
- username --> Replace it with the username you have just created.
- 123 --> Replace it with the password you assigned to the MySQL user.
12. Once you finish, run this command to exit the MySQL server:
exit
13. Rename now the wp-config-sample.php file to wp-config.php using this command:
sudo cp /var/www/wordpress/wp-config-sample.php /var/www/wordpress/wp-config.php
Note: If you are installing in another directory, then correct the given path to your own.
14. Edit now the wp-config.php file with this command:
sudo gedit /var/www/wordpress/wp-config.php
Insert now your MySQL settings you have just created by replacing:
- database_name_here ---> with the database name you have created. For this tutorial, it's named "WordPress".
- username_here ---> with the MySQL user you have created earlier.
- password_here ---> with the password you assigned to the MySQL user.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwkrBVcmbEsFxSmDGaunz0xlDZWUdCDcGoI0klwn-mWlQQIjrRqkZUIFaDDbgutb9VFoRuDt5exqfIntDYF5RkRq9PFPwAzTn-YeuJDGgYHls-FntfV4bup7SqH4vQT0PkuTEUKF5S4nJ3/s400/wp-config.php-edit.png)
Save your file and close it.
15. Open now one of these two links to set up your WordPress admin details (you will be redirected automatically):
http://localhost/wordpress/
or
http://127.0.0.1/wordpress/
16. Fill now in the following web forms, then click Install WordPress:
- Site Title
- Username
- Password
- Your E-mail
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEG4FiBneAR4drsE181bblb7lYOwhFiJ6bhR10UAf5eAA7XDdA_fWarrhcL8Ns0wUY6UQ3_RuQmnE4cP9VJnivJxw-JynoYKaYxepkGj7x9Pe9hLPGhWtvAKu2qQXhL3F5RaxoIfy08GX6/s400/admin-details-WP.png)
17. Login now to the admin section using the password you selected to start managing your blog:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0oogtoe_22VCFBu2SKyQl-1vnS2WPIg3aLeAtfTJz4XBcG0MiBETmZ5lrmTzgsAviXuKha-i4crRywUzcOi040723CrF7zt2gSXndx3TBudh_FoluaWdSC3KnlbzIkgF2uaU-BLf8QbCl/s400/login-admin.png)
18. Congratulations! Your WordPress blog is now successfully installed. Your blog is live at this link:
http://localhost/wordpress/
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpHf8InGSiAyJrg5Xto2ZARtMoBU_2LukVKZVRn_WgKO4rPeDEn7gjiyJN-aPz2y-3bo5dB3uBpUm03VcHjSR2MeN6Rc51WMkJOEtZ3DX22mJRkFybQ3TgEr4uy88zhqxnxGJH8Z3Gdg1j/s400/wordpress-live-oneiric.png)
The admin section can be accessed here:
http://localhost/wordpress/wp-admin/
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMlRa782GBacwjkIqzy8yLh-5E69-pcHPEY5qM4MhYD5brY-BgzwqJmIxPXjylxyLIAszE1u_tXBzUrDJ-CFAfY6b4Qwh5NPcHpH7XmmNg45_7kCiimoU94ZFIKpiUOZISR2gAhDcCgkB5/s400/admin-section-WP-oneiric.png)
That's it.