July 2, 2010 · General · Email This Post

Sponsored Link
On this post I’ll tell you how to install the latest WordPress version (3.0) on a Ubuntu 10.04 (Lucid Lynx) machine. I personally love WordPress as a blogging engine and hope you find these instructions helpful and that make you create your blogs fast and pragmatically.

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

One of the important things to do is to give the right permissions for your user to read and write into the wordpress folder. For this, you will want to give the correct ownership to your local user (in my case, user miguel):

miguel@c31828:/var/www$ sudo chown -R miguel:users wordpress

As you can see, the wordpress folder now has the right permissions for my user to change it:

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 miguel users 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 (if you got the error "Error establishing a connection" that probably means something is wrong with the username or password you have saved in file wp-config.php):

WordPress 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.

After you logged in, you will be redirected to the Dashboard page under which you can customize your wordpress blog to suit more easily your looks and purposes.

To install a new theme, hit the "Appearance" menu and then the "Install Theme" tab. Under the search field enter a theme search term by keyword, author, or tag. For instance, I chose "clean". One of the search results gave me the Fusion theme. Hit the Install link and then the Install now link at the preview window. At the Connection Information wordrepss page you will need to enter the following information: your hostname, FTP username and password and connection type. For this to work, you will first need to have a FTP daemon running on your web server. If you don't have it already, you can install one by using the command

sudo aptitude install vsftpd

After the installation, you will just have to edit the file /etc/vsftpd.conf as root using your favorite editor and enable the features you would like your ftp daemon to be enabled. I enabled the following ones (read the FTP daemon's documentation first if you're not sure of which options to enable and the security impact those changes will have):

anonymous_enable=YES
local_enable=YES
write_enable=YES
local_umask=022
anon_upload_enable=YES
anon_mkdir_write_enable=YES

Now all I have to do is to run the FTP daemon with the command:

sudo service vsftpd start

Let's now return at the "Connection Information" configuration page. Fill the necessary information in the text fields for your hostname (I used 127.0.0.1 but you can also use localhost), the user name (I used miguel) and the password (I won't tell you this one!). Choose FTP protocol and hit Install. If everything is OK, you should now see that your theme is being downloaded and installed in wordpress/wp-content/themes folder. Hit the "Preview" link to preview what your page will look like with the new theme, hit "Activate" link to use the newly installed theme or hit "Return to Theme Installer" page to install another theme!

Have fun using WordPress!

References: WordPress’ Installing WordPress -- Detailed instructions web page.

Sponsored Link

Incoming search terms:

Related posts

93 Comments to “Installing WordPress 3.0 on Ubuntu 10.04 (Lucid Lynx)”

  1. Ryan says:

    You could just run “sudo apt-get install wordpress” which will install all the dependencies like Apache and PHP.

    [Reply]

  2. 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).

    [Reply]

  3. panoet says:

    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.

    [Reply]

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

    [Reply]

  5. Phill. says:

    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.

    [Reply]

  6. VP says:

    Awesome! I enjoy using WordPress, now I can play around with it even more. Thanks for the post!

    Cheers

    [Reply]

  7. Steve says:

    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!

    [Reply]

  8. Hi Steve,

    Just did the changes. Hope it helps!

    Regards ;-)

    [Reply]

  9. Netegalkaka says:

    Hi Miguel,

    Thank you so much for your tutorial! It is clear and easy for newbies like me.

    Kind regards from France,
    Netegalkaka!

    [Reply]

  10. edwin says:

    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.

    [Reply]

  11. Murph says:

    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).

    [Reply]

  12. 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

    [Reply]

  13. Christian says:

    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?

    [Reply]

  14. Nathan says:

    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

    [Reply]

  15. Nathan says:

    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!

    [Reply]

  16. Christian says:

    Thanks, Nathan! It worked!

    [Reply]

  17. Chris says:

    Thanks for the post. Was very helpful. Off to work my new press ;) Thanks again.

    -Chris

    [Reply]

  18. hannah says:

    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

    [Reply]

  19. hannah says:

    Ok some success. I have added this line in wp-config.php and am able to upload some theme files..
    define(‘FS_METHOD’, ‘direct’);
    Some other theme files are still giving me grief..

    [Reply]

  20. ahl says:

    thank you, brilliant instructions!

    [Reply]

  21. Hi everyone,

    I’ve just updated the post to include instructions on how to upload new themes into your wordpress blog. Hope you enjoy it!

    Regards

    [Reply]

  22. Murph says:

    Thanks, Miguel. Now your tutorial is truly complete. It’s an excellent reference. Nice job.

    [Reply]

  23. ro2 says:

    Hello.
    I can’t run WordPress (vp-admin/install.php or wp-config.php) due to error == Your PHP installation appears to be missing the MySQL extension which is required by WordPress ==.

    I use – Ubuntu 4.10, mysql, php5

    What problem?
    Thank you!

    [Reply]

  24. Henk says:

    Thanks Miguel for a very clear tutorial. I had one problem
    miguel@c31828:/var/www/wordpress$ sudo cp wp-config-sample.php wp-config.php gave me a problem with the rights on wp-config.php so I left out sudo.
    As I do want to use WordPress only for testing on my machine I do not want to use FTP.
    Can you advise me on how to add a new theme? I have downloaded one on my desktop and with the upload function in WordPress I can find it. If I press install I get the following message:
    Unable to create directory /var/www/wordpress/wp-content/uploads/2010/11. Is its parent directory writable by the server?

    Can you help?

    [Reply]

  25. Hi Henk,

    If you only want to use wordpress for testing, I believe you can set the permissions on folder /var/www/wordpress to allow your user to install any themes. I think you can do something like this:

    $ sudo chown -R henk:users /var/www/wordpress

    Let me know if it worked.

    Best regards,

    Miguel

    [Reply]

  26. Henk says:

    Hi Miguel,

    I found the solution in the mean time. Instead of yourself as user: /var/www$ sudo chown -R miguel:users wordpress

    I used: $ sudo chown -R www-data and this fixed the problem

    Regards

    [Reply]

  27. Hi Henk,

    Ok :)

    Regards,
    Miguel

    [Reply]

  28. Ray says:

    Hi,

    Firefox tells me I’m trying to download a phtml file when I go to http://127.0.0.1/phpmyadmin. One of the options is to use Flashgot, but all it does is save the file on my desktop. I’ve searched the web and found that many others have the same problem, but none of their ideas have worked so far.

    Any ideas?

    Thanks, Ray

    [Reply]

  29. Miguel Rentes says:

    Hi Ray,

    That never occurred to me and I’ve tested phpmyadmin on firefox 3.6 and lately on chrome 7.0.517.44, and it works fine. I’m guessing your local apache2 server is not correctly configured. Can you post here your apache2 conf file for phpmyadmin? It should be on folder /etc/phpmyadmin/apache.conf.

    Regards,
    Miguel

    [Reply]

  30. Ray says:

    Hi Miguel,

    Hope this is what you want. I actually added .phtml to AddType, but still get the same message.

    Thanks, Ray

    # phpMyAdmin default Apache configuration

    Alias /phpmyadmin /usr/share/phpmyadmin

    Options FollowSymLinks
    DirectoryIndex index.php

    AddType application/x-httpd-php .php .phtml

    php_flag magic_quotes_gpc Off
    php_flag track_vars On
    php_flag register_globals Off
    php_value include_path .

    # Authorize for setup

    AuthType Basic
    AuthName “phpMyAdmin Setup”
    AuthUserFile /etc/phpmyadmin/htpasswd.setup

    Require valid-user

    # Disallow web access to directories that don’t need it

    Order Deny,Allow
    Deny from All

    Order Deny,Allow
    Deny from All

    [Reply]

Leave a Reply