Tutorial Debian 10 : Cara Instalasi phpMyAdmin dan Maria DB Server Menggunakan Nginx Web Server
phpMyadmin merupakan salah satu perangkat lunak berbasis web yang digunakan untuk memudahkan dalam administrasi database mysql dan mariadb seperti membuat dan menghapus database, membuat table, dan operasi lain yang berkaitan dengan database mysql atau mariadb. Pada kesempatan ini saya akan memberikan tutorial bagaimana menginstall phpmyadmin dan maridb server pada Debian 10, yang tentunya menggunakan nginx web server.
# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster
1. Sudah Menginstall Web Server
Hal pertama yang harus disiapkan adalah kalian harus sudah menyiapkan web server untuk menginstall phpmyadmin. Pada tutorial ini kita akan menggunakan Nginx sebagai web servernya dan juga sudah bisa menjalankan PHP yang tentunya pada tutorial sebelumnya saya sudah membahasnya.
# nginx -v
nginx version: nginx/1.14.2
# php --version
PHP 7.3.14-1~deb10u1 (cli) (built: Feb 16 2020 15:07:23) ( NTS )
Copyright (c) 1997-2018 The PHP Group
2. Update & Upgrade
Update terlebih dahulu repository kalian dengan perintah apt update
atau jika pada mode user maka jangan lupa tambahkan sudo pada setiap perintah sudo apt update
, kemudian upgrade Debian kalian dengan perintah apt upgrade
atau kalian dapat menggabungkan kedua perintah tersebut apt update && apt upgrade
. Jika kalian menggunakan repository online maka pastikan internet kamu stabil dan lancar kalian dapat mengujinya menggunakan untilitas ping
.
# apt update && apt upgrade
3. Instalasi MariaDB-Server
Untuk menginstall mariadb-server sangatlah mudah cukup dengan mengetikan apt install mariadb-server
.
# apt install mariadb-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
galera-3 gawk libaio1 libcgi-fast-perl libcgi-pm-perl libconfig-inifiles-perl libdbd-mysql-perl
libdbi-perl libencode-locale-perl libfcgi-perl libhtml-parser-perl libhtml-tagset-perl
libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl liblwp-mediatypes-perl
libmariadb3 libmpfr6 libreadline5 libsigsegv2 libsnappy1v5 libterm-readkey-perl libtimedate-perl
liburi-perl mariadb-client-10.3 mariadb-client-core-10.3 mariadb-common mariadb-server-10.3
mariadb-server-core-10.3 mysql-common rsync socat
Suggested packages:
gawk-doc libclone-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl libdata-dump-perl
libipc-sharedcache-perl libwww-perl mailx mariadb-test netcat-openbsd tinyca
The following NEW packages will be installed:
galera-3 gawk libaio1 libcgi-fast-perl libcgi-pm-perl libconfig-inifiles-perl libdbd-mysql-perl
libdbi-perl libencode-locale-perl libfcgi-perl libhtml-parser-perl libhtml-tagset-perl
libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl liblwp-mediatypes-perl
libmariadb3 libmpfr6 libreadline5 libsigsegv2 libsnappy1v5 libterm-readkey-perl libtimedate-perl
liburi-perl mariadb-client-10.3 mariadb-client-core-10.3 mariadb-common mariadb-server
mariadb-server-10.3 mariadb-server-core-10.3 mysql-common rsync socat
0 upgraded, 34 newly installed, 0 to remove and 0 not upgraded.
Need to get 22.2 MB of archives.
After this operation, 170 MB of additional disk space will be used.
Do you want to continue? [Y/n] [Tekan y untuk melanjutkan]
Setelah instalasi selesai sekarang kita akan memberikan password root untuk mariadb-server karena secara default mariadb tidak memiliki password dan tentunya ini menjadikan database kita menjadi tidak aman.
# mysql -u root
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 49
Server version: 10.3.22-MariaDB-0+deb10u1 Debian 10
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
Untuk meberikan password caranya cukup mudah hanya dengan perintah mysql_secure_installation
. Dan pada New password:
ketikan password kalian jika sudah tekan enter
diline selanjutnya Re-enter new password:
kalian diminta untuk memasukan konfirmasi password.
# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, 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): [enter]
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB 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, MariaDB 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...
... Success!
- 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 MariaDB
installation should now be secure.
Thanks for using MariaDB!
Instalasi dan konfigurasi password pada mariadb selesai. Maka kita dapat login menggunakan password yang telah kita buat tadi.
# mysql -u root -p
Enter password: [masukan password yang kalian buat tadi]
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 59
Server version: 10.3.22-MariaDB-0+deb10u1 Debian 10
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
3 rows in set (0.001 sec)
MariaDB [(none)]> [ctrl+d] #untuk keluar dari mysql shell
4. Instalasi phpMyadmin
Pada tahap ini pastikan lagi kalian sudah mengistall web server Nginx dan PHP. Jika belum maka kalian harus menginstallnya terlebih dahulu untuk lebih jelasnya kalian bisa menbaca postingan sebelumnya. Install dependensi yang diperlukan oleh phpmyadmin terlebih dahulu.
# apt install php-cli php-json php-gettext php-mbstring php-mysql php-xml php-curl php-php-gettext wget
Di versi Debian sebelumnya kita bisa menginstall debian dengan cara mengetikan apt install phpmyadmin
. Karena pada Debian 10 ini sudah tidak ada paket phpMyadmin lagi maka kita download installer phpmyadmin terlebih dahulu.
# wget http://ftp.br.debian.org/debian/pool/main/p/phpmyadmin/phpmyadmin_4.6.6-4_all.deb
--2020-03-21 17:19:15-- http://ftp.br.debian.org/debian/pool/main/p/phpmyadmin/phpmyadmin_4.6.6-4_all.deb
Resolving ftp.br.debian.org (ftp.br.debian.org)... 200.236.31.3
Connecting to ftp.br.debian.org (ftp.br.debian.org)|200.236.31.3|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3910838 (3.7M) [application/x-debian-package]
Saving to: ‘phpmyadmin_4.6.6-4_all.deb’
phpmyadmin_4.6.6-4_all.deb 100%[======================================================>] 3.73M 155KB/s in 46s
2020-03-21 17:20:02 (83.1 KB/s) - ‘phpmyadmin_4.6.6-4_all.deb’ saved [3910838/3910838]
Setelah installer phpmyadmin_4.6.6-4_all.deb
berhasil didownload maka saat nya kita untuk memulai instalasi paket. Caranya adalah dpkg -i phpmyadmin_4.6.6-4_all.deb
.
# dpkg -i phpmyadmin_4.6.6-4_all.deb
Selecting previously unselected package phpmyadmin.
(Reading database ... 36223 files and directories currently installed.)
Preparing to unpack phpmyadmin_4.6.6-4_all.deb ...
Unpacking phpmyadmin (4:4.6.6-4) ...
dpkg: dependency problems prevent configuration of phpmyadmin:
phpmyadmin depends on php; however:
Package php is not installed.
phpmyadmin depends on libjs-sphinxdoc (>= 1.0); however:
Package libjs-sphinxdoc is not installed.
phpmyadmin depends on dbconfig-mysql | dbconfig-no-thanks | dbconfig-common (<< 2.0.0); however:
Package dbconfig-mysql is not installed.
Package dbconfig-no-thanks is not installed.
Package dbconfig-common is not installed.
phpmyadmin depends on php-phpseclib (>= 2.0); however:
Package php-phpseclib is not installed.
dpkg: error processing package phpmyadmin (--install):
dependency problems - leaving unconfigured
Processing triggers for man-db (2.8.5-2) ...
Errors were encountered while processing:
phpmyadmin
Nah jika terjadi error seperti pada diatas maka tak usah panik itu disebabkan karena dependesi yang diperlukan untuk mengistall phpMyadmin masih kurang kita dapat memperbaikinya dengan cara apt install -f
.
# apt install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
dbconfig-common dbconfig-mysql javascript-common libjs-jquery libjs-sphinxdoc libjs-underscore php php-phpseclib php7.3
Suggested packages:
php-libsodium php-mcrypt php-gmp
The following NEW packages will be installed:
dbconfig-common dbconfig-mysql javascript-common libjs-jquery libjs-sphinxdoc libjs-underscore php php-phpseclib php7.3
0 upgraded, 9 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 1,364 kB of archives.
After this operation, 4,209 kB of additional disk space will be used.
Do you want to continue? [Y/n] [Tekan y untuk melanjutkan]