Skip to main content

Setup and Secure VPS

Set Hostname

Mengubah nama host server kita

sudo hostnamectl hostname demo

Setup Timezone

Menyesuaikan waktu server dengan timezone kita

sudo dpkg-reconfigure tzdata

Update Software Package

Memperbarui daftar paket software pada linux

sudo apt update -y

Download dan install paket terbaru

sudo apt dist-upgrade -y

Menghapus paket-paket software yang sudah tidak terpakai

sudo apt autoremove

Reboot Server

sudo reboot now

Install Firewall

Menginstall ufw (Uncomplicated Firewall)

sudo apt install ufw

Allow the Ports for SSH (22), HTTP (80), and HTTPS (443)

Mengijinkan port 22 (SSH), 80 (HTTP), dan 443 (HTTPS)

sudo ufw allow ssh
sudo ufw allow http
sudo ufw allow https

Review Firewalls Rules

Review rules yang telah dibuat

sudo ufw show added

Enable Rules

Mengaktifkan rules yang telah dibuat

sudo ufw enable

Confirm That the New Rules Are Active

Memastikan rules aktif

sudo ufw status verbose

Install Fail2ban

sudo apt install fail2ban

Start fail2ban

sudo service fail2ban start