If you're new here, you may want to subscribe to my RSS feed and if you have questions related to your ubuntu system post question to our forums. Thanks for visiting!
So, without further ado, let’s start by opening a terminal and type:
miguel@c31828:~$ sudo aptitude install apache2
Reading package lists… Done
Building dependency tree
Reading state information… Done
Reading extended state information
Initializing package states… Done
The following NEW packages will be installed:
apache2 apache2-mpm-worker{a} apache2-utils{a} apache2.2-bin{a} apache2.2-common{a}
libaprutil1-dbd-sqlite3{a} libaprutil1-ldap{a}
0 packages upgraded, 7 newly installed, 0 to remove and 0 not upgraded.
Need to get 3,238kB of archives. After unpacking 10.7MB will be used.
Do you want to continue? [Y/n/?]
Continue with Y. You’ll notice by the end of the update that Apache will be started and have a default configuration set up:
(…)
Enabling module authn_file.
Enabling module authz_host.
Enabling module reqtimeout.
Setting up apache2-mpm-worker (2.2.14-5ubuntu8) ...
* Starting web server apache2 apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName
[ OK ]
Setting up apache2 (2.2.14-5ubuntu8) ...
Reading package lists... Done
(…)
Once the installation is finished, we can test if Apache is working OK by opening up a browser and navigate to the URL http://127.0.0.1. If everything is OK you’ll see the “it works!” web page, meaning Apache is up and running!
Next, we’ll need to install MySQL 5.1:
miguel@c31828:~$ sudo aptitude install mysql-server-5.1
Reading package lists… Done
Building dependency tree
Reading state information… Done
Reading extended state information
Initializing package states… Done
The following NEW packages will be installed:
libdbd-mysql-perl{a} libdbi-perl{a} libhtml-template-perl{a} libmysqlclient16{a}
libnet-daemon-perl{a} libplrpc-perl{a} mysql-client-5.1{a} mysql-client-core-5.1{a}
mysql-common{a} mysql-server-5.1 mysql-server-core-5.1{a}
0 packages upgraded, 11 newly installed, 0 to remove and 0 not upgraded.
Need to get 24.2MB of archives. After unpacking 60.7MB will be used.
Do you want to continue? [Y/n/?]
Continue with Y. During the installation we’ll need to insert a root password for MySQL. You can pick a strong password from strongpasswordgenerator.com. For obvious reasons, save this password in a safe place!
As you can see from the list above, MySQL 5.1 packages occupy 24.2 MB and this download can take some time depending on the Internet connection and CPU speed.
Next, we’ll install PHP version 5:
miguel@c31828:~$ sudo aptitude install php5 phpmyadmin
Reading package lists… Done
Building dependency tree
Reading state information… Done
Reading extended state information
Initializing package states… Done
The following NEW packages will be installed:
apache2-mpm-prefork{a} dbconfig-common{a} javascript-common{a} libapache2-mod-php5{a}
libjs-mootools{a} libmcrypt4{a} libt1-5{a} php5 php5-common{a} php5-gd{a} php5-mcrypt{a}
php5-mysql{a} phpmyadmin wwwconfig-common{a}
The following packages will be REMOVED:
apache2-mpm-worker{a}
0 packages upgraded, 14 newly installed, 1 to remove and 0 not upgraded.
Need to get 10.1MB of archives. After unpacking 32.7MB will be used.
Do you want to continue? [Y/n/?]
Continue with Y. I also installed phpMyAdmin, although optional, because I like to create the database, users, tables, etc. through this great package and this way I don’t need to give any commands directly on the mysql prompt (I personally tend to forget a lot on the right syntax on long commands).
If you don’t want to install phpMyAdmin, don’t forget to include php5-mysql on the command above (sudo aptitude install php5 php5-mysql).
You’ll notice that during phpMyAdmin installation you’ll have to choose the web server that should be configured to run phpMyAdmin: apache2 or lighttpd. Choose apache2 (with the space key) and hit Ok (with the tab and then the space key) to continue the installation. You’ll then get a screen telling you if you want to configure database for phpMyAdmin with dbconfig-common. Hit No (with tab and then the space key).
After phpMyAdmin installation, you can again open the browser and hit URL http://127.0.0.1/phpmyadmin/. Et voilà! You can now get inside your MySQL database world through your browser using the user root and the password chosen above (but be aware that user root has full access to your databases and should be used wisely).
Now, we only need to download WordPress 3.0 from the official WordPress web page:
http://wordpress.org/latest.zip (2.2MB) or http://wordpress.org/latest.tar.gz (2.0MB)
Right click on one of these links and download it to a location of your preference (for example, ~/Desktop) using the option “Save Link As…”. Unpack this package (I’ll use here folder /var/www as it is a standard location where the web server will look for web pages) using unzip (for the .zip archive) or tar (for the .tar.gz archive).
miguel@c31828:~/Desktop$ sudo mv latest.zip /var/www
or
miguel@c31828:~/Desktop$ sudo mv wordpress-3.0.1.tar.gz /var/www
miguel@c31828:~/Desktop$ cd /var/www
miguel@c31828:/var/www$ sudo unzip latest.zip
or
miguel@c31828:/var/www$ sudo tar -zxvf latest.tar.gz
After unpacking, you’ll get a folder wordPress extracted to your chosen location:
miguel@c31828:/var/www$ ls -al
total 2912
drwxr-xr-x 3 root root 4096 2010-06-30 18:00 .
drwxr-xr-x 17 root root 4096 2010-06-30 16:32 ..
-rw-r–r– 1 root root 177 2010-06-30 16:32 index.html
drwxr-xr-x 5 root root 4096 2010-06-17 17:05 wordpress
-rw-r–r– 1 miguel miguel 2964966 2010-06-30 17:38 latest.zip
You can now delete the .zip or .tar.gz archive:
miguel@c31828:/var/www$ sudo rm -f latest.zip
or
miguel@c31828:/var/www$ sudo rm -f wordpress-3.0.1.tar.gz
Now all we’re missing is creating a MySQL database and configure WordPress!
For creating a database using phpMyAdmin, follow these steps:
- Start by choosing a name for your WordPress database (like ‘wordpress‘ or ‘blog‘), enter it in the Create new database field, and click Create (choose the right Connection Collation for you or use
utf8_general_ci).
- Click the Home icon in the upper left to return to the main page, then click Privileges. If a user relating to WordPress does not already exist in the list of users, create one:
- Click Add a new User.
- Chose a username for WordPress (like ‘wordpress‘) and enter it in the User name field. (Be sure Use text field: is selected from the dropdown.)
- Choose a strong password password (use strongpasswordgenerator.com), and enter it in the Password field. (Be sure Use text field: is selected from the dropdown.) Re-enter the password in the Re-type field.
- Write down the username and password you chose.
- Leave all options under Global privileges at their defaults.
- Click Go.
- Return to the Privileges screen and click the Edit privileges icon (on the right-most column) on the user you’ve just created for WordPress. In the Database-specific privileges section, select the database you’ve just created for WordPress under the Add privileges to the following database drop down. The page will refresh with privileges for that database. Click Check All to select all privileges, and click Go.
- On the resulting page, make note of the host name listed after Server: at the top of the page. (This will usually be localhost.)
For creating a database using MySQL client, follow these steps:
miguel@c31828:/var/www$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 61
Server version: 5.1.41-3ubuntu12.3 (Ubuntu)
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> CREATE DATABASE databasename;
Query OK, 1 row affected (0.00 sec)
mysql> CREATE USER wordpressuser;
Query OK, 0 rows affected (0.00 sec)
mysql> SET PASSWORD FOR wordpressuser = PASSWORD(”wordpresspassword“);
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON databasename.* TO “wordpressuser“@”localhost” IDENTIFIED BY “wordpresspassword“;
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> EXIT
Bye
Now all we have to do is to configure WordPress!
miguel@c31828:~$ cd /var/www/wordpress
miguel@c31828:/var/www/wordpress$ sudo cp wp-config-sample.php wp-config.php
Edit this new file, wp-config.php, with your favorite editor (I used emacs!) and change the values under the section labeled MySQL settings
- DB_NAME: Database Name used by WordPress
- DB_USER: Username used to access Database
- DB_PASSWORD: Password used by Username to access Database
- DB_HOST: The hostname of your Database Server
And also put your Authentication Unique Keys and Salts under the section labeled Authentication Unique Keys using WordPress’ online generator to obtain them:
- AUTH_KEY
- SECURE_AUTH_KEY
- LOGGED_IN_KEY
- NONCE_KEY
Save all your changes to file /var/www/wordpress/wp-config.php and open a browser and give it the URL http://127.0.0.1/wordpress/. If everything is OK by now you should see the WordPress welcome and configuration page:

