Di laporan ini saya masukan, proses lengkap waktu saya ngebangun server dari nol sampai siap dipakai. Mulai dari web server, database, CMS, LMS, DNS, sampai mail server semuanya saya catat biar gampang diinget dan bisa jadi panduan kalau nanti dibutuhkan lagi.
1. Mengatur IP Static (Biar IP Server Tetap dan Tidak Berubah)
Edit file konfigurasi jaringan:
nano /etc/network/interfaces
Contoh isi:
auto enp0s3
iface enp0s3 inet static
address 172.16.31.103
gateway 172.16.30.0
dns-nameservers 8.8.8.8
Restart jaringan:
systemctl restart networking
Test koneksi:
ping google.com
2. Mengganti Repository Debian (Biar Install Lancar tanpa Error)
Edit file repository:
nano /etc/apt/sources.list
Isi dengan:
# Mirror Data Utama (kartolo) untuk Debian 11 (Bullseye)
deb http://kartolo.sby.datautama.net.id/debian/ bullseye main contrib non-free
deb-src http://kartolo.sby.datautama.net.id/debian/ bullseye main contrib non-free
deb http://kartolo.sby.datautama.net.id/debian/ bullseye-updates main contrib non-free
deb-src http://kartolo.sby.datautama.net.id/debian/ bullseye-updates main contrib non-free
deb http://kartolo.sby.datautama.net.id/debian-security/ bullseye-security main contrib non-free
deb-src http://kartolo.sby.datautama.net.id/debian-security/ bullseye-security main contrib non-free
Update sistem:
apt update dan apt upgrade -y
3. Install & Konfigurasi SSH (Supaya Bisa Remote dari Laptop)
Install SSH:
- apt install openssh-server -y
Cek:
- systemctl status ssh
Restart:
- systemctl restart ssh
4. Install Nginx (Web Server)
- apt install nginx -y
- systemctl enable nginx
- systemctl start nginx
Cek lewat browser:
- masukan ip kalian di browser
- kalau berhasil tampilan nya akan seperti ini
- Lalu kalian bisa ubah juga menjadi biodata kalian :
STEP 1 — Masuk ke folder web Nginx
cd /var/www/html/
STEP 2 — Buat file HTML baru / edit index.html
nano index.htmlsystemctl restart nginxbuka lagi di web menggunakan ip kalian ,ketika sudah maka tampilan nya seperti ini :
5. Membuat Virtual Host (Biar Bisa Hosting Banyak Website)
Contoh domain lokal: example.local
Buat file:
nano /etc/nginx/sites-available/example.local
Isi:
server {
listen 80;
server_name example.local;
root /var/www/example.local;
index index.php index.html;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
}
}
Aktifkan virtual host:
- ln -s /etc/nginx/sites-available/example.local /etc/nginx/sites-enabled/
- mkdir -p /var/www/example.local
- systemctl restart nginx
6. Membuat Halaman Awal index.html
- echo "<h1>Website Berhasil Tampil!</h1>" > /var/www/example.local/index.html
7. Install MariaDB (Database Server)
Install:
- apt install mariadb-server -y
- mysql_secure_installation
1. Buat user baru bernama arif, dengan password misalnya 2312:
CREATE USER 'arif'@'localhost' IDENTIFIED BY '2312';
2. Buat database untuk siswa (contoh 5 database):
CREATE DATABASE arif;
CREATE DATABASE shammy;
CREATE DATABASE adzka;
CREATE DATABASE fikri;
CREATE DATABASE fahmi;
3. Beri akses penuh ke user arif untuk semua database di atas:
GRANT ALL PRIVILEGES ON arif.* TO 'arif'@'localhost';
GRANT ALL PRIVILEGES ON shammy.* TO 'arif'@'localhost';
GRANT ALL PRIVILEGES ON adzka.* TO 'arif'@'localhost';
GRANT ALL PRIVILEGES ON fikri.* TO 'arif'@'localhost';
GRANT ALL PRIVILEGES ON fahmi.* TO 'arif'@'localhost';
4. Terapkan perubahan:
FLUSH PRIVILEGES;
5. Keluar dari MariaDB:
EXIT;
kalo kalian mau cek hasilnya kalian masukan SHOW DATABASES;
6. Lanjut ke index.php (Install & Konfigurasi PHP 8.1)
Pertama download dulu paket PHP-nya.
Gunakan PHP versi 8.1 agar lebih baru dan kompatibel dengan aplikasi modern.
Install PHP 8.1 beserta modul pentingnya:
sudo apt install php8.1-fpm php8.1-mysql php8.1-cli php8.1-curl php8.1-xml php8.1-mbstring -y
Setelah proses instalasi selesai, lanjutkan konfigurasi Nginx agar bisa membaca file index.php.
Edit konfigurasi default Nginx:
sudo nano /etc/nginx/sites-available/default
Pastikan bagian konfigurasi PHP seperti berikut:
index index.php index.html index.htm;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
}
Jika sudah, simpan konfigurasi dan buat file index.php:
sudo nano /var/www/html/index.php
Isi dengan:
<?php
phpinfo();
?>
Simpan (CTRL+O, ENTER) dan keluar (CTRL+X).
Kemudian buka browser dan akses:
172.16.31.103/index.php
Jika tampil halaman PHP Info, berarti PHP 8.1 berhasil terpasang.
-kenapa difoto versi php nya 8.3 karena saya seblumnya memakai versi 8.3 tetapi tidak support jadi akibatnya saya memakai php versi 8.1
8. Install dan Konfigurasi PHPMyAdmin
Pertama masuk dulu ke direktori web:
cd /var/www/html
Download PHPMyAdmin versi terbaru:
sudo wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.tar.gz
Ekstrak file yang sudah di-download:
sudo tar -xvf phpMyAdmin-latest-all-languages.tar.gz
Setelah diekstrak, buat folder tmp untuk PHPMyAdmin:
sudo mkdir /var/www/html/phpmyadmin/tmp
sudo chmod 777 /var/www/html/phpmyadmin/tmp
Copy file konfigurasi sample:
sudo cp /var/www/html/phpmyadmin/config.sample.inc.php /var/www/html/phpmyadmin/config.inc.php
Edit file konfigurasi:
sudo nano /var/www/html/phpmyadmin/config.inc.php
Cari baris:
$cfg['blowfish_secret'] = '';Isi dengan string acak minimal 32 karakter, misalnya:$cfg['blowfish_secret'] = 'Xyz8923asd89021asdiqwejkzxcvbnm';
Beri permission agar Nginx bisa membaca PHPMyAdmin:
sudo chown -R www-data:www-data /var/www/html/phpmyadmin
Konfigurasi PHPMyAdmin di Nginx
Edit file konfigurasi default Nginx:
sudo nano /etc/nginx/sites-available/default
Tambahkan blok berikut di dalam { server }:
location /phpmyadmin {
root /var/www/html;
index index.php index.html;
location ~ ^/phpmyadmin/(.*\.php)$ {
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$1;
include fastcgi_params;
}
location ~* ^/phpmyadmin/(.*\.(jpg|jpeg|gif|css|png|js|ico|html|svg|txt))$ {
root /var/www/html;
}
}
Tes dan Akses PHPMyAdmin
Cek konfigurasi:
sudo nginx -t
Kalau sukses, restart Nginx:
sudo systemctl restart nginx
Akses PHPMyAdmin melalui browser:172.16.31.103/phpmyadmin
ketika berhasil tampilan nya seperti ini
9. Instalasi WordPress di Debian 11 (Nginx + MariaDB + PHP 8.1)
1. Buat Database untuk WordPress
Masuk ke MariaDB:
sudo mariadb
Lalu jalankan perintah berikut:
CREATE DATABASE wordpress;
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'passwordwp123';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
2. Download dan Ekstrak WordPress
Masuk ke folder web:
cd /var/www/html
Download WordPress:
sudo wget https://wordpress.org/latest.tar.gz
Ekstrak file:
sudo tar -xvf latest.tar.gz
Pindahkan seluruh isi folder WordPress ke direktori web root:
sudo mv wordpress/* .
3. Konfigurasi File WordPress
Salin file konfigurasi contoh:
sudo cp wp-config-sample.php wp-config.php
Edit file konfigurasi:
sudo nano wp-config.php
Ubah bagian database sesuai user dan password yang tadi dibuat:
define( 'DB_NAME', 'wordpress' );
define( 'DB_USER', 'wpuser' );
define( 'DB_PASSWORD', 'passwordwp123' );
define( 'DB_HOST', 'localhost' );
Simpan (CTRL + O) dan keluar (CTRL + X).
4. Atur Izin Folder WordPress
Supaya WordPress bisa berjalan:
sudo chown -R www-data:www-data /var/www/html/
sudo chmod -R 755 /var/www/html/
5. Konfigurasi Nginx untuk WordPress
Edit konfigurasi default Nginx:
sudo nano /etc/nginx/sites-available/default
Pastikan konfigurasi berikut sudah ada:
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
}
Simpan lalu cek konfigurasi:
sudo nginx -t
Kalau successful, restart nginx:
sudo systemctl restart nginx
6. Akses WordPress
Buka di browser:172.16.31.103/wordpress
Maka akan muncul halaman instalasi WordPress.
10. Instalasi LMS Moodle di Debian 11 (Nginx + MariaDB + PHP 8.1)
1. Install Paket Pendukung Moodle
sudo apt install php8.1-zip php8.1-gd php8.1-intl php8.1-xmlrpc php8.1-soap \
php8.1-ldap php8.1-xml php8.1-mbstring php8.1-curl php8.1-mysql php8.1-bz2 \
php8.1-cli php8.1-fpm graphviz aspell ghostscript unzip -y
2. Buat Database untuk Moodle
Masuk ke MariaDB:
sudo mariadb
Jalankan perintah berikut:
CREATE DATABASE moodle DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'arif'@'localhost' IDENTIFIED BY 'arif';
GRANT ALL PRIVILEGES ON moodle.* TO 'arif'@'localhost';
FLUSH PRIVILEGES;
EXIT;
3. Download dan Instal Moodle
cd /var/www/html
sudo wget https://download.moodle.org/download.php/direct/stable401/moodle-latest-401.tgz
sudo tar -xvf moodle-latest-401.tgz
sudo mv moodle/* .
4. Buat Folder Data Moodle
sudo mkdir /var/moodledata
sudo chown -R www-data:www-data /var/moodledata
sudo chmod -R 777 /var/moodledata
5. Atur Izin Folder Web
sudo chown -R www-data:www-data /var/www/html/
sudo chmod -R 755 /var/www/html/
6. Konfigurasi Nginx
Edit file konfigurasi:
sudo nano /etc/nginx/sites-available/default
Pastikan di dalam server {} ada:
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
}
location ~* \.(gif|jpg|jpeg|png|svg|css|js)$ {
expires max;
log_not_found off;
}
Tes konfigurasi dan restart:
sudo nginx -t
sudo systemctl restart nginx
7. Akses Instalasi Moodle
Buka di browser:172.16.31.103/moodle
Masukkan database:
DB Name: moodle
DB User: arif
DB Password: arif
Lanjutkan instalasi sampai selesai, lalu Moodle siap digunakan.
11. Konfigurasi DNS Server Debian 11 (Domain: arifakbar.com)
1. Install BIND9
sudo apt install bind9 bind9-utils -y
2. Konfigurasi Zona Forward
Edit konfigurasi utama BIND:
sudo nano /etc/bind/named.conf.local
Isi dengan:
zone "arifakbar.com" {
type master;
file "/etc/bind/db.arifakbar.com";
};
3. Membuat File Zona arifakbar.com
Copy template:
sudo cp /etc/bind/db.local /etc/bind/db.arifakbar.com
sudo nano /etc/bind/db.arifakbar.com
Isi file dengan konfigurasi lengkap:
$TTL 604800
@ IN SOA ns1.arifakbar.com. root.arifakbar.com. (
2025011101 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
; Name Server
@ IN NS ns1.arifakbar.com.
; A Records
ns1 IN A 172.16.31.103
@ IN A 172.16.31.103
; CNAME Records
www IN CNAME arifakbar.com.
mail IN CNAME arifakbar.com.
4. Restart BIND9
sudo systemctl restart bind9
5. Tes Konfigurasi Zona
sudo named-checkzone arifakbar.com /etc/bind/db.arifakbar.com
Harus muncul OK.
6. Tes DNS Menggunakan nslookup
nslookup arifakbar.com
nslookup 172.16.31.103
Jika domain mengarah ke IP → DNS berhasil.
12. Mail Server – Versi Arif (Postfix + Dovecot + Roundcube)
1. Instalasi Postfix & Dovecot
Jalankan perintah berikut:
sudo apt install postfix dovecot-core dovecot-imapd -y
Saat muncul pilihan konfigurasi Postfix, pilih:
Internet Site
Kemudian tekan ENTER.
Lalu ketika diminta memasukkan "mail name", isi dengan:
arifakbar.com
2. Konfigurasi Postfix (main.cf)
Edit file utama Postfix:
sudo nano /etc/postfix/main.cf
Pastikan bagian ini ada dan sudah sesuai:
myhostname = mail.arifakbar.com
mydomain =
myorigin = /etc/mailname
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
home_mailbox = Maildir/
mailbox_command =
Simpan file (CTRL+X → Y → ENTER).
3. Konfigurasi Dovecot (Maildir)
Edit konfigurasi mail location:
sudo nano /etc/dovecot/conf.d/10-mail.conf
Ubah baris:
mail_location =
menjadi:
mail_location = maildir:~/Maildir
Aktifkan protokol IMAP
Buka file:
sudo nano /etc/dovecot/conf.d/10-master.conf
Lalu restart Dovecot:
sudo systemctl restart dovecot
4. Membuat User Email
Buat dua akun email:
User 1
sudo adduser arif1
Isi password & biodata.
User 2
sudo adduser arif2
5. Buat Folder Maildir untuk Setiap User
Untuk arif1
sudo -u arif1 maildirmake.dovecot ~/Maildirsudo -u arif1 maildirmake.dovecot ~/Maildir/{cur,new,tmp}
Untuk arif2
sudo -u arif2 maildirmake.dovecot ~/Maildir
sudo -u arif2 maildirmake.dovecot ~/Maildir/{cur,new,tmp}
6. Test Kirim Email dari Linux
Dari root ke arif1:
echo "Test ke arif1" | mail -s "Hello arif1" arif1
Ke arif2:
echo "Test ke arif2" | mail -s "Hello arif2" arif2
Cek apakah email masuk:
ls /home/arif1/Maildir/new
ls /home/arif2/Maildir/new
7. Instalasi Roundcube
Jalankan:
sudo apt install roundcube roundcube-core roundcube-mysql roundcube-plugins roundcube-plugins-extra -y
Saat muncul opsi:
Pilih Yes
Pilih Configure Database
8. Konfigurasi Roundcube
Edit file konfigurasi:
sudo nano /etc/roundcube/config.inc.php
Ubah menjadi:
$config['default_host'] = 'localhost';
$config['smtp_server'] = 'localhost';
Restart Apache:
sudo systemctl restart apache2
9. Akses Roundcube
Buka browser dan masuk ke:172.16.31.103/roundcube
Login menggunakan:
Username: arif1
Password: sesuai saat adduser
atau
Username: arif2
10. Test Email via Roundcube
Kirim email dari Linux:
echo "Test ke arif1" | mail -s "Hello arif1" arif1
Lalu cek di Roundcube apakah email sudah masuk.
Tidak ada komentar:
Posting Komentar