Linux set hostname

First login to the server via SSH. Then run:
hostname $servername

Update the hosts file – Look for the primary IP of the server. Follow the same format and replace the old hostname with the new hostname on the same line as the primary IP.
vi /etc/hosts

Update your network file with the new hostname:
vi /etc/sysconfig/network

Leave a Reply

You must be logged in to post a comment.