WordPress on Ubuntu 10.04

Installation

You will need apache2, php5, mysql-server and php5-mysql:

  • sudo apt-get install apache2 php5 mysql-server php5-mysql -y

Download WordPress into the /var/www folder:

  • cd /var/www
  • wget http://wordpress.org/latest.tar.gz

Unzip the WordPress archive, remove the archive file, and set permissions for the wordpress folder:

  • tar -zxvf latest.tar.gz
  • rm latest.tar.gz
  • chown -R [user] wordpress

Start up MySQL to create a database for WordPress:

  • mysql -u root -p

At the MySQL prompt, enter the following commands, being careful to follow the use of quotation marks and semicolons:

  • CREATE DATABASE [databasename];
  • GRANT ALL PRIVILEGES ON [databasename].* TO “[localuser]“@”hostname” IDENTIFIED BY “[password]“;
  • FLUSH PRIVILEGES;
  • EXIT

Go into the wordpress folder and create the wp-config.php file by copying it from wp-config-sample.php:

  • cd wordpress
  • cp wp-config-sample.php wp-config.php

Add the corresponding values from MySQL into wp-config.php:

  • DB_NAME
  • DB_USER
  • DB_PASSWORD

Open a web browser and go to http://127.0.0.1/wordpress/wp-admin/install.php to set up WordPress for the first time.

Hosting Multiple WordPress Sites

The easiest way to host multiple WP sites on a single server is to create new databases for each new site and create separate folders for each WP installation. For example, create the following databases: wordpress, testpress, threepress. Then create the proper web folders for each: /var/www/wordpress, /var/www/testpress, /var/www/threepress. Once all that is done, then follow the steps to set install WP into each folder.

Editing Permissions for wp-content

What’s the purpose of using WordPress if you can’t upload media files? To ensure that media can be uploaded to the new WordPress installation, change the ownership of the wp-content folder so that www-data can upload media:

  • sudo chown -R www-data /path/to/wordpress/wp-content
  • sudo chmod -R 744 /path/to/wordpress/wp-content

Setting the correct permissions allows for the uploading of images, themes, and other goodies to the blog.