Setting hostname on Fedora 18

admin's picture

Setting hostname on Fedora 18 permanently, from command line, turned out to be trickier than I thought it would be.

hostname <name> will only set the hostname temporarily (until the next restart). Unlike older Redhat/CentOS peers, editing /etc/sysconfig/network and adding a 'HOSTNAME=' directive is ineffective. sysctl kernel.hostname=NEW_HOSTNAME is also only temporary. This is because the hostname is now stored in /etc/hostname.

hostnamectl set-hostname <name> --pretty
hostnamectl set-hostname <name>.<localdomain> --static
will set it permanently.

Hat image attributed to http://www.flickr.com/photos/puuikibeach/4959026655/, CC Flickr

Recent Articles

published 3 years 1 month ago

Site

Follow Us

Twitter icon
Facebook icon
LinkedIn icon
SlideShare icon
YouTube icon
RSS icon