Update: As Ubuntu is quite similar to Debian, this howto can also be used for Ubuntu systems. I’ve tested this guide with Ubuntu Server 10.04 LTS and Ubuntu Server 10.10 and I expect this to work on Debian 6 (Squeeze), too.
In Lenny, WordPress is already part of the apt repository. The downsite is that its a quite old version. So this little howto describes how to install the latest WordPress version (currently its 3.0.5) from its tarball by still retaining Debian’s file locations. You need a running LAMP configuration and root permissions to perform the next steps. I’ll use “YOUR.DOMAIN” as a placeholder for your blog domain. Please replace it with your real domain, which is something like “www.kaisblog.de”.
Before we start we need to check WordPress’ dependencies. Just type
# apt-get install wordpress
and select “n” to not install WordPress. If you see more packages than just “wordpress” you might want to install them now using “apt-get install”.
We want to install WordPress in /usr/share, so cd into it:
# cd /usr/share
Now we need to get and unpack the latest WordPress version:
# wget http://
# unzip -e latest.zip
This creates the wordpress directory. You can also download the .tar.gz version but for most plugins / themes you need unzip anyway. As Debian handles webapps like normal apps, we should create a config directory in /etc and copy the sample config into it:
# cd wordpress
# mkdir /etc/wordpress
# cp wp-config-sample.php /etc/wordpress/wp-YOUR.DOMAIN-config.php
Again, please replace “YOUR.DOMAIN” with your blog domain. In my case its “wp-www.kaisblog.de-config.php”.
Now create a config file in /usr/share/wordpress/ that reads our config file in/etc/wordpress:
# nano wp-config.php
Paste the following code into it:
Press CTRL+X to save the file and quit nano.
Now its time to create a mysql database where WordPress stores its data in:
# mysql -uroot -p
Enter your mysql root password and you’ll see the mysql prompt. We’ll create a user and a database called wordpress:
# GRANT ALL PRIVILEGES ON wordpress.* TO wordpress IDENTIFIED BY "S3cr3t!";
# FLUSH PRIVILEGES;
Please replace “S3cr3t!” with your own password
Now edit /etc/wordpress/wp-YOUR.DOMAIN-config.php and enter your mysql settings:
# nano /etc/wordpress/wp-YOUR.DOMAIN-config.php
/** MySQL database username */
/** MySQL database password */
/** MySQL hostname */
At the bottom of this config file you’ll find this line:
/* That's all, stop editing! Happy blogging. */
Please delete everything under this line as its already included in /usr/share/wordpress/wp-config.php
Debian handles apache sites in two different directories: /etc/apache2/sites-available and /etc/apache2/sites-enabled. We create a WordPress site config in /etc/apache2/sites-available and enable it with a2ensite when we are ready to do so.
# nano /etc/apache2/sites-available/YOUR.DOMAIN
Paste the following code into it:
CustomLog /var/log/apache2/access.log combined
Again, press CTRL+X to save and exit nano.
As you can see, our root directory is /var/www/YOUR.DOMAIN. Thats where Debian (and most other distributions) stores it’s websites. As our WordPress installation is in /usr/share/wordpress, we need to create a symlink:
# ln -s /usr/share/wordpress /var/www/YOUR.DOMAIN
Now we change some filesystem permissions to be able to upload content:
# chown -R www-data:www-data ./wp-content
If you want to change the look of your permalinks you need an writeable .htaccess file in your root directory and mod_rewrite to be enabled:
# touch .htaccess
# chown www-data:root .htaccess
# a2enmod rewrite
For this to work make sure you have “
AllowOverride All” set for your document root. Our apache site config already has it included. After changing the permalinks (this can be done later) you can make it read-only again:
# chmod 440 .htaccess
To enable your blog enter:
# a2ensite YOUR.DOMAIN
# apache2ctl restart
You should now be able to open http://YOUR.DOMAIN/wp-admin/install.php in your browser and finalize your blog setup. Enjoy.