Contenus
The first post right after the installation of WordPress is dedicated to its installation on this VPS.
This VPS is running Debian Jessie.
The installation is inspired from the Debian Wiki using the alternative method.
There are some differences with an Ubuntu installation that will be highlighted.
This post will cover the installation from the package manager, probably a specific post will cover the installation of the latest version.
Installation of the packages
Before to start with the installation of WordPress,
let’s make sure your server is up-to-date.
# sudo apt-get update && apt-get upgrade
Installation of the WebServer
I decided to use « Apache » as web server if it is not already installed
# sudo apt-get install apache2
if you just installed Apache, the installed version will be 2.4, if you have already apache on your server, it could be worth to check the running version with the following command:
# apache2 -v
This will be important later when creating the site as there are differences in the configuration depending on the Apache version
Another popular web server like NGINX could have been another option.
Installation of the DataBase Management system
# sudo apt-get install mysql-server
Installation of WordPress
The WordPress package from the Jessie depot
# sudo apt-get install wordpress
This will install the version 7.2 as it is the current version in the depot
or if you want to install a newer version from the backports depot
# sudo apt-get install -t jessie-backports wordpress
This will install the version 7.5
in both scenarios, it is not the latest version…
You can, of course, install all the packages in one shot, I just separated the instructions for clarity
# sudo apt-get install wordpress apache2 mysql-server
Helper script
The WordPress package contains a « helper script »
According to the Debian wiki, the helper script is:
/usr/share/doc/wordpress/examples/setup-mysql
On my installation, I had only a gz file, so I had first to uncompress the file with gzip
# cd /usr/share/doc/wordpress/examples # gzip -d setup-mysql.gz
Once uncompressed you can run the script, it will create the WordPress database and specific config file for your site.
Some parameters can be passed to the script,
you can open the script to see what parameters can be provided:
Options: -n name for the wordpress site; see also -e below -h help -d destroy and purge -b backup -u mysql username, will require password -t mysql server hostname, if unset localhost will be used -e existing empty mysql database name; will replace -n
As an example, if you want your site/blog to be served from http://blog.example.com for user ‘wordpress’,
you should use the following command:
# sudo setup-mysql -n wordpress blog.example.com
and this will create for you the configuration file
/etc/wordpress/config-blog.example.com.php
Once you executed the script, please make sure that configuration file contains the expected information (db_name, db_user, db_password, db_host).
Remarks:
- The configuration file /usr/share/wordpress/wp-config.php should not be updated,
you need to update the specific file for your site (in this example /etc/wordpress/config-blog.example.com.php)
Apache site / vhost
You need to create a site on apache, the WordPress package install an example of configuration that you can read in
/usr/share/doc/wordpress/examples/apache.conf
Create the site
So the first step is to create the site in Apache, this is simply a config file to be created, so based on the example provided, you can create the following file
# sudo nano /etc/apache2/sites-available/myblog.conf
and paste the following content:
<VirtualHost *:80> ServerAdmin [email protected] ServerName myblog.example.com ServerAlias www.myblog.exampe.com DocumentRoot /usr/share/wordpress/ DirectoryIndex index.php index.html ErrorLog /var/log/apache2/wp-error.log TransferLog /var/log/apache2/wp-access.log # wp-content in /var/lib/wordpress/wp-content Alias /wp-content /var/lib/wordpress/wp-content <Directory /usr/share/wordpress> Options FollowSymLinks <IfVersion < 2.3> Order allow,deny Allow from all </IfVersion> <IfVersion >= 2.3> Require all granted </IfVersion> </Directory> <Directory /var/lib/wordpress/wp-content> Options FollowSymLinks <IfVersion < 2.3> Order allow,deny Allow from all </IfVersion> <IfVersion >= 2.3> Require all granted </IfVersion> </Directory> </VirtualHost>
Remarks:
in this example:
- Your domain is example.com and you are using HTTP protocol, so your WordPress blog is accessible via
– http://myblog.example.com
– http://www.myblog.example.com
– but not https. - This configuration uses the default location for the wp-content folder (/var/lib/wordpress/wp-content) if you specify a different location in your wordpress configuration file, that should be adjusted.
- A DNS zone has been created for blog.example.com and www.blog.example.com
Modules to activate
You need to activate 2 apache modules
# sudo a2enmod rewrite # sudo a2enmod vhost_alias
Activate the site
# sudo a2ensite myblog.com
replace myblog.com with the name of your site
(the filename in /etc/apache2/sites-available/myblog.com)
Reload apache
# sudo service apache2 reload
WordProcess configuration process
Finally, browse to your domain (myblog.example.com in this post) and follow the normal WP configuration process, and you should be done.
WordPress upgrade
As long as you want to upgrade to a version of the Debian packages, you only need to issue the usual command to update packages
# sudo apt-get update && apt-get upgrade