SaltyCrane Blog — Notes on JavaScript and web development

Install WordPress 2.8.4 on Ubuntu 9.04 Jaunty

Since we're using WordPress at work, I decided to install WordPress on my local machine for testing and educational purposes. Here are my notes. The versions of stuff are: WordPress 2.8.4, Ubuntu 9.04 Jaunty Jackalope, MySQL 5.1, PHP 5.2.6, Apache 2.2.11 with prefork mpm.

Install prerequisites

  • Install Apache and PHP
    sudo apt-get install php5
    sudo apt-get install php5-mysql
  • Install MySQL Server
    sudo apt-get install mysql-server

    Set a password for the MySQL root user when prompted.

Download Wordpress code

cd /var/www
sudo wget http://wordpress.org/wordpress-2.8.4.tar.gz
sudo tar zxvf wordpress-2.8.4.tar.gz

Create MySQL database and user

mysql -uroot -p

Enter the password you created above.

CREATE DATABASE wordpress;
CREATE USER 'wp_user'@'localhost' IDENTIFIED BY 'wp_password';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wp_user'@'localhost';
\q

Edit WordPress wp-config.php file

  • Copy the sample file
    cd /var/www/wordpress
    sudo cp wp-config-sample.php wp-config.php
  • Edit the following lines in /var/www/wordpress/wp-config.php
    /** The name of the database for WordPress */
    define('DB_NAME', 'wordpress');
    
    /** MySQL database username */
    define('DB_USER', 'wp_user');
    
    /** MySQL database password */
    define('DB_PASSWORD', 'wp_password');
    
    /** MySQL hostname */
    define('DB_HOST', 'localhost');

Set up Apache virtual host

  • Edit /etc/apache2/sites-available/wordpress
    ServerName localhost
    <VirtualHost *:80>
    	DocumentRoot /var/www/wordpress
    	ErrorLog /var/log/apache2/wordpress.error.log
    </VirtualHost>
        
  • Symlink to sites-enabled
    sudo ln -s /etc/apache2/sites-available/wordpress /etc/apache2/sites-enabled/wordpress
  • Remove default virtual host from sites-enabled
    sudo rm /etc/apache2/sites-enabled/000-default

Restart Apache and view your Wordpress site

  • sudo /etc/init.d/apache2 restart
  • Go to http://localhost in your browser. You should get the WordPress Welcome page.

References

Comments


#1 Manuel Jose commented on :

I got this error while restarting apache

Syntax error on line 161 of /etc/apache2/apache2.conf: Invalid command 'Order', perhaps misspelled or defined by a module not included in the server configuration

any ideas? Thanks in advance :-)


#2 Nikolay Kolev commented on :

I recommend the following improvements:

  1. Install LAMP via sudo apt-get install lamp-server^

  2. Do not delete the default website in apache, just do the following: sudo a2dissite default

  3. There's no need to create the wp-config.php file as WordPress will create it automatically

  4. The latest WordPress can be downloaded from http://wordpress.org/latest.tar.gz

  5. Also, I recommend adding Options -Indexes FollowSymLinks so that people cannot sniff what plugins you have installed, etc

  6. Symlink to sites-enabled should be done via sudo a2ensite wordpress


#4 Eliot commented on :

Nikolay, I didn't know about a2dissite and a2ensite. I will use those from now on. Thanks for all the tips. You definitely know WordPress better than I do.