Installing WordPress in Debian Stretch is a process quite similar to the one I already described for FreeBSD in a previous post.

FreeBSD is a great option for a server, but at times I find myself wanting to do a bit of Drupal/Wordpress developing for some personal project,  and it may happen that I don’t have a development environment ready. When that happens I use a Debian VM to quickly set up a WordPress installation that I can use for testing.

The process I am describing here is not the one I use in production: some of the shortcuts I take here regarding directory installation, use of packages etc are simply not possible in a real production environment -or not advisable- but it is good enough for a local testing environment. It allows you to install in minutes a WordPress so you can jump quickly to the developing or testing of plugins/themes.

Setting up LAMP

Supposing we already got a Debian Stretch system installed, we need to install and configure Apache, PHP and MariaDB before we can start installing WordPress.

Installing MariaDB

apt-get install mariadb-server

Log as root into your newly installed MariaDB server:

mysql -u root -p

When asked provide a root password.

Installing Apache and PHP

Now we could install Apache using the Debian Stretch package manager, configure it, and then install – using again the package manager- the necessary PHP packages.

But there are a couple of packages in the Debian repository that will install those both as dependencies:

  • wordpress package
  • PHPMyAdmin

We might use the  wordpress package, but there is a catch: the version in the Debian Stretch repositories may be a bit old, if we download WordPress from the official site we will get a newer version.

It happens that I like using a mysql client – the mysql console is fun only to a certain degree 😉 – so I will download the WordPress from the official site, and install PHPMyAdmin to use as a mysql client which happily will also install and configure Apache and PHP ;-):

apt-get install phpmyadmin

When the installation asks which server to use select Apache2.

The installation script will also ask you to introduce a password to use for the phpmyadmin user.

In a real production environment I would do some extra configuration: I would go to the sites-available directory to create a configuration file dedicated to my WordPress configuration.I would also use Apache virtual directories; but as I said before this is a very simple set up for a local development environment that requires almost not setup. So I will just move to the next step that is downloading WordPress and copy it to the default Apache web directory.

Installing WordPress

Download the 5.2.1 version of WordPress from wordpress.org.

Unpack and configure WordPress

Unpack the wordpress tar we downloaded from the wordpress site:

tar xpf wordpress-5.2.1.tar.gz

Copy it to the apache web directory:

cp -r wordpress /var/www/html

Update the ownership of the wordpress folder:

chown -R www-data:www-data /var/www/html/wordpress/*

Create WordPress database

Log into Maria DB:

mysql -u root -p

Create the database for your WordPress site:

create database wordpress

Create a user for the wordpress dabase:

CREATE USER worduser@localhost IDENTIFIED BY 'myT0r6ar';
Grant permissions:

GRANT ALL PRIVILEGES ON `wordpress`.* TO `worduser`@`localhost`;
FLUSH PRIVILEGES;
exit

Open a browser and introduce the url localhost/wordpress and finish the WordPress configuration by using the web Wizard. The wizard will ask you the database connection data:
wordpress_database_settings

And will ask you to provide an user and password to use in your WordPress site.And with that you will have WordPress installed and ready to use 🙂

Advertisements