There are two possibilities to install WordPress on Debian. Either it is possible to use the Debian apt-get install method or install direct the latest version from WordPress.org site. While Debian version is pretty old and some functionality and interoperability will be lost with the older versions (like using some website themes), I prefer installing the latest version.
WordPress needs a webserver, a database and a PHP-interpreter (PHP = Hypertext Preprocessor). I use Apache as a web-server, MySQL as a database and PHP5 interpreter. Some additional components for network communication (php5-curl) and image manipulation (php5-gd) are proposed as well. In Debian 8 Jessie they can be installed with a command on command line as root
1 2 |
sudo apt-get update sudo apt-get install apache2 mysql-client mysql-server php5 php5-mysql php5-curl php5-gd |
You need to define password for the MySQL root-user. This password is needed when you make a database for the WordPress. It can be made either with a helper application like phpMyAdmin or direct with the MySQL-client. I use the commandline client.
1 |
mysql -u root -p |
in the MySQL-client you will create for the wordpress a database called wordpressDB and a user called wordpress with a password (replace password with your own).
1 2 3 4 5 |
CREATE DATABASE wordpressDB; CREATE USER wordpress@localhost IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON wordpressDB.* TO wordpress@localhost; FLUSH PRIVILEGES; exit |
Now you can download WordPress and install it by uncompressing the file.
1 2 3 4 5 6 |
wget -c http://wordpress.org/latest.zip unzip -q latest.zip -d /var/www/html/ chown -R www-data.www-data /var/www/html/wordpress chmod -R 755 /var/www/html/wordpress mkdir -p /var/www/html/wordpress/wp-content/uploads chown -R www-data.www-data /var/www/html/wordpress/wp-content/uploads |
Now you can edit the WordPress configuration file
1 2 3 |
cd /var/www/html/wordpress/ cp wp-config-sample.php wp-config.php nano wp-config.php |
by adding the right database and user name and the password.
Then you can allow the automatic core updates by adding to wp-config.php the following line
1 |
define( 'WP_AUTO_UPDATE_CORE', true ); |
Now you can configure you web-server by adding following configure file to /etc/apache2/sites-available/myblog.com
1 2 3 4 5 6 7 8 9 10 11 |
<VirtualHost *:80> ServerName myblog.com ServerAlias myblog.com www.myblog.com DocumentRoot /var/www/html/wordpress DirectoryIndex index.php <Directory /var/www/html/wordpress> AllowOverride All Order Deny,Allow Allow from all </Directory> </VirtualHost> |
You need to have mod_rewrite and mod_vhost_alias modules enabled by giving on a command line
1 |
a2enmod rewrite && a2enmod vhost_alias && service apache2 restart |
Finally you can enable your website
1 2 |
a2ensite myblog.com service apache2 reload |
After that you can configure your site by going with the web-browser to the address of your blog (like www.myblog.com).