In this guide we will be showing step by step how to install the latest version of WordPress (currently 4.2.2) and the entire software stack required for it to function on Debian 8 Jessie and Debian 7 Wheezy. This is a first install guide of WordPress and not an upgrade.
Preparing Your System For WordPress
1. LAMP Server Installation
First of all, we need to install the LAMP server so that you can run WordPress on Debian. LAMP means Linux/Apache/MySql/PHP. Before instal this programs you must become superuser (run ‘su‘ command). To do this, open the terminal and run these commands:
[me@linuxbox me]$ su
password:
[root@linuxbox me]# apt-get install apache2 mysql-client mysql-server php5 php5-mysql php5-curl php5-gd
During the installation you will be asked to enter a password for the MySQL root user:
Set any password of your choice then proceed.
2. Creating WordPress Database
Let’s now create a database for WordPress. From the terminal, write this (use the MySQL password set earlier):
[me@linuxbox me]$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5 to server version: 4.1.15-Debian_1-log
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.
mysql> _
Now run this sequence of commands to create the database, database user & password:
mysql> CREATE DATABASE wpdatabase;
mysql> CREATE USER wpuser@localhost IDENTIFIED BY ‘wppass’;
mysql> GRANT ALL PRIVILEGES ON wpdatabase.* TO wpuser@localhost;
mysql> FLUSH PRIVILEGES;
mysql> exit
[me@linuxbox me]$ _
Restart now Apache and MySQL servers with these commands so that changes are taken into effect:
[me@linuxbox me]$ service apache2 restart
[me@linuxbox me]$ service mysql restart
[me@linuxbox me]$ _
3. Installing WordPress
Open the terminal and issue these commands:
[me@linuxbox me]$ cd /tmp
[me@linuxbox me]$ wget -c http://wordpress.org/latest.zip
[me@linuxbox me]$ unzip -q latest.zip -d /var/www/html/
You now also need to change some permissions so that WordPress can work with that files and directories.
[me@linuxbox me]$ chown -R www-data.www-data /var/www/html/wordpress
[me@linuxbox me]$ chmod -R 755 /var/www/html/wordpress
[me@linuxbox me]$ mkdir -p /var/www/html/wordpress/wp-content/uploads
[me@linuxbox me]$ chown -R www-data.www-data /var/www/html/wordpress/wp-content/uploads
Let’s now insert our database details to the WordPress config file (wp-config.php). To do this, run these commands:
(Create config file from sample file)
[me@linuxbox me]$ cd /var/www/html/wordpress/
[me@linuxbox me]$ cp wp-config-sample.php wp-config.php
Edit the wp-config.php file with any text editor of your choice. For example, you can use gedit or nano:
[me@linuxbox me]$ gedit wp-config.php
or
[me@linuxbox me]$ nano wp-config.php
Then enter the database name, database user and password you have created earlier:
Save your file and exit. Finally open your browser and type this link to complete the installation of WordPress:
http://localhost/wordpress/
Then follow setup instructions: