Cara Install PHPMyAdmin Di Ubuntu 22.04 LTS Server Dengan Apache PHP MariaDB

Cara Install PHPMyAdmin Di Ubuntu 22.04 LTS Server Dengan Apache PHP MariaDB

Di artikel ini saya akan menjelaskan tentang cara install phpmyadmin di ubuntu 22.04 lts server dengan apache php mariadb. PHPMyAdmin merupakan aplikasi php yang bisa digunakan untuk mengelola database server seperti mariadb, mysql dan database server lainnya yang support dengan phpmyadmin. Banyak perusahaan penyedia layanan hosting yang menggunakan phpmyadmin. Jika anda pengguna ubuntu 22.04 lts server dan memerlukan aplikasi phpmyadmin, tentu anda harus menginstall web server, php dan database server.

Di tutorial ini saya menggunakan web server bernama apache dan database server bernama mariadb. Jadi tutorial ini khusus untuk tutorial cara menginstall phpmyadmin di ubuntu 22.04 lts server yang menggunakan apache sebagai web server, php sebagai bahasa pemrograman dan mariadb sebagai database server.

Untuk bisa menerapkan tutorial di artikel ini, berikut ini spesifikasi ubuntu 22.04 lts server yang anda perlukan.

  • Ram minimal 512 Megabyte.
  • Memiliki akses root atau user yang memiliki akses privilege sebagai root.
  • Memiliki ruang penyimpanan yang cukup, bisa harddisk atau ssd sekitar 5 gigabyte.

Jika spesifikasi ubuntu 22.04 lts server yang anda sewa seperti tersebut di atas, anda bisa menginstall phpmyadmin di web hosting server tersebut. Berikut ini langkah-langkah untuk menginstall phpmyadmin di ubuntu 22.04 lts server menggunakan web server apache.

  1. Login ke hosting server.
ssh -i opensshkey root@ip-server
  1. Update Ubuntu 22.04 LTS server. Untuk update Ubuntu 22.04 LTS server, ketik sintak baris perintah berikut. Kemudian tekan enter.
sudo apt update
  1. Install php. Di tutorial ini saya menggunakan php 8.3. Untuk menginstall php 8.3, ikuti langkah-langkah berikut ini.
  • Install aplikasi pendukung untuk repository https://launchpad.net.
apt install software-properties-common ca-certificates lsb-release apt-transport-https 
  • Tambahkan repository https://launchpad.net.
add-apt-repository ppa:ondrej/php
  • Update ubuntu 22.04 lts server.
apt update
  • Install php 8.3. Untuk menginstall php 8.3, ketik baris perintah berikut kemudian tekan enter.
apt install php8.3
  • Verifikasi apakah php 8.3 sudah berhasil diinstall.
php -v
  • Jika php 8.3 berhasil diinstall, di layar terminal ubuntu 22.04 lts server anda akan muncul seperti berikut ini.
PHP 8.3.2-1+ubuntu22.04.1+deb.sury.org+1 (cli) (built: Jan 20 2024 14:16:40) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.2, Copyright (c) Zend Technologies
    with Zend OPcache v8.3.2-1+ubuntu22.04.1+deb.sury.org+1, Copyright (c), by Zend Technologies
  • Install ekstensi modul php 8.3 yang diperlukan.
apt install php8.3-cli php8.3-mysql php8.3-common php8.3-imap php8.3-redis php8.3-xml php8.3-zip php8.3-mbstring php8.3-intl php8.3-curl
  1. Install apache. Untuk menginstall apache, ketik baris perintah berikut kemudian tekan enter.
apt install apache2
  1. Jalankan apache. Untuk menjalankan apache, ketik baris perintah berikut kemudian tekan enter.
systemctl start apache2
  1. Enable apache. Untuk mengenable apache, ketik baris perintah berikut kemudian tekan enter.
systemctl enable apache2
  1. Install mariadb. Untuk menginstall mariadb, ketik baris perintah berikut kemudian tekan enter.
apt install mariadb-server 
  1. Jalankan security script mariadb. Untuk menjalankan security script mariadb, ketik baris perintah berikut kemudian tekan enter.
mysql_secure_installation
  • Berikut ini contoh setting mariadb yang bisa anda gunakan ketika menjalankan security script.
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
haven't set the root password yet, you should just press enter here.

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

Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n] n
 ... skipping.

You already have your root account protected, so you can safely answer 'n'.

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

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!
  1. Login ke mariadb.
mariadb
  1. Buat user administrator database yang memiliki akses sebagai root untuk mengelola database yang digunakan di phpmyadmin.
CREATE USER 'admin'@'localhost' IDENTIFIED BY 'ztbha765^&';
GRANT ALL ON *.* TO 'admin'@'localhost' IDENTIFIED BY 'ztbha765^&' WITH GRANT OPTION;
flush privileges;
  1. Unduh aplikasi phpmyadmin dari website resminya di https://www.phpmyadmin.net.
wget https://files.phpmyadmin.net/phpMyAdmin/5.2.1/phpMyAdmin-5.2.1-all-languages.zip
  1. Ekstrak aplikasi phpmyadmin.
unzip phpMyAdmin-5.2.1-all-languages.zip
  1. Kopi file konfigurasi aplikasi phpmyadmin yaitu config.sample.inc.php menjadi config.inc.php. Lokasi file konfigurasi aplikasi phpmyadmin di folder phpMyAdmin-5.2.1-all-languages.
cp config.sample.inc.php config.inc.php
  1. Edit file config.inc.php. Berikut ini contoh konfigurasi file config.inc.php
cp config.sample.inc.php config.inc.php
  • Buat blowfish_secret. Cara membuat blowfish_secret adalah sebagai berikut.
export SECRET=`php -r 'echo base64_encode(random_bytes(24));'`
echo $SECRET
  • Contoh blowfish_secret yang anda dapatkan.
Ab8Ux1Ksbb/mA50wXZkGdVZcNfbU6cEv
  • Edit baris kode script berikut ini.
$cfg['blowfish_secret'] = '';
  • Menjadi seperti berikut.
$cfg['blowfish_secret'] = 'Ab8Ux1Ksbb/mA50wXZkGdVZcNfbU6cEv';
  • Temukan baris kode script berikut.
$cfg['Servers'][$i]['AllowNoPassword'] = false;
  • Dibawahnya tambahkan baris kode script berikut. Ganti user dan password database dengan yang barusan dibuat tadi.
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['port'] = '3306'; // MySQL port 
$cfg['Servers'][$i]['user'] = 'admin'; // MySQL user
$cfg['Servers'][$i]['password'] = 'ztbha765^&';
  1. Kopi semua file aplikasi phpmyadmin ke folder /var/www/html. Folder /var/www/html merupakan folder default lokasi tempat root website yang menggunakan apache.
sudo cp -r phpMyAdmin-5.2.1-all-languages/** /var/www/html
  • Ubah file dan folder user grup menjadi www-data di folder /var/www/html.
sudo chown -R www-data:www-data /var/www/**
  1. Sekarang, kunjungi alamat website anda di http://ip-address-server. Jika anda berhasil menginstall phpmyadmin, berikut ini tampilan halaman depan aplikasi phpmyadmin.

Cara Install PHPMyAdmin Di Ubuntu 22.04 LTS Server Dengan Apache PHP MariaDB

  • Masukkan nama pengguna dan kata sandi dari user dan password database yang anda buat tadi.

Cara Install PHPMyAdmin Di Ubuntu 22.04 LTS Server Dengan Apache PHP MariaDB

  • Selamat, anda telah berhasil menginstall aplikasi phpmyadmin di ubuntu 22.04 lts server menggunakan apache, php dan mariadb.

Demikian artikel tutorial tentang cara install phpmyadmin di ubuntu 22.04 lts server dengan apache php mariadb. Sekarang anda bisa mengelola mariadb database server menggunakan aplikasi phpmyadmin.

Tags :