You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
3.0 KiB

3 years ago
---
id: debian-phpmyadmin-installieren
title: phpMyAdmin installieren (Debian 10)
sidebar_label: phpMyAdmin installieren
---
Installation von Docker und optional Docker-Compose auf Debian 10
## Informationen
In diesem Tutorial wird dir gezeigt, wie du phpMyAdmin auf einem VPS oder Dedicated Server installierst. Du benötigst dafür Debian 10 und Root Rechte.
Melde dich zunächst als root mit dem SSH Client deiner Wahl an, z.B. PuTTY oder Terminus.
### Installation
1. Sobald du angemeldet bist solltest du deinen Server aktualisieren. Führe dazu folgendes aus:
```sh
apt-get update && apt-get upgrade -y
```
2. Gib nun folgendes in deine Kommandozeile ein:
```sh
apt install ca-certificates apt-transport-https lsb-release gnupg curl nano unzip -y
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php.list
wget -q https://packages.sury.org/php/apt.gpg -O- | apt-key add -
apt-get update && apt-get upgrade -y
apt install apache2 -y
apt install php7.4 php7.4-cli php7.4-curl php7.4-gd php7.4-intl php7.4-json php7.4-mbstring php7.4-mysql php7.4-opcache php7.4-readline php7.4-xml php7.4-xsl php7.4-zip php7.4-bz2 libapache2-mod-php7.4 -y
apt install mariadb-server mariadb-client -y
mysql_secure_installation
```
Diese Installation kann, je nach Serverleistung, ein wenig Zeit in Anspruch nehmen.
3. Nun wechselst du das Verzeichnis:
```sh
cd /usr/share
```
4. Lade nun PHPMyAdmin herunter, entpacken diese und vergebib die nötigen Rechte.
```sh
wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.zip -O phpmyadmin.zip
unzip phpmyadmin.zip
rm phpmyadmin.zip
mv phpMyAdmin-*-all-languages phpmyadmin
chmod -R 0755 phpmyadmin
```
5. Erstelle nun eine Datei für Apache2.
```sh
nano /etc/apache2/conf-available/phpmyadmin.conf
```
In diese Datei muss folgender Inhalt:
```sh
# phpMyAdmin Apache configuration
Alias /phpmyadmin /usr/share/phpmyadmin
<Directory /usr/share/phpmyadmin>
Options SymLinksIfOwnerMatch
DirectoryIndex index.php
</Directory>
# Disallow web access to directories that don't need it
<Directory /usr/share/phpmyadmin/templates>
Require all denied
</Directory>
<Directory /usr/share/phpmyadmin/libraries>
Require all denied
</Directory>
<Directory /usr/share/phpmyadmin/setup/lib>
Require all denied
</Directory>
```
6. Aktiviere nun die Datei und reloade Apache2:
```sh
a2enconf phpmyadmin
systemctl reload apache2
```
7. Erstelle nun ein Verzeichnis und vergib die nötigen Recht.
```sh
mkdir /usr/share/phpmyadmin/tmp/
chown -R www-data:www-data /usr/share/phpmyadmin/tmp/
```
6. Nun erstellst du einen User.
```sh
mysql -u root
CREATE USER 'DEINWUNSCHBENUTZERNAME'@'localhost' IDENTIFIED BY 'DEINWUNSCHPASSWORT';
GRANT ALL PRIVILEGES ON *.* TO 'DERERSTELLTEWUNSCHNAME'@'localhost' WITH GRANT OPTION;
exit
```