|
Size: 3640
Comment:
|
Size: 3625
Comment: Add ejabberd, ToC; sort applications, drop "other".
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 2: | Line 2: |
| ##||<tablestyle="width: 100%;" style="border: 0px hidden">~-[[DebianWiki/EditorGuide#translation|Translation(s)]]: none-~||<style="text-align: right;border: 0px hidden"> (!) [[/Discussion|Discussion]]|| ##---- This page explains how to change a system's {{{hostname}}} (i.e rename a computer/server) |
~-[[DebianWiki/EditorGuide#translation|Translation(s)]]: none-~ ---- = Rename a computer = This page explains how to change a system's {{{hostname}}} (i.e. rename a computer/server) |
| Line 7: | Line 8: |
| ## If your page gets really long, uncomment this Table of Contents ## <<TableOfContents(2)>> |
|
| Line 10: | Line 9: |
| = Rename a computer = | <<TableOfContents(3)>> |
| Line 22: | Line 22: |
| Line 30: | Line 29: |
| === ssmtp === Ssmtp is a light weight, send-only smtp server. |
=== CUPS === Adjust {{{/etc/printcap}}} . You need to restart the service. |
| Line 33: | Line 32: |
| Adjust {{{/etc/ssmtp/ssmtp.conf}}} ({{{hostname=}}}, etc.). You don't need to restart the service. | === ejabberd === See the [[http://www.ejabberd.im/node/641|How to Change Domain Name?]] FAQ entry in the ejabberd book. Temporarily adjusting the value of {{{ERLANG_NODE}}} in {{{/etc/default/ejabberd}}} to include the old hostname, can be used to re-establish service functionality, for performing a database backup. |
| Line 38: | Line 40: |
| === Mailname === Adjust {{{/etc/mailname}}}. You don't need to restart the service. |
|
| Line 41: | Line 46: |
| === Cups === Adjust {{{/etc/printcap}}} . You need to restart the service. === Mailname === Adjust {{{/etc/mailname}}}. You don't need to restart the service. === Openssh server === |
=== OpenSSH server === |
| Line 50: | Line 49: |
| === other === ''(to be written)'' there must be others... |
=== ssmtp === Ssmtp is a light weight, send-only SMTP server. |
| Line 53: | Line 52: |
| '''Charlie:''' ''It was me who took you. Not the Others...'' | Adjust {{{/etc/ssmtp/ssmtp.conf}}} ({{{hostname=}}}, etc.). You don't need to restart the service. |
Translation(s): none
Rename a computer
This page explains how to change a system's hostname (i.e. rename a computer/server)
Executive summary: hostname(1) isn't enough.
Contents
Core networking
Update /etc/hostname
Update /etc/hosts, so local address(es) resolves with the new system name.
- Reload the network configuration. You have two options
Reload configuration files
This will temporarily disconnect your system from the network (ssh usually resists short disconnection) invoke-rc.d hostname.sh start invoke-rc.d networking force-reload invoke-rc.d network-manager force-reload
ToDo: is it useful to reload network-manager?
or the lazy way: Restart the system.
Application specific
avahi
Avahi is used to publish (announce) local services. If you tweaked /etc/avahi/* you should run:
invoke-rc.d avahi-daemon force-reload
CUPS
Adjust /etc/printcap . You need to restart the service.
ejabberd
See the How to Change Domain Name? FAQ entry in the ejabberd book.
Temporarily adjusting the value of ERLANG_NODE in /etc/default/ejabberd to include the old hostname, can be used to re-establish service functionality, for performing a database backup.
Exim
Adjust /etc/exim4/update-exim4.conf.conf (hostname=). You need to restart the service.
Mailname
Adjust /etc/mailname. You don't need to restart the service.
Message Of The Day
Adjust /etc/motd. You don't need to restart a service.
OpenSSH server
Adjust /etc/ssh/ssh_host_rsa_key.pub and /etc/ssh/ssh_host_dsa_key.pub (root@hostname at the end). You need to restart the service.
ssmtp
Ssmtp is a light weight, send-only SMTP server.
Adjust /etc/ssmtp/ssmtp.conf (hostname=, etc.). You don't need to restart the service.
Idea of script to help you on
Intrusive script
Please understand that this script is dangerous. You should check if all the files listed by grep -rl "$ancien" /etc must really be modified before launching this script
Take care you'd better do a grep before...
Not-so intrusive script
#!/bin/bash
#
usage() {
echo "usage : $0 nouveau_nom_hote"
exit 1
}
[ -z $1 ] && usage
ancien=`hostname`
nouveau=$1
for file in \
/etc/exim4/update-exim4.conf.conf \
/etc/printcap \
/etc/hostname \
/etc/hosts \
/etc/ssh/ssh_host_rsa_key.pub \
/etc/ssh/ssh_host_dsa_key.pub \
/etc/motd \
/etc/ssmtp/ssmtp.conf
do
[ -f $file ] && sed -i.old -e "s:$ancien:$nouveau:g" $file
doneTake care you'd better do a grep before...
See also
?Howto Clone a System - system unique identifiers, to be changed when cloning a system.
