Installasi LAMP pada Ubuntu 20.04 LTS
Step 1 - Update dan Upgrade system
Pertama-tama pastikan pada system Ubuntu rekan-rekan sudah terupdate, jika belum silahkan jalankan perintah berikut untuk update dan upgrade.
root@fossa:~# apt update root@fossa:~# apt upgrade
Step 2 - Install Apache Webserver Setelah proses update dan upgrade selesai, selanjutnya kita mulai dengan installasi apache2, silahkan jalankan perintah dibawah ini untuk install apache2 webserver.
root@fossa:~# apt install apache2 root@fossa:~# ufw allow http
Untuk pengetesan silahkan buka browser dari PC/Komputer Client lalu akses melalui url http://IP_Address_Server pastikan pada halaman muncul Apache2 Ubuntu default page.
Step 3 - Install PHP versi 7.4
Setelah tahap installasi webserver selesai, tahap selanjutnya kita akan installasi PHP, silahkan jalankan perintah berikut untuk installasinya.
root@fossa:~# apt install -y php7.4 root@fossa:~# apt install php7.4-curl php7.4-gd php7.4-json php7.4-mbstring php7.4-xml
Jalankan perintah dibawah ini untuk membuat script file phpinfo.php
root@fossa:~# echo "<?php phpinfo(); ?>" > /var/www/html/phpinfo.php
Untuk pengetesan silahkan buka browser dari PC/Komputer Client lalu akses melalui url http://IP_Address_Server/phpinfo.php pastikan pada browser muncul halaman PHP.
Step 4 - Install Database Mariadb
Tahap selanjutnya adalah installasi database Mariadb, untuk installasinya silahkan jalankan perintah berikut.
root@fossa:~# apt update && sudo apt upgrade root@fossa:~# apt -y install software-properties-common
Import Mariadb gpg key
root@fossa:~# apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
Tambahkan repositori Mariadb
root@fossa:~# add-apt-repository 'deb [arch=amd64] http://mariadb.mirror.globo.tech/repo/10.5/ubuntu focal main'
Update dan install Mariadb
root@fossa:~# apt update root@fossa:~# apt install mariadb-server mariadb-client
Jalankan perintah mysql_secure_installastion untuk membuat password database
root@fossa:~# 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): [ENTER]
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: [Masukan Password]
Re-enter new password: [Masukan 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 farwill 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 MariaDBinstallation should now be secure.
Thanks for using MariaDB!
Cek status service database Mariadb
root@fossa:~# systemctl status mariadb
● mariadb.service - MariaDB 10.5.5 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor prese>
Drop-In: /etc/systemd/system/mariadb.service.d
└─migrated-from-my.cnf-settings.conf
Active: active (running) since Mon 2020-09-21 15:53:26 WIB; 31min ago
Docs: man:mariadbd(8)
https://mariadb.com/kb/en/library/systemd/
Main PID: 12883 (mariadbd)
Status: "Taking your SQL requests now..."
Tasks: 8 (limit: 2282)
Memory: 77.5M
CGroup: /system.slice/mariadb.service
└─12883 /usr/sbin/mariadbd
Sep 21 15:53:27 fossa /etc/mysql/debian-start[12902]: mysql
Sep 21 15:53:27 fossa /etc/mysql/debian-start[12902]: performance_schema
Sep 21 15:53:27 fossa /etc/mysql/debian-start[12902]: Phase 6/7: Checking and u>
Sep 21 15:53:27 fossa /etc/mysql/debian-start[12902]: Processing databases
Sep 21 15:53:27 fossa /etc/mysql/debian-start[12902]: information_schema
Untuk pengetesan silahkan jalankan perintah mysql -u root -p
root@fossa:~# mysql -u root -p
Enter password: [Masukan Password]
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 53
Server version: 10.5.5-MariaDB-1:10.5.5+maria~focal mariadb.org binary distribution
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)]> exit
Bye
Step 5 - Install PhpMyadmin
Tahap terakhir install PhpMyadmin, PhpMyadmin digunakan untuk mengolah darabase yang kita gunakan dengan menggunakan web base jadi untuk pengolahan database jadi lebih mudah dengan menggunakan PhpMyadmin. Silahkan jalankan perintah dibawah ini untuk installasinya.
root@fossa:~# apt install phpmyadmin
Pilih apache2 lalu pilih Ok Pilih No
Untuk pengetesan silahkan buka browser dari PC/Komputer Client lalu akses melalui url http://IP_Address_Server/phpmyadmin masukan user dan password database lalu Klik Go
Berikut tampilan dashboard Phpmyadmin
Selamat Anda telah berhasil Install LAMP di Ubuntu Server 20.04.