My new blog and the first entry. What could that be? Of course … The installation of the WordPress site.
Since I deal a lot with Microsoft technologies professionally – privately, too – of course 🙂 – I have decided to host the WordPress site in Azure.
The installation will not be a Docker container, but a native installation under Debian 10.
We will do the following:
- Creation of the server in Azure
- Install LAMPS (Linux, Apache, MySQL – in our case MariaDB, PHP, SSL)
- Setting up WordPress
1.) Setting up a Debian 10 server on Microsoft Azure
In order to be able to operate a VM in Azure, you first have to create an account.
New customers get a free credit of € 200 from Microsoft for 30 days.
So you can take a look at the Azure options in peace.
After you have created an account, you should be given the opportunity to create a new resource
On the left side you now have the option to select the “Compute” category.
Then on the right side “Virtual Computer”
Now you have to enter the data for the virtual machine.
Maybe we should briefly clarify a few terms.
Resoucce group:
A resource group contains the Azure resources that you want to manage in a group. For example, administrative permissions can be assigned at the resource group level. Resources can be moved from one resource group to another at any time. Resources within a resource group can also be located in different geographic data centers.
Region:
A region is a set of Azure data centers in a specific region. With regard to the GDPR, we should always try to select a German region here. For example “(Europe) Germany, West-Center.
Drives:
Here you can select the performance classes your disk should have for your VM.
It’s worth taking a look here:
Select a disk type for Azure IaaS VMs – managed disks – Azure Virtual Machines | Microsoft Docs
If the syntax of all the data has been entered correctly, you can now click “check and create” to get another overview. If everything is still correct, then simply click “Create” to create the VM. It’ll take a few minutes now.
After everything has been set up, you should now see something like this:
In the case of the “public IP address” it is worthwhile to click inside and under “Configuration” to set the IP address assignment to “Static”. So your public IP always stays the same.
The “network security group” can be used to filter network traffic to and from Azure resources. Of course, the corresponding rules for HTTP, HTTPS and SSH must be entered here.
HTTP: Incoming traffic for the Let’s Encrypt challenge and for website redirection to https
HTTPS: the actual encrypted web traffic
SSH: for remote administration of the VM via, for example, PuTTY.
It should look something like this.
I have restricted it a bit for the facility. Later, under HTTPS, the source will be “All”:
Then you can switch to the VM with PuTTY.
Now is the right time to set the DNS name for your web server. You will need this at the latest when you request your certificate for the web server.
2. ) Install Apache Webserver
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install apache2 apache2-utils
The Apache2 web server should now be installed.
After successful installation you can have the status displayed as follows
sudo systemctl status apache2
The whole thing should now look something like this
Now we should let Apache start automatically when the system reboots
sudo systemctl enable apache2
If you now open your browser and enter the public IP of your server into the browser, you should get the first response from your web server
3.) Install MariaDB Dateabase Server
sudo apt-get install mariadb-server mariadb-client
auch hier könnt ihr euch nach der Installation wieder den Status anzeigen lassen
sudo systemctl status mariadb
Activate the automatic start here as well
sudo systemctl enable mariadb
Now execute the comand for the configuration of MariaDB
sudo mysql_secure_installation
in order to test the access to the database server, we connect as root
sudo mariadb -u root
By default, the Debian MariaDB package connects to the unix_socket. This means that it uses the currently logged in user for the database login. In our case this is root. So we are not asked for a PW
4.) Enable Apache2 for Let’s Encrypt certificate (Certbot)
First we have to activate the backports for APT
echo "deb http://deb.debian.org/debian buster-backports main" | sudo tee /etc/apt/sources.list.d/backports.list
sudo apt-get update
Now install Certbot
sudo apt-get install certbot python-certbot-apache
and create and adapt the Apache config
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/your.domain.de.conf
Insert the directive “ServerName your.domain.de” in the your.domain.de.conf.
Now activate the new page and deactivate the default site
sudo a2ensite eure.domain.de
sudo a2dissite 000-default
sudo systemctl reload apache2
briefly request a certificate with Certbot. The -d is the host name for which the certificate should be issued.
It is important here that the http access to your web server works with the DNS name you have set.
sudo certbot --apache -d your.domain.de
ok. The web server should now be accessible with https.
5.) WordPress basic installation
Download the current WordPress version
sudo wget https://de.wordpress.org/latest-de_DE.tar.gz -O /tmp/latest-de_DE.tar.gz
Extract the files
sudo tar -xzvf latest-de_DE.tar.gz
and copy the extract files to /var/www/html Verteichnis:
sudo cp /tmp/wordpress/* /var/www/html/ -R
Before we call the WordPress installation script, create the database:
sudo mariadb -u root
MariaDB> create database WordPress;
MariaDB> grant all privileges on WordPress.* TO 'WPUser'@'localhost' identified by 'Passwort’;
MariaDB> flush privileges;
Once again set the permissions for the installation to the /var/www/html directory:
cd /var/www/html
sudo chown www-data:www-data -R *
find . -type d -exec sudo chmod 755 {} \;
find . -type f -exec sudo chmod 644 {} \;
And start setting up WordPress by going to https://your.domain.de/wp-admin/install.php with your browser.
After the configuration, you can adjust the permissions a little bit
sudo chown root:root -R *
sudo chown www-data:www-data wp-content
Schreibe einen Kommentar