728x90
반응형
우분투 설치할 때 자동으로 설정된 호스트 이름이 너무 길어서 이를 바꾼 과정을 정리해 둡니다.
호스트 이름 바꾸기
원래 자동으로 설정된 호스트 이름이 다음과 같았습니다.
root@hbesthee-ZBOX-EN1070-1060-EN1070K-1060K:~#
호스트 이름을 변경하기 위해서는 간단하게 다음 두 파일의 이름을 변경해 주면 됩니다.
- /etc/hostname
- /etc/hosts
위 두 파일에서 현재 호스트 이름으로 설정된 "hbesthee-ZBOX-EN1070-1060-EN1070K-1060K"를 변경해 주시면 됩니다.
먼저 "/etc/hostname" 파일을 확인하고, "hbesthee-dev"로 변경하여 주었습니다.
root@hbesthee-ZBOX-EN1070-1060-EN1070K-1060K:~# cat /etc/hostname
hbesthee-ZBOX-EN1070-1060-EN1070K-1060K
root@hbesthee-ZBOX-EN1070-1060-EN1070K-1060K:~# echo "hbesthee-dev" > /etc/hostname
그리고 "/etc/hosts" 파일에서 두 번째줄의 "hbesthee-ZBOX-EN1070-1060-EN1070K-1060K"를 찾아 변경하면 됩니다.
root@hbesthee-ZBOX-EN1070-1060-EN1070K-1060K:~# cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 hbesthee-ZBOX-EN1070-1060-EN1070K-1060K
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
root@hbesthee-ZBOX-EN1070-1060-EN1070K-1060K:~# vi /etc/hosts
터미널을 재시작하거나, 서버를 새시작하면 변경된 서버 이름이 적용된 것을 확인하실 수 있습니다.
참고자료
- "How do I change the computer name?":https://askubuntu.com/questions/9540/