Wednesday, December 19, 2007

Changing your hostname in Linux (PCLinuxOS)

With networking today, you need to have computers hook up with each other in order to file transfer, surf the web, or have a wicked LAN game between many friends (or just your roommates). Installing PCLinuxOS was easy enough for me but I found that trying to network takes some research. One of the fastest ways I found was changing a file and rebooting.

First, bring up a terminal and bring your superuser. If you have no idea what I'm talking about right now, it is best if you stop there and backup your system before continuing. I'm not saying that as a derogatory comment, I'm talking from experience. Messing with system files and partitions was not the brightest thing to do, but I didn't have any teachers other than a Linux disc and the internet.

Continuing on, find your /etc/sysconfig/network file and open it with your favorite text editor. I use vi but it's all text based and can cause panic if you find out that hard way (as I did) when you open it, you can't just save and quit like Microsoft Word or notepad. If you want to use something like Microsoft's notepad, use kwrite or gedit. Those are great starter programs that look very much like notepad.

When you bring it up, you should have a file that has one line:

NETWORKING=yes

Go ahead and beneath that, add this line:

HOSTNAME=hostname

Edit the second hostname to the name you want for your computer. For example, if my computer was a file server that held all my anime, I could name it this.

HOSTNAME=anime_server

Notice the underscore. Computer names never have spaces in them. If you try to add in a space, it will return an error in Windows. In Linux, I don't know what it will do, nor do I want to find out.

Save your file and reboot your computer and your computer will be ready for local area networking. Just a small note, you don't need to do this if you want to just connect to the internet. This change is only needed for local area networks.

No comments: