Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== Konfigurasi Hostname di Linux ====== ===== 1. Mengecek Hostname ===== Untuk memeriksa hostname sistem saat ini: <code bash> hostname hostname -f # Fully Qualified Domain Name (FQDN) hostnamectl </code> Contoh output: <code bash> ilyasa@webserver:~$ hostname webserver ilyasa@webserver:~$ hostname -f webserver.yas.lab ilyasa@webserver:~$ hostnamectl Static hostname: webserver Icon name: computer-container Chassis: container ☐ Machine ID: f91ff07142654e1d9eacfbb77447a3db Boot ID: bfc005a4abad4e7692cd044ec61a0e1b Virtualization: lxc Operating System: Ubuntu 24.04 LTS Kernel: Linux 6.8.12-1-pve Architecture: x86-64 </code> ===== 2. Mengganti Hostname ===== Ada dua cara yang umum digunakan: ==== Menggunakan ''hostnamectl'' (disarankan) ==== <code bash> sudo hostnamectl set-hostname new-hostname </code> ==== Mengubah secara manual ==== - Edit file ''/etc/hostname'' <code bash> sudo nano /etc/hostname </code> Ganti dengan nama host baru. - Update juga file ''/etc/hosts'' <code bash> sudo nano /etc/hosts </code> Sesuaikan agar mengarah ke hostname baru, misalnya: <code> 127.0.1.1 new-hostname.yas.lab new-hostname </code> ===== 3. File Konfigurasi Hostname ===== ==== ''/etc/hostname'' ==== Berisi nama host utama. <code bash> cat /etc/hostname </code> Contoh: <code> ubuntu-desktop </code> ==== ''/etc/hosts'' ==== Berisi mapping IP ↔ hostname. <code bash> cat /etc/hosts </code> Contoh: <code> 127.0.0.1 localhost 127.0.1.1 ubuntu-desktop.yas.lab ubuntu-desktop ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters </code> ===== 4. Catatan Penting ===== * Setelah mengganti hostname, lakukan **reboot** atau **logout-login** agar perubahan berlaku penuh. * Gunakan FQDN (''hostname.domain'') jika server ada di dalam jaringan dengan DNS internal. * Untuk server produksi, pastikan konsistensi antara ''hostname'', ''/etc/hostname'', dan ''/etc/hosts''. system/linux/config/hostname.txt Last modified: 2026/02/01 21:08by 127.0.0.1