Thursday, February 4, 2010

HOWTO: Set up Ubuntu 9.10 Server with SSH and Static IP

If you read earlier I have strange requirements for my FTP needs. While I'm still working out the kinks I have solved many problems with Samba, shared access, groups and more using Pure-FTP and Ubuntu Server. All of this is now running on my new mini server which I built last week for $219 shipped.

I'm not going to jump into any particular step in too much detail (it would make a book) but I will try to note on a few things. Other steps are just listed.

Install Ubuntu Server edition.
Start the server install and on many of the prompts, just choose the logical or default choice. However here are a few that some may get confused with.

  • For the disk partitioning Choose Guided - Use Entire Disk. Do not choose the default LVM option unless you know what it is. LVM disks are harder to clone and some disk utilities do not work with them.
  • For proxy settings Leave blank unless you know this for sure.
  • For Automatic Updates Choose Manual Updates
  • For Packages Choose SSH Server and no others. You can always add more later, but get this working first.

After installation is finished reboot the system.

Logging In via SSH

I choose to keep the server headless (no monitor, keyboard, mouse, etc.) So all that is plugged into the computer is a network cable and power. It can help the computer boot faster if you go into the bios and turn off booting to other devices except for the primary drive. It also helps improve the physical security a little. Using this computer headless means that we need to connect via SSH. To do this you can download putty for free. If you have Ubuntu as your desktop you can find putty in your Add remove Programs.

The next step is to find out what the IP of the server is. I simply go to my router and it lists it.
Using Putty, just type in the IP of the server. You will accept the certificate then you are connected. Now log in with the name and password you created during the install.

Commands/text that should be typed will be italicized. Perform all actions in sequence.

Switch to root/administrator:  
sudo su

Upgrade your System
You will want to do this when ever you login via putty and you see packages are ready to be installed.
apt-get upgrade
If you see some packages are bypassed then you need to use this also.
apt-get dist-upgrade

I recommend rebooting if you used apt-get dist-upgrade. There are other ways to apply certain settings instead of rebooting, but I just default to a reboot elsewhere.
reboot now

Don't forget to switch to root if you rebooted
sudo su

Change to a Static IP. I only have one network interface. Yours may be different. Your network IP settings may be different too.
nano /etc/network/interfaces

Change the last line dhcp to static. Mine is now iface eth0 inet static

Then add the following lines to the end.
    address 192.168.1.99
    netmask 255.255.255.0
    broadcast 192.168.1.255
    network 192.168.1.0
    gateway 192.168.1.1

Then press control-o to save and press enter to keep the current name.
Then press control-x to exit
From now on it is assumed you will save and exit nano on your own.

nano /etc/hosts
Change the ip on the second line to the address you used above. My hosts file starts like this (atom is the name of the computer):
127.0.0.1   local host


192.168.1.99   atom
At the bottom, add any ip's for any file servers or other network resources you may need to access followed by the system name.
192.168.1.97 worldbook-work
192.168.1.98 worldbook-media

save and exit.

/etc/init.d/networking restart

At this point your putty window should stop working. close putty and start a new window for the new IP. You will need to accept the certificate again.

Congrats. You now have a server setup and ready to work. Now you need to give it something to do. In this case I'm going to make mine serve FTP. Check out the next post where I install and configure Pure FTP with security settings and passive NAT support.

No comments:

Post a Comment