Setting up WordPress on Debian 5.0
I’ll assume you’re starting with a stock Debian 5.0 system and have set up sudo access for your account. I’ll be using the user nick as my personal user for this setup.
First we need install the prerequisites: Apache, PHP, and MySQL. It’ll ask you for a root password for MySQL, make sure you hold onto that. We’ll need it later.
sudo apt-get install apache2 mysql-server php5 php5-mysql |
Now we need to make sure that Apache is configured with the modules needed for WordPress.
sudo a2enmod rewrite sudo a2enmod php5 |
WordPress uses a MySQL database to store your blog posts and comments, so we need to create a MySQL database for wordpress. MySQL will ask you for the root password you created before. Make sure to save the password you set up for the wordpress user, as this is what WordPress will use to connect to the database.
mysql -u root -p CREATE DATABASE `wordpress`; grant all privileges on `wordpress`.* to 'wordpress'@localhost identified by 'ANOTHER-PASSWORD'; flush privileges; |
Need to set up WordPress with a directory so we can use it. Download WordPress from their site and stick it in your home directory.
cd /var/www sudo mkdir sites && cd sites sudo cp ~nick/wordpress-2.8.2.tar.gz . sudo tar xzvf wordpress-2.8.2.tar.gz sudo touch wordpress/.htaccess sudo chown -R nick:www-data wordpress sudo chmod -R g+w wordpress |
We changed the group and gave write permissions so WordPress will be able to set up its own config files. We set up the .htaccess file in advance because it’s easier to let WordPress change it based on the URL settings.
In order to serve the website, we need to set up an Apache Virtual Host. Create a file in /etc/apache/sites-available (mine is kleinsch.com) for your site and add the following code.
<VirtualHost *:80> ServerName kleinsch.com ServerAlias www.kleinsch.com ServerAdmin youremail@yourhost.com DocumentRoot /var/www/sites/wordpress <Directory /var/www/sites/wordpress> Options FollowSymLinks AllowOverride All </Directory> </VirtualHost> |
Enable the site within Apache and restart:
sudo a2ensite kleinsch.com sudo /etc/init.d/apache restart |
You should see no warnings. Open up your browser and navigate to ‘http://yoursite.com/wp-admin/install.php’.
The first page will tell you WordPress needs to create a config file, we want it to do that. On the next page, enter the database information you set up above. Leave the defaults for the encoding and table prefix. Enter a title for your blog, and you’re up and running!