All we need now is to put some more few details like the site’s title, the user name and password we’ll use to login (once again I suggest using a strong password from the strong password generator site, and after everything is just the way we want just click the “Install WordPress” button!
If everything went perfect, a “Success!” web page follows and we can start using WordPress by logging in with the user name and password chosen on the previous step.
Have fun using WordPress!
References: WordPress’ Installing WordPress - Detailed instructions web page.







You could just run “sudo apt-get install wordpress” which will install all the dependencies like Apache and PHP.
True, but this way I can control which version of WordPress I want to use (the latest version or not) and where I want it to be (in this case I choose /var/www but I could have chosen another location that was best for me).
Hi, your post title is better if “how to install Apache, PHP, MySQL and WP”!
If you want to install WP, just extract it to /var/www/ and then access it using http://localhost/folder name] and you’ll get instruction to make wp-config.php file.
The point of your post is how to install WP dependencies instead the WP itself.
Hi panoet,
I can’t just install wordpress without installing first its dependencies. What’s the point in extracting wordpress into /var/www without first installing PHP, Apache and MySQL?
Although I wasn’t thinking about it when I first posted this article, I agree that my post title could have been “How to Install WordPress 3.0 and its dependencies in Ubuntu 10.04″ as it is better explained on what the article is all about.
Cheers!
Hi, as of 9.10 the use of tasksel for putting LAMP on is the ‘correct’ way
http://forum.phillw.net/viewtopic.php?f=4&t=4&start=0#p6 has the details of that - slightly less to type in
Regards,
Phill.
Awesome! I enjoy using WordPress, now I can play around with it even more. Thanks for the post!
Cheers
Love the step by step tutorial, just one problem, everything is dummy proof up to here:
“Now, we only need to download WordPress 3.0 from the official WordPress web page:
http://wordpress.org/latest.zip (2.2MB) or http://wordpress.org/latest.tar.gz (2.0MB)
Unpack this package (I’ll use here folder /var/www as it is a standard location where the web server will look for web pages) using unzip (for the .zip archive) or tar (for the .tar.gz archive). After unpacking, you’ll get a folder WordPress extracted to your chosen location:
You can now delete the .zip or .tar.gz archive.”
Can you maybe edit to walk through the process of downloading from a website url, how to unpackage to a directory, the delete the archive? Thanks!
Hi Steve,
Just did the changes. Hope it helps!
Regards
Hi Miguel,
Thank you so much for your tutorial! It is clear and easy for newbies like me.
Kind regards from France,
Netegalkaka!
thanks it really help me to setup my wordpress,
for the benifits of newbies you can add also to your tutorial on details how to upload it to a server for online purpose.
this is an offline an install.
Great basic tutorial, but one issue this does not address is how to enable FTP access on Ubuntu, which is trickier than the same on other operating systems (XAMPP for Windows, for example).
FTP is essential after all for auto-updating plugins and WordPress itself.
I wish I could explain the process but I still haven’t figured it out myself! (I got here googling trying to figure it out).
Hi everyone,
Thanks for your comments. I’m glad I could help you installing WordPress. As soon as I get back from my holidays (I’m gonna take the next two weeks and will not have internet access) I’ll update this post to detail how to upload it to a webserver and how to enable FTP access on Ubuntu to upload plugins into wordpress.
Best regards,
Miguel Rentes
What do I need to do to get permalinks to work? I can get to the individual post pages if I leave the permalink settings to the defaults, but I get 404 pages if I change it. I am allowing WordPress to write to my .htaccess file, but do I need to turn mod_rewrite.c on in PHP or something?
Just in case anyone else gets this, I thought I’d share how I fixed it.
For some reason the aptitude install of phpmyadmin didn’t create the symlink needed to run it. After much searching, I found that running the following command fixed the issue:
sudo ln -s /usr/share/phpmyadmin /var/www/phpmyadmin
Christian:
Wanted to let you know I had the same problem you did and solved it following the directions from here:
http://www.drewglass.com/2009/03/09/ubuntu-apache-and-htaccess/
Hope this helps!
Thanks, Nathan! It worked!
Thanks for the post. Was very helpful. Off to work my new press
Thanks again.
-Chris
I am having major problem..I followed the instruction exactly and thanks for making this great tutorial. I suppose I need to learn how to ftp to my local install wordpress (which I do not know). I problem is pretty well documented in this thread..
http://wordpress.org/support/topic/cannot-upload-themes-in-my-laptop-wordpress-301-lucid-lynx-desktop?replies=16#post-1675877
thanks a lot