System Story/CentOS 7

CentOS7 Hostname 확인 및 변경하기

helperchoi 2014. 12. 17. 10:50

CentOS7 즉 Redhat 7버전이 출시되면서 기존 Command에 많은 변화가 생긴것 같습니다.

필자도 새로 공부하는 마음으로 하나 하나 알아가고 있는 상태입니다.

 

우선 System 설정시 가장 기본이라 할 수 있는 hostname 확인과 변경에 대해서 알아보겠습니다.

 

 

1. System Hostname 의 확인

 

[root@vm01 ~]# hostname
vm01
[root@vm01 ~]#

[root@vm01 ~]#
[root@vm01 ~]# hostnamectl status
   Static hostname: vm01
         Icon name: vm
           Chassis: n/a
        Machine ID: f6ac0b24ae1642d38baceec5ecd03b32
           Boot ID: bc62df7111f64030878427c2b05322ee
    Virtualization: oracle
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-123.el7.x86_64
      Architecture: x86_64
[root@vm01 ~]#
[root@vm01 ~]#

 

 

2. Hostname의 변경


- Redhat 7 버전부터는 일부 그래픽컬한 응용프로그램에서 사용될 수 있는 icon name이란 별칭이 별도로 추가되었으며, 아래와 같이 icon-name도 함께 추가 해 주도록 한다.

 

[root@vm01 ~]#
[root@vm01 ~]# hostnamectl set-hostname test01
[root@vm01 ~]#
[root@vm01 ~]# hostnamectl set-icon-name test01
[root@vm01 ~]#
[root@vm01 ~]# hostnamectl status
   Static hostname: test01
         Icon name: test01
           Chassis: n/a
        Machine ID: f6ac0b24ae1642d38baceec5ecd03b32
           Boot ID: bc62df7111f64030878427c2b05322ee
    Virtualization: oracle
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-123.el7.x86_64
      Architecture: x86_64
[root@vm01 ~]#

 

 

3. 변경된 hostname 확인

 

[root@vm01 ~]#
[root@vm01 ~]# exit
logout

Connection closed by foreign host.

Disconnected from remote host(test01) at 10:12:43.

Type `help' to learn how to use Xshell prompt.
[c:\~]$

Connecting to 192.168.137.10:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.

Last login: Wed Dec 17 10:05:04 2014 from 192.168.137.1
[root@test01 ~]#
[root@test01 ~]#
[root@test01 ~]# hostname
test01
[root@test01 ~]#
[root@test01 ~]#
[root@test01 ~]# cat /etc/hostname
test01
[root@test01 ~]#
[root@test01 ~]#  

 

 

 

 

반응형