How to change hostname on CentOS/Ubuntu


Sometimes you will need to change hostname in some Distro Linux like CentOS or Ubuntu and you are considering what is the easy way to do that. So i will help you to set hostname CentOS 7/6 and Ubuntu/Debian with below instructions. However, you know what is hostname value in Linux right? An alias name to indicate your system to easily manage.

1. Change hostname on CentOS and Ubuntu

+ CentOS/RHEL/Fedora 6

– For example, the value of hostname i will use is :
– You just need to edit this file : ‘/etc/sysconfig/network

+ CentOS/RHEL/Fedora 7

– Edit this file: ‘/etc/hostname

+ Ubuntu/Debian

2. Change info in file hosts then reboot

– Edit DNS hosts to match new hostname for translation IP-Hostname.

– Reboot your system to apply new change.

3. Checking

– Run command “hostname” and you will see your hostname.

See, you can do it by yourself for changing or setting new hostname in Linux.

Đánh giá sao từ người đọc :
[ Tổng : 0 - Trung bình: 0 ]