Thứ Ba, 3 tháng 11, 2015

Set Hostname on CentOS

Set Hostname on CentOS

Change and Set Hostname Command for RHEL / Centos 7 , refer to here

Step 1: Login to your CentOS Server

Locate the IP address of your Server and login as the root user.

ssh root@server

Step 2: Use the hostname utility

Change your hostname to a different name of your choosing. For example:

hostname 10tut.localdomain
Step 3: Edit /etc/hosts

Open the /etc/hosts file with your favorite text editor. For example:

nano /etc/hosts

Change the first line and replace your old hostname with the new one. Save the file and exit the editor.

Step 4: Edit /etc/sysconfig/network

This file also contains your hostname. Open the /etc/sysconfig/network file with your favorite text editor.

Change HOSTNAME=localhost to your desired hostname. For example: HOSTNAME=10tut.localdomain

Step 5: Check your hostname

Run the following command to check your new hostname:

hostname

The new hostname will be displayed in your ssh terminal.

Share This!


Không có nhận xét nào:

Đăng nhận xét