adding hostname

adding hostname to solaris 10
Here's a simple way to add a name to your Solaris 10 computer so it doesn't say hostname "unknown" every time you log on.

Even though I did this on a Sun Ultra 10 (SPARC) , it should also work if you're using Solaris on a pc (x86) too.

Basically, you only need to edit three files which are located in the /etc directory. They are (1) nodename, (2) hostname.xl0 (substitute "xlo" with the actual name of your network card, and (3) hosts.

Step 1: switch over to the etc directory by typing cd /etc. Once there, type ls (that's the letter L, not the number 1) to see a listing of all the files in that directory. On my particular system, the file name "nodename" was not there so I had to create it. If you have it, great. If not, create it by typing vi nodename. After you're in that file, type whatever name you want to give your computer, save the file and exit.

Step 2: Next file to look for in /etc is "hostname.xl0" (again, substituting xl0 with your actual network card). Write the same name here that you put in step 1. Save file and exit.

Step 3: Now open the "hosts" file (do not include quotes) and write the same name as in steps one and two. Save* file and exit.

*For this last step, you may need to override the protection this file has and save it differently. For steps one and two I only had to save the files (using vi) by typing :x, but when I got to step 3, I could not save it this way. The only way to save it was by typing :w! which is one way to force it to save even though you'll get a message at first stating it's a "read-only" file.