hostnamectl로 hostname 변경

hostnamectl 명령어로 hostname 변경하기 명령어) ``hostnamectl set-hostname 호스트명

예시)
[root@amazonlinux ~]# hostname
amazonlinux.onprem
[root@amazonlinux ~]# hostnamectl set-hostname MinhangK8S-01
[root@amazonlinux ~]# hostname
minhangk8s-01
[root@amazonlinux ~]#
예시)
[root@amazonlinux ~]# exit
logout
Connection to 192.168.100.52 closed.
[root@Minhang9 ~]# ssh 192.168.100.52
root@192.168.100.52's password: 
Last login: Tue Oct 24 06:16:15 2023 from 192.168.100.100
   ,     #_
   ~\_  ####_        Amazon Linux 2
  ~~  \_#####\
  ~~     \###|       AL2 End of Life is 2025-06-30.
  ~~       \#/ ___
   ~~       V~' '->
    ~~~         /    A newer version of Amazon Linux is available!
      ~~._.   _/
         _/ _/       Amazon Linux 2023, GA and supported until 2028-03-15.
       _/m/'           https://aws.amazon.com/linux/amazon-linux-2023/

3 package(s) needed for security, out of 6 available
Run "sudo yum update" to apply all updates.
[root@minhangk8s-01 ~]#       => 프롬프트명의 hostname도 바뀌어 있음

Revision #3
Created 24 October 2023 06:22:42 by 신민항
Updated 29 November 2023 09:39:08 by 신민항