Skip to content

Instantly share code, notes, and snippets.

@yuuichi-fujioka
Created July 4, 2013 10:22
Show Gist options
  • Save yuuichi-fujioka/5926592 to your computer and use it in GitHub Desktop.
Save yuuichi-fujioka/5926592 to your computer and use it in GitHub Desktop.
for ubuntu
name=$1
sudo sed -i -e "s/kernel.hostname.*/kernel.hostname=${name}/g" /etc/sysctl.conf
echo ${name} | sudo tee /etc/hostname
sudo hostname ${name}
sudo sed -i -e "s/127.0.1.1.*/127.0.1.1 ${name}/g" /etc/network/interfaces
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment