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. classer says:

    I should also mention that I first installed all the packages with apt-get instead of aptitude. I don’t know if that did anything bad. When I saw that phpmyadmin did not work the first time, I uninstalled everything with “sudo apt-get remove package_name”.

    Then I reinstalled everything again with aptitude. When reinstalling mysql-server-5.1 and php5 phpmyadmin I was not stopped during the installation to pick a password and choose a server respectively. So I assume this means that these preferences (which were saved in a config file somewhere) were not deleted during the apt-get removing process.

    I read that apt-get does not remove all dependencies that are simultaneously installed with the main package. Perhaps this had something to do with it.

    [Reply]

  2. classer says:

    Ok. Finally I installed WordPress locally successfully!

    I first uninstalled all the packages by doing “sudo aptitude purge package-name” just to be sure.

    Then I reinstalled everything with “sudo aptitude install package-name” and during the reinstall process I realize what my original mistake was. I had forgotten to press the spacebar when choosing what server phpmyadmin would run under. I did not read carefully enough and assumed the fact that ‘apache2′ was highlighted red meant that was the selected one.

    Anyways, once I got into http://127.0.0.1/phpmyadmin/ I realized that I did not have a username and password so I could not follow along with setting up a database that way. I ended up using the MYSQL client in the terminal which worked out fine.

    Now my issue is getting the FTP set up right. It keeps saying I have the wrong username/password for the username that I enter. It makes no sense because when during this entire tutorial set up the FTP username and password. This part of the tutorial is missing.

    Am I missing something?

    [Reply]

  3. jigar jani says:

    Hi I have wordpress installed now , thanks to this great guide.

    Can I download the blog which I made before installing wordpress on my machine, to my local wordpress folder and update it regularly.

    How do I do that?

    Thanks again.

    [Reply]

  4. @classer Are you using vsftpd or another ftp daemon? Can you post your vsftpd.conf file? Use Lodgeit (http://paste.pocoo.org/) if you have to paste the conf file and post the link for me to check it.

    @jigar I guess you can do that with no problem, although I have never done it. One great source of information about wordpress you check is IRC. Go to #wordpress on FreeNode server and fire up your questions there! I always use this great source of information when I have questions on a particular issue on software tools or development. By the way, my username is setner. Whenever I can I’m on FreeNode :)

    Best regards!

    [Reply]

  5. gideon says:

    hi
    great guide
    I installed it succesfully, I installed VSFTP as well
    I wanted to uninstall a plugin so it want to connect to the server with ftp, but it needs a password and user. I tried both my WP access, admin and password and the Database wpgideon and password, neither of them works?

    any suggestions where I went wrong

    [Reply]

    Miguel Rentes Reply:

    Hi gideon,

    What is the exact error you get when try uninstall a plugin? Check /var/log/apache2/error.log and /var/log/apache2/access.log when the error pops up. Also, I quickly searched serverfault and found this (hope it helps):

    http://serverfault.com/questions/251383/setting-up-ftp-users-on-linux

    Regards

    [Reply]

    gideons bible Reply:

    I have to use my default computer username and password. IDK if thats what you guys were missing (or how to make it something different if thats possible)…. I’m still stuck on creating the directory though.

    [Reply]

  6. visitor says:

    Worked beautifully!
    very much obliged!
    thanks

    [Reply]

  7. Jaki Levy says:

    These are great WordPress resources – I actually just started digging into a really really solid book on WordPress 3.0. It’s got some really nice code samples, and is written by a few pro WordPress developers (including some from Envato). I’m actually giving away 2 copies of the e-book on my site – check out the details about the e-book and the giveaway here – I think you’ll dig it : http://bit.ly/lq20Ff

    [Reply]

  8. Tan Wei Song Beck says:

    Hi, thank you for the guide in installing my WordPress 3.1.2 in ubuntu 10.04.1. I am not sure whether any of you guys actually encountered the same problem with me but I just want to share.

    During the point where you need to enter the connection information. If you are unable to install using localhost, then change to use 127.0.0.1 because for me, I am unable to set the host as ‘localhost’. Hope it helps.

    [Reply]

  9. Ken says:

    Tan Wei Song Beck is correct. I found out, also, that you may have to use 127.0.0.1 as your hostname instead of localhost.

    I am having a problem with installing themes, also. The problem is that WordPress cannot create the directories/files it needs to create to install the themes. I am fairly certain that my directory privileges are correct, and I know I have vsftpd running, and that the configuration is set up as they are in the tutorial. Let me go step by step in what I am doing:

    1. I go to “Install Themes” and choose WPFolio 1.72″.

    2. I enter in hostname 127.0.0.1, username (my username), password (my password), connection type “FTP” and I click proceed.

    3. WP begins to attempt to download and create the files needed for the installation, but it says it cannot create the files/directories needed. Example output:

    Installing Theme: WPFolio 1.72

    Downloading install package from http://wordpress.org/extend/themes/download/wpfolio.1.72.zip…

    Unpacking the package…

    Could not create directory. /var/www/wordpress/wp-content/upgrade/wpfolio.tmp

    As a test of my file permissions, I manually created the /var/www/wordpress/wp-content/upgrade directory already, since WP had failed to create this directory. No problem there.

    I’ve granted my user and group recursive ownership of this directory, as the tutorial says to do. I’m not sure what the problem is.

    [Reply]

  10. Ken says:

    Nevermind. Problem solved. I’d forgotten to make some changes and save my changes in /etc/vsftp.conf

    [Reply]

  11. Roberto says:

    Hi Miguel, great tutorial, is really easy to follow. the issue I have is the username & password for the ftp. Is the same username and password hte same as for the one used for entering wordpress? I’m using vsftpd.confi This is the link: http://paste.pocoo.org/show/424417/
    hope you have time to help. Thanks in advance.

    [Reply]

  12. Hi Roberto,

    This is my vsftpd.conf I actually use:

    http://paste.pocoo.org/show/438432/

    Yes, I use the same user for entering wordpress and to use ftp.

    Hope this helps! Regards,

    Miguel Rentes

    [Reply]

  13. kahoots says:

    If you want image resizing to work then you need to also install php5-gd.

    sudo apt-get install php5-gd

    [Reply]

  14. zona ubuntu says:

    Great! very useful post, it would be awesome to install wordpress from a PPA.

    [Reply]

  15. Euloiix says:

    Thanks ! Many thanks

    [Reply]

  16. mEME says:

    why would i set it up on a server at my local pc???

    The server is on a SERVER!! remote!!

    How on earth can i USE 127.0.0.1 ?????????????

    pLEASE SAY HOW TO SET IT UP ON A server!!!!

    [Reply]

    Shaun Reply:

    I followed the directions and everything went fine. I began creating the site and have all of my content filled. I thought it would be easy to change my host name from 127.0.0.1 since I saw it in the WP settings, but I have wasted a lot of time trying to do this last step.

    The site is hosted on an internal network. I would like to change it to http://name or http://10.10.10.81 I tried many methods suggested here http://codex.wordpress.org/Changing_The_Site_URL

    If I change the name within WP settings it kicks me out when I click save and I can not get to the username/password (wp-login.php) screen again. Right now to edit my site I use http://127.0.0.1/wordpress/wp-login.php After I change anything it does not load. http://name/wordpress/wp-login.php or http://10.10.10.81/wordpress/wp-login.php or many other variations of the hostname or 10.10.10.81 either do not load the login page or it does a google search. I tried: edit wp-config.php, edit functions.php, change URL directly in the database with phpMyAdmin. Relocate didn’t seem to work for me. Going to the new hostname or ip does not load the user end of the site.

    If I can get the hostname changed and log in to wordpress I can take care of fixing all of my media and image links on my own.

    [Reply]

    Miguel Rentes Reply:

    Do you still have this problem? Or have you solved it already?

    [Reply]

    Shaun Reply:

    I have semi-resolved it. I used index.html to redirect, but still have the /wordpress/ in there that is not necessary.

    Shaun Reply:

    index.html redirects “sitename” to “sitename”/wordpress so users don’t have to remember a new address or change bookmarks.

  17. bloblo says:

    The requested URL /wordpress was not found on this server.

    [Reply]

  18. bloblo says:

    The problem is all this “localhost” and 127.0.0.1 stuff.

    We are not installing it on a home server, We-re installing it on a dedi, with it-s own ip address.

    PLEASE make it clear when “localhost” is referred to and 1276.0.0.1 is reffered to what should be changed for a remote server

    [Reply]

  19. bloblo says:

    The requested URL /wp-admin/install.php was not found on this server.

    [Reply]

  20. Tsvetelina says:

    Thank you! Thank you! I had troubles setting wordpress to work I got the error: undefined method get_header(). I was originally working with lampp then I moved to windows and then after I had to reinstall ubunutu(nothing to do with wordpress or lampp) I left lampp and follow your tutorial. Thank you soooo much! : )

    [Reply]

    Miguel Rentes Reply:

    You’re welcome. I’m happy I could help you.

    Best regards

    [Reply]

  21. Karen D. says:

    I am still running Ubuntu 10.04 (by choice) and installing WordPress locally is going to save me SO much time. I followed your instructions step by step and everything is working fine. Thank you ever so much for the time and effort and sharing of this information!

    [Reply]

    Miguel Rentes Reply:

    I’m glad I could help you :)

    Best regards

    [Reply]

  22. bert says:

    Awesome tut! Best I’ve ever used! Thanks for making it easy.

    [Reply]

Leave a Reply