Jump to content

Instalasi LAMP Stack di Debian 13: Difference between revisions

From Wiki - Yohanes Sugiarto
Created page with "__NOTOC__ = Panduan Instalasi LAMP Stack di Debian 13 (Trixie) = Panduan lengkap langkah demi langkah untuk membangun lingkungan web server berbasis '''LAMP Stack''' (Linux, Apache, MariaDB/MySQL, dan PHP) pada sistem operasi '''Debian 13'''. == 1. Persiapan & Update Sistem == Sebelum memulai instalasi komponen LAMP, pastikan index repositori dan paket sistem dalam kondisi terbaru: <pre> sudo apt update && sudo apt upgrade -y </pre> == 2. Langkah 1: Instalasi Web S..."
 
m Protected "Panduan Instalasi LAMP Stack di Debian 13" ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))
(No difference)

Revision as of 13:36, 31 October 2026


Panduan Instalasi LAMP Stack di Debian 13 (Trixie)

Panduan lengkap langkah demi langkah untuk membangun lingkungan web server berbasis LAMP Stack (Linux, Apache, MariaDB/MySQL, dan PHP) pada sistem operasi Debian 13.

1. Persiapan & Update Sistem

Sebelum memulai instalasi komponen LAMP, pastikan index repositori dan paket sistem dalam kondisi terbaru:

sudo apt update && sudo apt upgrade -y

2. Langkah 1: Instalasi Web Server (Apache)

A. Install Apache

Jalankan perintah berikut untuk menginstal Apache 2:

sudo apt install apache2 apache2-utils -y

B. Verifikasi Status Apache

Pastikan layanan Apache berjalan dan diatur untuk otomatis menyala saat booting:

sudo systemctl status apache2
sudo systemctl enable apache2

C. Konfigurasi Firewall (UFW)

Jika menggunakan UFW, izinkan lalu lintas data untuk port 80 (HTTP) dan 443 (HTTPS):

sudo ufw allow 'Apache Full'
sudo ufw reload

Pengujian: Buka browser lalu akses IP server http://31.58.59.156. Jika muncul halaman "Apache2 Debian Default Page", berarti web server berhasil diinstal.

3. Langkah 2: Instalasi Database Server (MariaDB)

A. Install MariaDB

sudo apt install mariadb-server mariadb-client -y

B. Amankan Instalasi Database

Jalankan skrip keamanan interaktif bawaan MariaDB:

sudo mariadb-secure-installation

Ikuti petunjuk di layar:

  • **Switch to unix_socket authentication?** Ketik n
  • **Change the root password?** Ketik y (lalu buat password root database yang kuat)
  • **Remove anonymous users?** Ketik y
  • **Disallow root login remotely?** Ketik y
  • **Remove test database and access to it?** Ketik y
  • **Reload privilege tables now?** Ketik y

4. Langkah 3: Instalasi Scripting Language (PHP)

A. Install PHP & Ekstensi Umum

Instal PHP beserta modul-modul utama yang sering dibutuhkan oleh aplikasi web (seperti WordPress, Laravel, atau CMS lain):

sudo apt install php libapache2-mod-php php-mysql php-cli php-curl php-gd php-mbstring php-xml php-zip php-json -y

B. Atur Apache untuk Memprioritaskan File PHP

Buka file konfigurasi dir.conf:

sudo nano /etc/apache2/mods-enabled/dir.conf

Ubah urutan file agar index.php berada di posisi pertama:

<IfModule mod_dir.c>
    DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>

Simpan file (Ctrl + O, Enter, Ctrl + X), lalu restart Apache:

sudo systemctl restart apache2

5. Pengujian Integrasi PHP & Apache

Buat file info PHP di dalam direktori root web:

sudo nano /var/www/html/info.php

Masukkan kode PHP berikut:

<?php
phpinfo();
?>

Simpan file, lalu buka browser dan akses http://31.58.59.156/info.php (atau via domain http://vps.yohanessugiarto.id/info.php). Jika halaman informasi PHP muncul, maka LAMP Stack siap digunakan.

Catatan Keamanan: Setelah selesai pengujian, hapus file info.php agar informasi sensitif server tidak dapat dilihat publik:

sudo rm /var/www/html/info.php

6. Ringkasan Perintah Manajemen Servis

Layanan Cek Status Restart Service Reload Service
**Apache** sudo systemctl status apache2 sudo systemctl restart apache2 sudo systemctl reload apache2
**MariaDB** sudo systemctl status mariadb sudo systemctl restart mariadb sudo systemctl reload mariadb