summaryrefslogtreecommitdiff
path: root/src/Changing_the_Hostname_on_a_Linux_Box.adoc
blob: 7ea649ac0dc152bfe799f954a6bd8ef9ff390937 (plain)
    1 Changing the Hostname on a Linux Box
    2 ====================================
    3 :author: Aaron Ball
    4 :email: nullspoon@iohq.net
    5 
    6 
    7 == {doctitle}
    8 
    9 I recently had need to change a server name due to a change in our server
   10 naming scheme (local ski resorts to breweries). For the simple comedy of the
   11 naming scheme switch, here's how it currently looks (without server prefixes
   12 for security purposes of course). If you just want the solution, skip down a
   13 paragraph.
   14 
   15 Our current environment is mostly virtualized. The hosts are named after
   16 breweries and their virtual guests are named after the beers that each brewery
   17 produces. Clever, yeah? I can already feel my morale rising.
   18 
   19 
   20 
   21 First off, open up a terminal window
   22 
   23 image:files/terminal001.png[height=400]
   24 
   25 Then type
   26 
   27 image:files/terminal002b.png[height=200]
   28 
   29 The file that comes up should contain nothing but a hostname. In my case this
   30 is . (Ctrl + x closes the file, y says to save the file before closing, Enter
   31 saves the file under the original filename).
   32 
   33 image:files/terminal003.png[height=300]
   34 
   35 Once you've done this, all you need to do is restart your computer and you
   36 should be golden.
   37 
   38 Here's how we fix the aforementioned issue.
   39 
   40 If you've closed your terminal for the restart, open it up again. Type *sudo
   41 nano /etc/hosts*
   42 
   43 image:files/terminal004.png[height=300]
   44 
   45 At the top you should see 127.0.0.1, 127.0.1.1 and their associated
   46 'hostnames'. The one to the right of 127.0.1.1 should show your old hostname.
   47 Change that to the new hostname and save the file (Press Ctrl + x -> y ->
   48 Enter). Now your computer's IP address should resolve to its new hostname.
   49 
   50 Enjoy!
   51 
   52 Now for a cup of joe...
   53 
   54 
   55 Category:Linux
   56 
   57 
   58 // vim: set syntax=asciidoc:

Generated by cgit