π Panduan Lengkap Install LAMP Server di Distro Turunan Fedora
Mau bikin server lokal untuk website atau aplikasi?
Yuk, belajar install LAMP Server di distro turunan Fedora seperti Redhat, AlmaLinux, Fedora, CentOS dan Rocky Linux π.
Apa itu LAMP Server?
LAMP adalah singkatan dari:
- Linux: Sistem operasi server.
- Apache: Web server untuk meng-host website.
- MySQL/MariaDB: Database untuk menyimpan data.
- PHP: Bahasa pemrograman untuk aplikasi web.
Step-by-Step Installasi LAMP Server
π₯ Step 1: Update Repository
Sebelum mulai, pastikan repository kamu up-to-date.
sudo dnf update -y
π€ Step 2: Install Apache (Web Server)
Apache adalah software untuk meng-host website.
sudo dnf install httpd -y
Start & Enable Apache:
sudo systemctl enable --now httpd
sudo systemctl status httpd
Add service http & https in firewall:
sudo firewall-cmd --zone=public --add-service=http --permanent
sudo firewall-cmd --zone=public --add-service=https --permanent
sudo firewall-cmd --reload
Chek Apache Page:
Buka browser dan akses http://localhost
atau IP server kamu. Maka akan muncul default page apache.
Setiap distro memiliki default page apache yang berbeda - beda.
πΎ Step 3: Install MySQL (Database)
Database digunakan untuk menyimpan data website.
sudo dnf install mysql mysql-server -y
Start & Enable MySQL Server
sudo systemctl enable --now mysqld
sudo systemctl status mysqld
MySQL Secure Installation
1. Run script
sudo mysql_secure_installation
2. Press yes
Would you like to setup VALIDATE PASSWORD component? (Press y|Y for Yes, any other key for No): yes
3. Select Password Security Level
There are three levels of password validation policy:
LOW Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters, and dictionary file
Please enter 0 = LOW, 1 = MEDIUM, 2 = STRONG:
LEVEL | PENJELASAN |
---|---|
LOW | Hanya membutuhkan panjang minimum 8 karakter. |
MEDIUM | Kombinasi angka, huruf besar, huruf kecil, dan karakter khusus. |
STRONG | Seperti MEDIUM, tetapi dengan tambahan validasi terhadap kata dari kamus. |
Pilih level password sesuai kebutuhanmu
4. Set root password
Please set the password for root here. New password:
Re-enter new password:
5. Remove anonymous user
Remove anonymous users? (Press y|Y for Yes, any other key for No):yes
OPSI | PENJELASAN |
---|---|
yes | Menghapus akun anonymous yang memungkinkan siapa pun masuk tanpa akun pengguna. (Ini meningkatkan keamanan) |
no | Membiarkan akun anonymous tetap ada. (tidak disarankan) |
6. Disallow root login remote
Disallow root login remotely? (Press y|Y for Yes, any other key for No):yes
OPSI | PENJELASAN |
---|---|
yes | Mencegah pengguna root login dari jarak jauh melalui koneksi TCP. (Ini mengurangi risiko serangan jarak jauh) |
no | Membiarkan login jarak jauh untuk root. (tidak disarankan kecuali diperlukan untuk konfigurasi khusus) |
7. Remove Test Database
Remove test database and access to it? (Press y|Y for Yes, any other key for No):yes
OPSI | PENJELASAN |
---|---|
yes | Menghapus database test yang dibuat secara default selama instalasi. (Database ini tidak digunakan dan dapat menjadi potensi celah keamanan) |
no | Membiarkan database test. (tidak disarankan) |
8. Reload privilege tables
Reload privilege tables now? (Press y|Y for Yes, any other key for No):yes
OPSI | PENJELASAN |
---|---|
yes | Memuat ulang tabel privilege untuk memastikan semua perubahan segera berlaku. |
no | Menunda pemuatan ulang hingga dilakukan secara manual. |
9. Exit MySQL
quit;
π¨βπ» Step 4: Install PHP (Scripting Language)
PHP digunakan untuk menjalankan aplikasi web dinamis.
sudo dnf install php php-mysqlnd php-cli -y
Restart Apache untuk memuat PHP:
sudo systemctl restart httpd
Tes PHP:
Buat file PHP di /var/www/html/
:
echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/info.php
Akses http://localhost/info.php
di browser. Kalau muncul informasi PHP, instalasi sukses!
π Step 5: Install phpMyAdmin (Opsional)
phpMyAdmin adalah tool berbasis web untuk mengelola database.
sudo dnf install phpmyadmin php php-mbstring php-zip php-gd php-json php-curl php-mysqlnd -y
Edit Config Apache:
Tambahkan ini di /etc/httpd/conf.d/phpMyAdmin.conf
:
<Directory /usr/share/phpMyAdmin/>
Require all granted
</Directory>
Restart Apache Lagi:
sudo systemctl restart httpd
Akses di http://localhost/phpmyadmin
Kesimpulan:
Setelah mengikuti langkah-langkah ini, kamu punya server lokal yang powerful dan siap digunakan. β¨
Keuntungan LAMP Server:
- π» Open Source: Gratis, fleksibel, dan komunitasnya besar.
- π Universal: Bisa dipakai untuk banyak jenis aplikasi web.
- π Efisien: Cocok untuk development atau server live.
NOTEJangan lupa untuk selalu update server dan backup data kamu secara rutin.
Kalau kamu merasa postingan ini bermanfaat, share ke teman-temanmu!
Selamat mencoba! Letβs build something awesome! π