Changing Server Hostname - KeegMitch/Operations-Engineering-group-c GitHub Wiki
How to change your server hostname on Ubuntu 18.04 LTS
- Go to the hostname file here,
sudo nano /etc/hostnameif using nano editor, if using vimsudo vim /etc/hostname, screenshot below is for the management server
- Use the command
sudo rebootwhich will close putty, reopen the server and login, The screenshot below is the new hostname for the database server, "db-c" shown in the prompt, which serves the purpose of using this server for databases
Update: The hostnames for all the other servers all match the prompt/purpose they serve
Management server:
App server:
Backup server:
Changing the hosts file
-
Go on to the hosts file:
sudo vim /etc/hosts -
Add the hostname into the public IP address so that it's recognised by other servers, make sure you do this on all servers:
In Management server:
In DB server:
- Make sure it's consistent with the hostname in /etc/hostname, this will be important when mapping them to configure puppet
In Management server:
In DB server:
- Testing that the servers can communicate with each other
ping: Note that only the private addresses work and not public, but the hostnames work
Issue: we can't ping the db-c hostname but it works on nslookup and the private ip address
nslookup