How to change a server's hostname: Difference between revisions
Jump to navigation
Jump to search
Created page with 'Update the following files: * /etc/hosts * /etc/hostname' |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 2: | Line 2: | ||
* /etc/hosts | * /etc/hosts | ||
* /etc/hostname | * /etc/hostname | ||
== Ubuntu 18.04 == | |||
See current hostname and related info: | |||
<pre> | |||
hostnamectl | |||
</pre> | |||
Change hostname: | |||
<pre> | |||
hostnamectl set-hostname my_new_hostname | |||
</pre> | |||
Update <code>/etc/hosts</code> if necessary. | |||
If <code>cloud-init</code> is installed, edit <code>/etc/cloud/cloud.cfg</code> | |||
<pre> | |||
preserve_hostname: true | |||
</pre> | |||
== Postfix == | |||
* update <code>/etc/mailname</code> | |||
* update <code>/etc/postfix/main.cf</code> | |||
* restart postfix |
Latest revision as of 18:00, 28 January 2019
Update the following files:
- /etc/hosts
- /etc/hostname
Ubuntu 18.04
See current hostname and related info:
hostnamectl
Change hostname:
hostnamectl set-hostname my_new_hostname
Update /etc/hosts
if necessary.
If cloud-init
is installed, edit /etc/cloud/cloud.cfg
preserve_hostname: true
Postfix
- update
/etc/mailname
- update
/etc/postfix/main.cf
- restart postfix