호스트 명 바꾸기

bluehope·2023년 1월 4일
0

개발환경설정

목록 보기
4/5
post-thumbnail

Rocky Linux를 처음 설치하면 서버의 hostname이 localhost.localdomain 의 재미없는 이름으로 되어 있다. 이 기본값은 여러 서버를 사용하는 경우 구분이 명확하지 않아 변경하는 것이 필요하다.

Hostname 변경하기

[bluehope@localhost ~]$ hostname
localhost.localdomain
[bluehope@localhost ~]$ sudo hostnamectl set-hostname bluehope
[bluehope@localhost ~]$ hostname
bluehope
[bluehope@localhost ~]$ exit
logout

Connection closed.

이제 다시 접속해 보자

재접속 후에도 hostname 유지되는지 확인

$ ssh 192.168.0.179


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

Activate the web console with: systemctl enable --now cockpit.socket

Last login: Thu Jan  5 00:11:38 2023 from 192.168.0.195
[bluehope@bluehope ~]$ 

호스트명이 재 로그인 해 보면 정상적으로 변경된 것을 확인할 수 있다. 이제 여러대의 서버에 접속하더라도 hostname에서 혼선을 가져오지 않을 수 있게 하였다.

profile
다시 시작해보자!

0개의 댓글