CentOS 6까지는 /etc/sysconfig/network 설정파일에 정의 도었지만 CentOS 7 부터는 새로운 init시스템(systemd) 으로 변경되면서

/etc/hostname 에 의해 정의된다.

hostnamectl 이라는 명령어가 추가되었는데, 이 명령을 이용해 hostname을 조작할 수 있다.

1. hostname 상태 확인하기

# hostnamectl status
   Static hostname: web.yufunding.com
         Icon name: computer-desktop
           Chassis: desktop
        Machine ID: c9b7cf08f05840c08378307dccc659c8
           Boot ID: 309a6f6094a8436fb89e5f38de46987d
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-327.36.2.el7.x86_64
      Architecture: x86-64

2. hostname 변경하기

# hostnamectl set-hostname [호스트명]

3. hostname 변경 후 확인

# hostname 명령어로 확인하거나 (Cent 4, Cent5, Cent6 부터 사용한 기본 명령어)

cat /etc/hostname 명령어로 /etc/hostname 파일에 정의한 hostname 이 입력되어 있는지 확인

/etc/hostname 에 정의가 되어 있으면 재부팅되어도 적용됨.

'Works > CentOS & RockyLinux' 카테고리의 다른 글

lastb - 로그인 실패 로그 확인  (0) 2017.02.14
CentOS 다운로드 미러 사이트  (0) 2017.01.03
tmpwatch  (0) 2016.10.19
du 명령어의 활용  (0) 2016.09.02
필요한 rpm 패키지를 다운받자  (0) 2016.08.03