change_host_name
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| change_host_name [2023/04/03 07:00] – walkeradmin | change_host_name [2023/04/03 07:08] (current) – walkeradmin | ||
|---|---|---|---|
| Line 14: | Line 14: | ||
| | | ||
| hostnamectl | hostnamectl | ||
| - | \\ | ||
| \\ | \\ | ||
| This will give an output similar to below: | This will give an output similar to below: | ||
| - | \\ | ||
| \\ | \\ | ||
| < | < | ||
| Line 30: | Line 28: | ||
| Architecture: | Architecture: | ||
| </ | </ | ||
| + | In this example we can see that the hostname is the default value of <color # | ||
| + | \\ | ||
| + | \\ | ||
| + | To set the hostname use the following: | ||
| + | hostnamectl set-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 # | ||
| + | < | ||
| + | 127.0.0.1 | ||
| + | ::1 | ||
| + | 150.10.10.1 | ||
| + | </ | ||
| + | \\ | ||
| + | \\ | ||
| + | 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.1680505245.txt.gz · Last modified: by walkeradmin
