you're reading...
Blog, Wordpress

Install and Host WordPress On Ubuntu 12.04 LTS

WordPress is a content management system that powers quite a variety of websites, first developed in 2003. In WordPress’s early days, it tended to run only personal blogs and smaller sites. However, the software improved considerably with every version, and it’s adaptable enough to be used for a variety of different sites. WordPress’s big break came in 2009 when popular blogging platform Movable Type changed its licensing terms. Enough Movable Type users were annoyed with the change that they migrated to WordPress, and WordPress is the dominant open-source content management system on the Internet as of this writing.

In this tutorial I will show you how to install five pieces of software: the Apache web server, the MySQL database server version 5.1, PHP version 5, the MySQL module for PHP, and finally the WordPress software itself.


It’s quite possible to install WordPress on a machine running either the desktop or the server version of Ubuntu 12.04 Precise Pangolin. This makes an excellent environment for testing and experimentation, since you can tweak and experiment to your heart’s desire without rendering your production blog inoperable. If you need to run an internal corporate blog of some kind, hosting WordPress on an Ubuntu box or virtual machine is a cheaper solution than more expensive blogging or collaboration software. Or, if you’re really ambitious (and you can afford the bandwidth), you can host an Internet-accessible WordPress blog out of your apartment.

(Note that the Ubuntu repositories now contain a fully automated WordPress installation. However, I believe that installing it by hand yourself has significant value – you’ll not only learn how to set up a LAMP server, but installing step-by-step gives you valuable troubleshooting knowledge later on in case something breaks.)

First, install Ubuntu into your machine of choice. Once Ubuntu is installed and updated, you will need to install five pieces of software: the Apache web server, the MySQL database server version 5.1, PHP version 5, the MySQL module for PHP, and finally the WordPress software itself.

First, install the Apache web server. To install Apache, go to a Terminal window or a command prompt and type this command:

sudo apt-get install apache2

(Technically, you’ll be installing Apache 2, the latest version.)

Enter your password to authenticate, follow the default prompts, and apt will download and install the Apache web server for you.

And that’s it! Apache should now be working. To test it from the web server itself, go to a web browser and visit the address . Alternatively, you could test it from another computer on the same subnet. For instance, if you installed Apache on a computer with an IP address of, you could test it by going to another computer on the same subnet and visiting http://192.168.100 from the web browser.

Regardless, if Apache is working properly, you should see a web page with only two words on it:

It works!

Apache is now operational.

The next step to install WordPress is to install the MySQL database server. Return to the Terminal and type this command:

sudo apt-get install mysql-server-5.1

(As of this writing, MySQL Server version 5.1 is the latest version available in the Ubuntu repositories, though future versions of Ubuntu may receive the newer versions of MySQL.)

Enter your password to authenticate, and apt will download the MySQL files and install them for you. It’s a big set of files, so depending on the speed of your Internet connection, it might take a while to download. After the files are downloaded and are installing, the installer will ask you for a password for MySQL’s root user. Just like the root user in Linux, the root user in MySQL has absolute control over all databases, tables, permissions, and users. For obvious security reasons, you’ll want to create an extremely strong password (a mixture of uppercase, lowercase, numbers, and punctuation, the longer the better) for your MySQL root user.

(Note that in the password dialog box, you can’t get the <OK> field selected, you can use the tab key to jump from the text input line to the <OK> field.)

After you enter the root password, the installer will finish working with the MySQL files, and return you to the command line. You’ll then need to activate MySQL with the following command:

sudo mysql_install_db

This will set up MySQL Server for use with your Ubuntu system. Next, you’ll want to run the mysql_secure_installation script to tighten up security on your new MySQL server. Run this command from the prompt:

sudo mysql_secure_installation

First, the mysql_secure_installation script will ask you to enter the current password for the MySQL root user. After you do that, it will ask if you want to change the root password. Since you already set a root password, you can hit “n” (unless you want to change it again for some reason).

Next, the script will ask if you want to remove the anonymous user. The anonymous user, like anonymous access in FTP, lets someone log into MySQL without having a proper user account. For security reasons, it’s always best to remove the anonymous user, so hit “y” to continue.

After that, the script will ask if you want to prevent the MySQL root user from logging in remotely to the MySQL server. Always hit “y” to forbid root remote access, since if an attacker guesses your root password, he can destroy your databases or steal the information they contain.

After this, the script will ask if you want to remove the test database. MySQL includes a test database that anyone can access. Again, this is a security hole, so you’ll want to hit “y” to remove the test database.

The script will then ask to reload the privilege tables so the changes take effect. Hit “y”, and the mysql_secure_installation script will conclude and return you to the command line.

MySQL server is now installed on your Ubuntu system.

The next step to installing WordPress is to install PHP version 5:

sudo apt-get install php5

Then install the MySQL module for PHP:

sudo apt-get install php5-mysql

You may also want to install the GD library for PHP, since many WordPress plugins rely on it for graphical manipulation:

