WordPress Installation unter Linux

Updaten

apt-get update
apt-get upgrade

Schritt 1 – Installiere einen MySQL Server

apt-get -y install mysql-server
mysql_secure_installation
$ mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

You already have a root password set, so you can safely answer 'n'.

Change the root password? [Y/n] n
... skipping.

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
... Success!

Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
... Success!

By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment. 

Remove test database and access to it? [Y/n] y
- Dropping test database...
ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist
... Failed! Not critical, keep moving...
- Removing privileges on test database...
... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately. 

Reload privilege tables now? [Y/n] y
... Success!

Cleaning up...

All done! If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

Schritt 2 – Erhöhe die Sicherheit deines MySQL Servers

mysql -u root -p

create database wordpress;
create user wordpress@localhost identified by 'mein_passwort';
grant all privileges on wordpress.* to wordpress@localhost;
flush privileges;
exit;

Schritt 4 – Apache installieren

apt-get update
apt-get install apache2 php7.4 php7.4-mysql libapache2-mod-php7.4
service apache2 restart
apt-get install php7.4-xml php7.4-curl php7.4-gd php7.4-mbstring
apt-get install php7.4-bz2 php7.4-zip php7.4-xml php7.4-curl
apt-get install php7.4-json php7.4-opcache php7.4-readline

Konfiguration

nano /etc/apache2/sites-available/wordpress.conf
<VirtualHost *:80>
    ServerAdmin master@domain.com
    DocumentRoot /var/www/html/wordpress/
    ServerName festival.it-hense.de

    Alias /nextcloud "/var/www/html/wordpress/"

    <Directory /var/www/html/wordpress/>
       Options +FollowSymlinks
       AllowOverride All
       Require all granted
         <IfModule mod_dav.c>
           Dav off
         </IfModule>
       SetEnv HOME /var/www/html/wordpress
       SetEnv HTTP_HOME /var/www/html/wordpress
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>
a2ensite wordpress.conf
a2enmod rewrite
a2enmod ssl
a2enmod headers
a2enmod env
a2enmod dir
a2enmod mime
service apache2 restart

PHP konfiguration

sudo nano /etc/php/7.4/apache2/php.ini
file_uploads = On
max_execution_time = 300
memory_limit = 256M
post_max_size = 16G
max_input_time = 60
max_input_vars = 4440
session.gc_maxlifetime = 7200
sudo service apache2 restart

Schritt 5 – WordPress herunterladen und konfigurieren

cd /tmp
wget https://wordpress.org/latest.tar.gz
tar -zxvf latest.tar.gz
mv wordpress /var/www/html/
chown www-data.www-data /var/www/html/wordpress/* -R

Nun nur noch die Seite mittels der IP / Hostname oder Domain ansurfen und WordPress fertig einrichten.