Sunday, December 03, 2006

Home Linux Server Part 1: Debian setup

I've decided to write a series of of posts on setting up a Linux-based server on your home network using Debian 3.1 ("Sarge"). Tonight is the first posting, detailing how to set up the base Debian system to later configure as a server. We'll set up only the critical installation files, the root account, one other account, and telnet and x-server.

I'm setting up my server on an old Dell Inspiron 3000 laptop. As you can tell, it is a terrible system. The only component I have added is a 100Mbit Ethernet card. Thus, pretty much any fairly recent machine you can find will work for what we want to do. I'm going to assume this machine also has a CD drive, and that it will be a dedicated server, in that you will not be dual-booting the system.
Debian server system

  1. Download and burn to CD the Debian 3.1 NetInstall disc image from here.
  2. Insert the NetInstall CD into the drive of the computer you'll be using as a server, and reboot the computer. Note: You will lose all data on the hard drive following these instructions. Be sure to back up anything you need.
  3. Start the installer with the linux netcfg/disable_dhcp=true debian-installer/framebuffer=false command, indicating we do not want to configure DHCP at this time, and we want the text-based setup (because it's easier, actually)
  4. Select your language, region, and keyboard layout
  5. Set up your network settings:
    • Choose an unused IP on your network. Check its availability using your router's status tools, or by using a different computer on the network to try pinging the desired IP. You will probably want to use 192.168.xxx.xxx. Make sure, though, that the first two octets match those used on the rest of your network.
    • Enter your subnet mask. If your first two octets are 192.168, the mask is 255.255.255.0
    • Enter your gateway address. Normally, this is the IP for your router.
    • For a DNS or name server, enter in either your ISP's nameserver, or, if your router does name serving, re-enter your gateway address.
    • Create a unique hostname for the sever. I used present-server.
    • Enter a domain name of your choice. I used present.net.

  6. Partition your hard drive:
    • Create a 256MB swap partition.
    • Create a 700MB root partition.
    • Create a final /home partition with the remaining space.

  7. Allow the installer to run for a while. When prompted, install GRUB to the Master Boot Record.
  8. Remove the CD from the disc drive and enter Continue to reboot from the hard-drive. Configure your timezones, root account, and user account. Do not use PPP to install the system if prompted. Choose to obtain your repositories from http, and select a local mirror.
  9. Do not install anything at the software selection screen. When prompted, do not configure Exim.
  10. Use the default root username.
  11. Press Enter at the "Thank You" screen, and note you are at a login prompt.
  12. Login as root using the password you provided.
  13. Allow telnetting to the server by installing the telnet daemon with apt-get install telnetd
  14. Install a minimal GUI with apt-get install x-window-system:
    • Choose "autodetect hardware"
    • Use "xfree86" for the keyboard rule.
    • Maintain maximum compatibility unless you know what to use, and choose "pc101" for the keyboard model.
    • Select your layout language
    • Select /dev/psaux for PS/2 mice, and PS/2 from the list of mouse models.
    • Answer the prompt about the LCD screen, and configure the monitor settings in the next few screens.
    • Use a 16-bit color depth.
    • Use a printer resolution of 300dpi.
    • Prevent x-server from starting during boot by renaming the symbolic link in the startup directory with mv /etc/rc2.d/S99xdm /etc/rc2.d/_S99xdm.

  15. Remove the CD and reboot the system with Ctrl+Alt+Del. Login as root.
  16. Edit .bashrc to set virtual terminal sessions to VT100 terminal type:
    • Run nano .bashrc to begin editing .bashrc with nano.
    • Add to the end of the file the line export TERM='vt100'.
    • Hit Ctrl-X, Y, enter to save the file and exit nano.

So that's it. Test x-server is up and running by running the command startx, and test telnet by connecting to the server at the IP you specified from a different machine. Next time, we'll start adding some tools for your server to make it do something.

More information, as well as the rough plans I followed in setting up my server, are available from AboutDebian.com.

No comments: