- Log into the Debian device
- Run the following commands in a terminal:
# update repositories and install any available software updates
sudo apt update
sudo apt upgrade -y
# install Apache HTTPD and MySQL
sudo apt-get install apache2 mariadb-server mariadb-client curl
# install PHP components
sudo apt install php php-mysql php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip
# configure the MySQL database
sudo su
mysql_secure_installation - Press Enter to login as root
- Type Y and press Enter to set a root password, type the password twice to confirm
- Type Y and press Enter to remove anonymous users
- Type Y and press Enter to disallow root login remotely
- Type Y and press Enter to remove the test database
- Type Y and press Enter to reload privilege tables
- Run the following command to login into MySQL:
mysql -u root -p
- Authenticate with the root password set earlier
- Run the following commands to create the WordPress database and database user
CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
GRANT ALL ON wordpress.* TO 'wordpress_user'@'localhost' IDENTIFIED BY 'W0rdPr3ss!!';
FLUSH PRIVILEGES;
EXIT;
exit - Continue with the following commands to download and extract WordPress in the Apache webroot
# download latest wordpress version
sudo wget https://wordpress.org/latest.tar.gz
# extract latest.tar.gz
sudo mkdir /var/www/wordpress
sudo tar xzvf latest.tar.gz --directory /var/www
# create a new wordpress.conf file to configure the site
sudo nano /etc/apache2/sites-available/wordpress.conf - Paste the following configuration into wordpress.conf
Alias /wordpress "/var/www/wordpress/"
<Directory /var/www/wordpress/>
AllowOverride All
</Directory> - Press CTRL+O, Enter, CTRL+X to write the changes to wordpress.conf
- Continue with the following commands to enable the site and restart Apache:
# enable the Wordpress site and required PHP modules
sudo a2ensite wordpress
sudo a2enmod rewrite
# create a .htaccess file
sudo touch /var/www/wordpress/.htaccess
# copy the sample wordpress config
sudo cp /var/www/wordpress/wp-config-sample.php /var/www/wordpress/wp-config.php
# create an upgrade directory
sudo mkdir /var/www/wordpress/wp-content/upgrade
# set the owner of the new wordpress directory to www-data
sudo chown -R www-data:www-data /var/www/wordpress
# change additional permissions
sudo find /var/www/wordpress/ -type d -exec chmod 750 {} \;
sudo find /var/www/wordpress/ -type f -exec chmod 640 {} \;
# generate secure secret keys, copy the output for use shortly
curl -s https://api.wordpress.org/secret-key/1.1/salt/
# edit wp-config.conf
sudo nano /var/www/wordpress/wp-config.php - Press CTRL+W and search for define('AUTH_KEY'
- Paste the secure secret keys generated earlier, overwriting the template
- Press CTRL+W and search for define('DB_NAME'
- Update the database name, username and password
- Press CTRL+W and search for define('FS_METHOD'
- Set the value to 'direct'
- Press CTRL+O, Enter, CTRL+X to write the changes to wp-config.conf
- Continue the setup by running the following commands in terminal
# restart apache2 service
sudo systemctl restart apache2 - Open a web browser and navigate to http://DNSorIP/wordpress
- The Wordpress setup screen should be displayed
- Select a language > Click Continue
- Create a site title and WordPress login > Click Install WordPress
- When the installation completes, login with the WordPress credentials created in the previous step
- Welcome to your very own, self-hosted WordPress installation