sudo apt-get install php5-gd

Finally, download the WordPress software to your Desktop. You can obtain it from this address:


If you’re working exclusively from the command line, you can use this command to download the WordPress software:

wget http://wordpress.org/latest.tar.gz

Use this command to unpack the WordPress files:

tar -xzvf latest.tar.gz

Make a directory in /var/www for the WordPress files:

sudo mkdir /var/www/wordpress

Finally, move the WordPress files over to the /var/www/wordpress directory. (In this command, I’ll assume you unpacked the WordPress files to your home directory; you will have to adjust the command if you unpacked them in a different directory.)

sudo cp -r ~/wordpress/* /var/www/wordpress

Now that we’ve got our software installed and downloaded, we’ll need to configure it. We’ll start with Apache.

First, it’s always a good idea to make a backup of a system configuration file before you alter it, so start by making a back of Apache’s configuration file. Use this command to back up Apache’s configuration file to your home directory:

cp /etc/apache2/apache2.conf ~

Next, you’ll need to add a line to your /etc/apache2/apache2.conf file, so Apache will properly interpret WordPress’s PHP files. (Note that this is only necessary if you install WordPress in a subdirectory of /var/www, as we are doing in this example. If you install WordPress in /var/www, you don’t need to add this line, but you do need to delete or move the original index.html file.) To edit apache2.conf, fire up the vi editor:

sudo vi /etc/apache2/apache2.conf

Once you are in vi, scroll to the end of the vile, switch to Insert mode, and add the following line:

AddType application/x-httpd-php .html

Return vi to Command mode, save the file, and then exit vi. Restart Apache with this command, so it re-reads its configuration file:

sudo /etc/init.d/apache2 restart

Now we’ll need to prepare MySQL for use with WordPress. WordPress requires a database and a database user, and full permission for its database user to access its database. To start the MySQL command-line client, use this command:

mysql -u root -p

Enter the password for the MySQL root user, and you’ll find yourself at the MySQL command prompt, which will look like this:


Our next steps are to create a WordPress database, create a user to access that database, and grant our new user all rights to the WordPress database.

(An important note before we continue, though. All commands made from the MySQL prompt must end with a semicolon to denote the end of the statement. Any commands that do not end with a semicolon will not work. With that in mind, let’s first create a database.)

To create a database for WordPress, use this command at the mysql> prompt:


The MySQL client will respond with a message that should say “Query OK, 1 row affect (0.00 sec).” This means the command was successful, and a new database named “newdatabase” has been created.

Next, you’ll create a user who will access that database:

CREATE USER wordpressuser;

You should get the “Query OK” message again. Once the new user is created, we’ll need to set a password for the user before we can assign any permissions. In this example, we’ll assign a password of “1234″. However, in real life, just as with the root user, you’ll want to assign a strong password. (This database user won’t have full control over the MySQL user as the root user does, but we will give it full control over the database we just created, and a malicious user who guesses the password could cause all kinds of trouble.) To create the password, use this command:

SET PASSWORD FOR wordpressuser= PASSWORD(“1234”);

Again you should get the “Query OK” confirmation message. The final step is to assign all privileges on the “wordpress” database to the “wordpressuser” user. Use this command to assign the permissions:

GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser IDENTIFIED BY ‘1234′;

That isn’t a typo – those are single quote marks (‘) instead of the usual double quote marks (“) that were used in the command to set the password. MySQL’s internal syntax, alas, isn’t always consistent. Anyway, if you typed the command correctly, you should get the “Query OK” confirmation again.

Once you are done, use this command to quit the MySQL command-line interface:


Then type exit to quit the MySQL local command-line client. Now that we have MySQL prepared, we can now configure WordPress itself. Specifically, we’ll have to configure WordPress to talk to the database we just created. To do so, you must create a wp-config.php file in the WordPress directory. Fortunately, WordPress includes a handy wp-config-sample.php you can use as a template.

Type this command to create a wp-config file (assuming you installed WordPress in the www/wordpress directory):

sudo cp /var/www/wordpress/wp-config-sample.php /var/www/wordpress/wp-config.php

Next, use vi to edit the newly created wp-config file:

sudo vi /var/www/wordpress/wp-config.php

You’ll see that the wp-config.php file contains a number of variables. Change the following three variables:

-Change putyourdbnamehere to wordpress.

-Change usernamehere to wordpressuser.

-Change yourpassword here to 1234.

Once you have your changes made (after double-checking the spelling, of course), switch vi to Command mode, and save your changed file.

Everything should now be ready. Open up a web browser, and navigate to (If you want to access it from a different machine, of course, use the IP address of the WordPress server, for instance – .)If you configured everything correctly, you should then be greeted by the WordPress configuration page. You’ll pick a username, and WordPress will assign you a password. Follow the prompts, and you will have a functional WordPress blog installed on a Ubuntu machine. Congratulations!

One final note: if you configure your blog from a local browser, it will probably set your blog’s address as This is fine if you only want to view it from the host machine, but if you want to view it over the network, you’ll need to change it. Fortunately, you can do so quickly by going Options in the WordPress admin interface, and then to General, and changing the blog’s URL.

Source : http://debianhelp.wordpress.com/2012/06/30/how-to-install-and-host-wordpress-on-ubuntu-12-04-lts/


About Made Sumitre

Saya hanya menulis dan membagikan apa yang sudah pernah saya baca.


17 thoughts on “Install and Host WordPress On Ubuntu 12.04 LTS

  1. Great points altogether, you just received a new reader. What may you recommend about your submit that you just made a few days in the past? Any positive?

    Posted by su arıtma | January 15, 2013, 8:06 pm
  2. Excellent issues altogether, you simply won a emblem new reader. What might you recommend in regards to your publish that you made a few days ago? Any sure?

    Posted by su arıtma | January 15, 2013, 9:05 pm
  3. I do believe all the ideas you’ve introduced for your post. They’re really convincing and will definitely work. Still, the posts are very short for newbies. May just you please lengthen them a bit from next time? Thanks for the post.

    Posted by su aritma | January 16, 2013, 4:10 am
  4. This is very interesting, You are a very skilled blogger. I have joined your rss feed and stay up for looking for more of your great post. Also, I’ve shared your web site in my social networks

    Posted by su arıtma | March 16, 2013, 4:03 pm
  5. Fantastic points altogether, you just won a emblem new reader. What could you recommend in regards to your post that you simply made a few days ago? Any certain?

    Posted by arıtma cihazları | March 17, 2013, 5:56 pm
  6. It’s really a cool and helpful piece of info. I’m happy that you just shared this helpful information with us. Please keep us informed like this. Thanks for sharing.

    Posted by su arıtma cihazları | March 27, 2013, 9:58 pm
  7. Usually I do not learn post on blogs, but I would like to say that this write-up very pressured me to take a look at and do so! Your writing style has been surprised me. Thanks, quite nice post.

    Posted by su arıtma cihazı | March 28, 2013, 2:13 am
  8. You can definitely see your skills in the work you write. The world hopes for more passionate writers such as you who aren’t afraid to mention how they believe. All the time follow your heart.

    Posted by arıtma cihazı | March 28, 2013, 3:09 am
  9. Hello there, You’ve done an incredible job. I will certainly digg it and personally suggest to my friends. I’m sure they’ll be benefited from this website.

    Posted by aritma cihazlari | April 7, 2013, 2:59 am
  10. I simply could not depart your web site before suggesting that I extremely enjoyed the standard info a person provide to your guests? Is going to be back continuously in order to check out new posts

    Posted by arıtma cihazları | April 11, 2013, 4:15 pm
  11. I’m now not positive the place you’re getting your info, but good topic. I needs to spend a while finding out more or figuring out more. Thank you for great information I was searching for this info for my mission.

    Posted by arıtma cihazları | April 11, 2013, 5:18 pm
  12. I’m extremely inspired together with your writing abilities and also with the format for your weblog. Is that this a paid subject or did you customize it yourself? Either way stay up the nice quality writing, it’s uncommon to peer a great weblog like this one these days..

    Posted by aritma cihazlari | April 11, 2013, 5:54 pm
  13. Simply wish to say your article is as astonishing. The clarity for your publish is simply spectacular and i can suppose you’re a professional in this subject. Fine along with your permission allow me to grab your RSS feed to stay up to date with imminent post. Thank you 1,000,000 and please keep up the gratifying work.

    Posted by arıtma cihazları | April 12, 2013, 9:52 pm
  14. Nice blog right here! Additionally your site quite a bit up very fast! What host are you using? Can I am getting your associate hyperlink for your host? I desire my website loaded up as fast as yours lol

    Posted by aritma cihazlari | April 13, 2013, 4:24 am


  1. Pingback: Cgi script installation service - September 20, 2012

  2. Pingback: (Advertising online|Logo design|Website design|Article writing|Back linking|SEO services|Social media|Marketing|Facebook fans|Twitter fans|Gig} - February 10, 2013

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s


Timnas Indonesia Tim Sepakbola Nasional Indonesia mengenakan kostum baru yang diluncurkan di Stadion Utama Gelora Bung Karno, Senayan Jakarta.... Baca selengkapnya »

Anak Indonesia jadi siswa terbaik sekolah MU Anak Indonesia dari pasangan perkawinan campur, Jack Brown (11),.... Baca selengkapnya »

Timnas AFF Kuartet pemain Indonesia yang bermain di klub CS Vise di Divisi II Liga Belgia, yakni Syamsir Alam.... Baca selengkapnya »

TImnas IndonesiaPelatih Timnas PSSI, Nil Maizar, mengaku telah menemukan bentuk permainan timnas… Baca selengkapnya »

Blog Stats

  • 385,472 hits
%d bloggers like this: