Products & Services Submit a ticket My Tickets
Selamat datang
Masuk  Mendaftar

Install LAMP di Ubuntu 20.04

Langkah pertama, pastikan sudah update ke latest version kernel dan library.


# apt update -y; apt upgrade -y; resize2fs /dev/vda1; reboot


Install Web Server


# apt install apache2 -y
# systemctl enable apache2


Install PHP74 dan pendukung library PHP74


# apt install php7.4 php7.4-mysql php-common php7.4-cli php7.4-json php7.4-common php7.4-opcache libapache2-mod-php7.4 -y

Cek php sudah terpasang dan menggunakan versi PHP74

# php -v
PHP 7.4.3 (cli) (built: Jun 13 2022 13:43:30) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies

Restart apache2 agar ter-integrasi dengan PHP74

# systemctl restart apache2

Secara default public html berada di /var/www/html. Anda bisa langsung menambahkan web file anda di sana langsung.


Install MariaDB 10.5


MariaDB versi 10.5 sendiri di luncurkan pada Juni 2020 dan saat ini berada dalam status stable version. Dan dukungan teknis dari pihak developer MariaDB akan berlanjut hingga Juni 2025 mendatang. Pada umumnya engine yang ada pada MariaDB 10.5 sudah disempurnakan dan mendukung hampir semua aplikasi database.

# apt install gnupg -y; apt install apt-transport-https curl -y
# apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
# sh -c "echo 'deb https://download.nus.edu.sg/mirror/mariadb/repo/10.5/ubuntu focal main' >>/etc/apt/sources.list"
# apt update; apt install install mariadb-server -y


Setup secure installation MariaDB 10.5

# 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 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] Y Enabled successfully! Reloading privilege tables.. ... Success! 

You already have your root account protected, so you can safely answer 'n'. 
Change the 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!


Pastikan MariaDB auto start setelah reboot.

# systemctl enable mariadb


Download phpmyadmin untuk memudahkan konfigurasi database


# cd /var/www/html/; mkdir phpmy9x; cd phpmy9x
# wget https://files.phpmyadmin.net/phpMyAdmin/5.2.0/phpMyAdmin-5.2.0-english.tar.gz
# tar -zxvf phpMyAdmin-5.2.0-english.tar.gz ; cd phpMyAdmin-5.2.0-english
# mv * ..

Kemudian coba buka phpmyadmin yang sudah dibuat tadi.

Buka http://ip-address/phpmy9x/ kemudian gunakan username root dan password yang sudah di setup untuk masuk ke phpmyadmin dan mulai membuat database.


Selamat! Kini webserver dan database anda sudah berhasil dibuat dan bisa digunakan.

Apakah jawaban ini bermanfaat? Ya Tidak

Send feedback
Maaf kami tidak bisa membantu. Bantu kami mengembangkan artikel ini dengan umpan balik Anda.