10-26-2015, 08:26 PM
Having just changed a hostname on 1 of my PC's thought I would share.
Maybe useful if you have made a mistake with the name, or you just want to change it, or you have "cloned" a VM in Virtualbox.
The hostname is the name of your computer, in a terminal you see,
dave@lappy:~$
"lappy" is the "hostname"
First make copies of the configuration files, in case you want to undo this:
Code:
sudo cp /etc/hosts /etc/hosts.old
sudo cp /etc/hostname /etc/hostname.old
Then you need to edit the "2" files below which have the "hostname" in them.
Edit the files and change the "old" hostname to the "new" hostname
Code:
gksu leafpad /etc/hosts
Code:
gksu leafpad /etc/hostname
Now re-boot, and you now have a "new" hostname
"Important"
If you have set up network "sharing" on this PC you also need to change the "netbios name" to match the "new" hostame
First make copy of configuration file, in case you want to undo this:
Code:
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.old
Code:
gksu leafpad /etc/samba/smb.conf
Edit the file and change the "netbios name =" from "old" hostname to the "new" hostname that you changed above
Now re-boot, your PC will now show on your network with a name that "matches" your "new" hostname
If you have created links to this PC from "other" PC's, you will also need to edit those links to match the "new" hostname.
If you wish to change back to the "original hostname", you will need to do the following:
Code:
sudo cp /etc/hosts.old /etc/hosts
sudo cp /etc/hostname.old /etc/hostname
sudo cp /etc/samba/smb.conf.old /etc/samba/smb.conf
The re-boot.
Remember to change back any links to this PC from "other" PC's,
you will need to edit those links again to match the "original" name.
Upgrades WIP 2.6 to 2.8 - (6 X 2.6 to 2.8 completed on: 20/02/16 All O.K )
Linux Lite 3.0 Humming on a ASRock N3070 Mobo ~ btrfs RAID 10 Install on 4 Disks
Computers Early days:
ZX Spectrum(1982) , HP-150 MS-DOS(1983) , Amstrad CPC464(1984) , BBC Micro B+64(1985) , My First PC HP-Vectra(1987)
Linux Lite 3.0 Humming on a ASRock N3070 Mobo ~ btrfs RAID 10 Install on 4 Disks
Computers Early days:
ZX Spectrum(1982) , HP-150 MS-DOS(1983) , Amstrad CPC464(1984) , BBC Micro B+64(1985) , My First PC HP-Vectra(1987)