Update: As Ubuntu is quite similar to Debian, this howto can also be used for Ubuntu systems. Ive 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 Debians file locations. You need a running LAMP configuration and root permissions to perform the next steps. Ill 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
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 wpwww.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
mySQL
Now its time to create a mysql database where WordPress stores its data in:
# mysql -uroot -p
Enter your mysql root password and youll see the mysql prompt. Well create a user and a database called wordpress:
# GRANT ALL PRIVILEGES ON wordpress.* TO wordpress IDENTIFIED BY "S3cr3t!"; # FLUSH PRIVILEGES; # quit
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 define('DB_NAME', 'wordpress'); /** MySQL database username */ define('DB_USER', 'wordpress'); /** MySQL database password */ define('DB_PASSWORD', 'S3cr3t!'); /** MySQL hostname */ define('DB_HOST', 'localhost');
Please delete everything under this line as its already included in /usr/share/wordpress/wpconfig.php
Apache
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
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 its 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
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
You should now be able to open http://YOUR.DOMAIN/wp-admin/install.php in your browser and finalize your blog setup. Enjoy.