User Tools

Site Tools


change_host_name

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
change_host_name [2023/04/03 08:01] walkeradminchange_host_name [2023/04/03 08:08] (current) walkeradmin
Line 28: Line 28:
       Architecture: x86-64       Architecture: x86-64
 </file> </file>
 +In this example we can see that the hostname is the default value of <color #ed1c24>localhost.localdomain</color> and we want to change this to something that we can use and recognise.
 +\\ 
 +\\ 
 +To set the hostname use the following:
 +    hostnamectl set-hostname 'your-hostname'
 +\\ 
 +\\ 
 +For example, lets say I want to change the hostname to be mailsvr, then I would use:
 +    hostnamectl set-hostname mailsvr
 +\\ 
 +\\ 
 +We can now check the hostname from the console again using:
 +    hostname
 +    
 +    or 
 +    
 +    hostnamectl
 +\\ 
 +\\ 
 +The hostname returned will now be the one you set (mailsvr) in this example.
 +\\ 
 +\\ 
 +We also need to edit the following file:
 +    /etc/hosts
 +\\ 
 +\\ 
 +Add a line at the end of the file with your <color #ed1c24>Alma Linux IP</color> and the <color #ed1c24>hostname</color> you just used:
 +<file>
 +127.0.0.1   controller localhost.localdomain localhost4 localhost4.localdomain4
 +::1         controller localhost.localdomain localhost6 localhost6.localdomain6
 +150.10.10.1    mailsvr
 +</file>
 +\\ 
 +\\ 
 +Now reboot the Alma Linux instance.
 +\\ 
 +\\ 
 +When you log back in, you should see your command prompt now contains your hostname:
 +    [root@mailsvr /]#
 +\\ 
 +\\ 
 +Hostname setting is complete.
 +\\ 
 +\\ 
  
change_host_name.1680505264.txt.gz · Last modified: 2023/04/03 08:01 by walkeradmin