리눅스 7.x 이상 부터 hostname 변경시 hostnamectl 명령어로 hostname를 쉽게 변경 할 수 있습니다.
[root@localhost ~]# hostname
localhost.localdomain --> 기본적으로 현재 사용 중인 이름
[root@localhost ~]#
[root@localhost]# hostnamectl set-hostname SLASM19C
[root@localhost]# hostname
slasm19c --> 소문자로 변경 되었네요.
[root@localhost]#
[root@localhost]# hostnamectl --help
hostnamectl [OPTIONS...] COMMAND ...
Query or change system hostname.
-h --help Show this help
--version Show package version
--no-ask-password Do not prompt for password
-H --host=[USER@]HOST Operate on remote host
-M --machine=CONTAINER Operate on local container
--transient Only set transient hostname
--static Only set static hostname
--pretty Only set pretty hostname
Commands:
status Show current hostname settings
set-hostname NAME Set system hostname
set-icon-name NAME Set icon name for host
set-chassis NAME Set chassis type for host
set-deployment NAME Set deployment environment for host
set-location NAME Set location for host
[root@localhost]#
[root@localhost ~]# hostnamectl set-hostname SLASM19C --static
[root@localhost ~]# hostname
SLASM19C --> 대문자로 변경
[root@localhost ~]#
[root@localhost ~]# reboot
[root@SLASM19C ~]# hostname
SLASM19C
[root@SLASM19C ~]#
[root@SLASM19C etc]# more /etc/hostname
SLASM19C
[root@SLASM19C etc]#
[root@SLASM19C etc]# hostnamectl set-hostname SLasm9c --static
[root@SLASM19C etc]# hostname
SLasm9c --> 대소문자 변경
[root@SLASM19C etc]#
[root@SLASM19C etc]# hostnamectl
Static hostname: SLasm9c
Icon name: computer-vm
Chassis: vm
Machine ID: 3f62be271cd1354d98aedb0211e7bffa
Boot ID: fa751d2126f441a29c000abcef1ba4c3
Virtualization: kvm
Operating System: Red Hat Enterprise Linux Server 7.7 (Maipo)
CPE OS Name: cpe:/o:redhat:enterprise_linux:7.7:GA:server
Kernel: Linux 3.10.0-1062.el7.x86_64
Architecture: x86-64
[root@SLASM19C etc]
[root@server-150 ~]# hostnamectl
Static hostname: server-150
Icon name: computer-vm
Chassis: vm
Machine ID: 36cc986e11e540708dbf81d00c454c56
Boot ID: 81d0fc11950a4842b3693b9122cda935
Virtualization: kvm
Operating System: Red Hat Enterprise Linux Server 7.2 (Maipo)
CPE OS Name: cpe:/o:redhat:enterprise_linux:7.2:GA:server
Kernel: Linux 3.10.0-327.el7.x86_64
Architecture: x86-64
[root@server-150 ~]#
번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|
26 | HP-UX Glance adviser를 활용하여 모니터링 데이터 수집 | 명품관 | 2016.04.08 | 9542 |
25 | RAC SCAN 사용을 위한 DNS 서버 설정하기 | 명품관 | 2020.11.10 | 9237 |
24 | strace 사용법 | 명품관 | 2016.02.18 | 8321 |
23 | nmon 사용법 | 명품관 | 2016.02.05 | 7812 |
22 | sudo 사용시 is not in the sudoers file. This incident will be reported 에러 해결법 | 명품관 | 2016.02.19 | 3413 |
21 | Oracle Linux 8.2 버전 chrony 설정하기 | 명품관 | 2020.09.17 | 2418 |
20 | iscsi 서버/클라이언트 설정하기(with targetcli) | 명품관 | 2020.11.14 | 2242 |
19 | 실시간으로 TCP와 UDP 포트를 감시하는 방법 | 명품관 | 2020.02.05 | 2230 |
18 | 59 Linux Networking commands and scripts | 명품관 | 2019.11.18 | 1592 |
17 | Memory Usage 확인용 스크립트 [2] | 명품관 | 2019.04.15 | 1423 |
» | [7.x] hostname 변경하는 hostnamectl 사용법 [1] | 우뽕 | 2020.02.05 | 1002 |
15 | 리눅스 Free 메모리의 이해 | 명품관 | 2018.08.08 | 989 |
14 | Linux에서 LVM 사용 | 명품관 | 2020.11.10 | 852 |
13 | top logging script | Talros | 2020.01.17 | 832 |
12 | find 사용하기 | 명품관 | 2016.03.04 | 738 |
11 | Alias 사용 | 명품관 | 2021.03.03 | 674 |
10 | Swap File 생성하기 | 명품관 | 2019.04.15 | 664 |
9 | vi 에디터 환경 설정 | 명품관 | 2016.02.02 | 643 |
8 | bpytop 모니터링 툴 | 명품관 | 2021.01.18 | 629 |
7 | Installing RedHat Enterprise Linux 8.0 with screenshots | 명품관 | 2019.09.26 | 546 |
이런 명령어도 있었군요...
좋아요... ㅎㅎ