WordPress auf RHEL
WordPress benötigt einen LAMP-Stack: Apache als Webserver, MariaDB als Datenbank und PHP als Laufzeitumgebung. Auf RHEL kommt erschwerend hinzu, dass SELinux mitdenkt — und konfiguriert werden muss.
Überblick
Abschnitt betitelt „Überblick“Browser → Apache (httpd) → PHP-FPM → WordPress ↓ MariaDB1. Pakete installieren
Abschnitt betitelt „1. Pakete installieren“sudo dnf install httpd mariadb-server php php-mysqlnd php-fpm \ php-json php-xml php-mbstring php-gd php-zip php-curlPHP-Version prüfen (WordPress empfiehlt ≥ 8.1):
php -vNeuere PHP-Versionen über das Remi-Repository:
sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpmsudo dnf module switch-to php:remi-8.32. Dienste starten
Abschnitt betitelt „2. Dienste starten“sudo systemctl enable --now httpdsudo systemctl enable --now mariadbsudo systemctl enable --now php-fpm3. MariaDB absichern und Datenbank anlegen
Abschnitt betitelt „3. MariaDB absichern und Datenbank anlegen“sudo mysql_secure_installation# → root-Passwort setzen, anonyme Benutzer entfernen,# Remote-Root deaktivieren, Test-Datenbank entfernensudo mysql -u root -pCREATE DATABASE wordpress CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'sicheres-passwort';GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'localhost';FLUSH PRIVILEGES;EXIT;4. WordPress herunterladen
Abschnitt betitelt „4. WordPress herunterladen“cd /var/www/htmlsudo curl -O https://wordpress.org/latest.tar.gzsudo tar -xzf latest.tar.gzsudo rm latest.tar.gz
# Eigenes Verzeichnis (empfohlen statt Webroot direkt)sudo mv wordpress /var/www/html/wordpress5. Konfiguration
Abschnitt betitelt „5. Konfiguration“sudo cp /var/www/html/wordpress/wp-config-sample.php \ /var/www/html/wordpress/wp-config.php
sudo nano /var/www/html/wordpress/wp-config.phpFolgende Werte anpassen:
define( 'DB_NAME', 'wordpress' );define( 'DB_USER', 'wpuser' );define( 'DB_PASSWORD', 'sicheres-passwort' );define( 'DB_HOST', 'localhost' );Außerdem die Security Keys ersetzen — frische Werte von:
https://api.wordpress.org/secret-key/1.1/salt/
6. Dateirechte
Abschnitt betitelt „6. Dateirechte“sudo chown -R apache:apache /var/www/html/wordpresssudo find /var/www/html/wordpress -type d -exec chmod 755 {} \;sudo find /var/www/html/wordpress -type f -exec chmod 644 {} \;7. Apache Virtual Host
Abschnitt betitelt „7. Apache Virtual Host“sudo nano /etc/httpd/conf.d/wordpress.conf<VirtualHost *:80> ServerName wordpress.example.com DocumentRoot /var/www/html/wordpress
<Directory /var/www/html/wordpress> AllowOverride All Require all granted </Directory>
ErrorLog /var/log/httpd/wordpress-error.log CustomLog /var/log/httpd/wordpress-access.log combined</VirtualHost>sudo apachectl configtest # Syntax prüfensudo systemctl reload httpd8. SELinux konfigurieren
Abschnitt betitelt „8. SELinux konfigurieren“SELinux blockiert auf RHEL standardmäßig, was httpd schreiben und auf das Netz zugreifen darf. WordPress benötigt beides:
# Apache darf Dateien schreiben (für Updates, Uploads)sudo setsebool -P httpd_unified 1
# Apache darf Netzwerkverbindungen aufbauen (für APIs, Update-Checks)sudo setsebool -P httpd_can_network_connect 1
# Korrekte SELinux-Kontexte für WordPress-Verzeichnis setzensudo semanage fcontext -a -t httpd_sys_rw_content_t \ "/var/www/html/wordpress/wp-content(/.*)?"sudo restorecon -Rv /var/www/html/wordpress9. Firewall
Abschnitt betitelt „9. Firewall“sudo firewall-cmd --permanent --add-service=httpsudo firewall-cmd --permanent --add-service=httpssudo firewall-cmd --reload10. Installation abschließen
Abschnitt betitelt „10. Installation abschließen“Browser öffnen: http://wordpress.example.com
Der WordPress-Installationsassistent führt durch die abschließende Einrichtung (Seitentitel, Admin-Konto).
Permalinks aktivieren
Abschnitt betitelt „Permalinks aktivieren“Für sprechende URLs muss mod_rewrite in Apache aktiv sein und
.htaccess-Dateien erlaubt werden — das AllowOverride All im VirtualHost
oben deckt das bereits ab:
sudo dnf install mod_rewrite # falls nicht vorhandensudo systemctl restart httpdDann in WordPress: Einstellungen → Permalinks → gewünschte Struktur wählen und speichern.