Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| system:linux:config:hostname [2026/01/26 20:37] – removed - external edit (Unknown date) 127.0.0.1 | system:linux:config:hostname [2026/02/01 21:08] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Konfigurasi Hostname di Linux ====== | ||
| + | |||
| + | ===== 1. Mengecek Hostname ===== | ||
| + | Untuk memeriksa hostname sistem saat ini: | ||
| + | |||
| + | <code bash> | ||
| + | hostname | ||
| + | hostname -f # Fully Qualified Domain Name (FQDN) | ||
| + | hostnamectl | ||
| + | </ | ||
| + | |||
| + | Contoh output: | ||
| + | <code bash> | ||
| + | ilyasa@webserver: | ||
| + | webserver | ||
| + | ilyasa@webserver: | ||
| + | webserver.yas.lab | ||
| + | ilyasa@webserver: | ||
| + | | ||
| + | Icon name: computer-container | ||
| + | | ||
| + | Machine ID: f91ff07142654e1d9eacfbb77447a3db | ||
| + | Boot ID: bfc005a4abad4e7692cd044ec61a0e1b | ||
| + | Virtualization: | ||
| + | Operating System: Ubuntu 24.04 LTS | ||
| + | Kernel: Linux 6.8.12-1-pve | ||
| + | Architecture: | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== 2. Mengganti Hostname ===== | ||
| + | Ada dua cara yang umum digunakan: | ||
| + | |||
| + | ==== Menggunakan '' | ||
| + | <code bash> | ||
| + | sudo hostnamectl set-hostname new-hostname | ||
| + | </ | ||
| + | |||
| + | ==== Mengubah secara manual ==== | ||
| + | - Edit file ''/ | ||
| + | <code bash> | ||
| + | sudo nano / | ||
| + | </ | ||
| + | Ganti dengan nama host baru. | ||
| + | |||
| + | - Update juga file ''/ | ||
| + | <code bash> | ||
| + | sudo nano /etc/hosts | ||
| + | </ | ||
| + | Sesuaikan agar mengarah ke hostname baru, misalnya: | ||
| + | < | ||
| + | 127.0.1.1 | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== 3. File Konfigurasi Hostname ===== | ||
| + | |||
| + | ==== ''/ | ||
| + | Berisi nama host utama. | ||
| + | <code bash> | ||
| + | cat / | ||
| + | </ | ||
| + | Contoh: | ||
| + | < | ||
| + | ubuntu-desktop | ||
| + | </ | ||
| + | |||
| + | ==== ''/ | ||
| + | Berisi mapping IP ↔ hostname. | ||
| + | <code bash> | ||
| + | cat /etc/hosts | ||
| + | </ | ||
| + | Contoh: | ||
| + | < | ||
| + | 127.0.0.1 | ||
| + | 127.0.1.1 | ||
| + | ::1 | ||
| + | ff02:: | ||
| + | ff02:: | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== 4. Catatan Penting ===== | ||
| + | * Setelah mengganti hostname, lakukan **reboot** atau **logout-login** agar perubahan berlaku penuh. | ||
| + | * Gunakan FQDN ('' | ||
| + | * Untuk server produksi, pastikan konsistensi antara '' | ||