Digital Logic

Archive for December, 2008

Doing Things the Hard Way: Debian GNU/Linux

by on Dec.04, 2008, under Technology

So in the midst of panicking for exams and living in my crapshack, I totally forgot that I actually have a blog sitting here. Somebody even commented on it, but got blocked by my spam catcher.

Anyways, over the last few days I’ve been struggling through getting a working installation of Debian on my server box. For those of you who don’t know me, let me give you an overview of my knowledge of the wonderful world of Linux: little to none.

So, while I won’t bore you with the details of actually installing it (basically you put the CD in and press go), I will regale you with some of the adventures I have had setting up and configuring this system. I’ve been working exclusively from the command prompt.

First of all, what exactly am I working with? Well, the important parts are below:

  • Intel E2160 Dual Core CPU
  • 2GB RAM
  • 2x500GB storage drives (I haven’t finished formatting the rest) and a 250GB boot drive.
  • Antec 900 Case

Static IP in Debian

Alright, first things first: I hate networking. I don’t really know why some systems don’t want to communicate with others, but that’s the way it is. I like my servers to have static IPs because I find that the hostname is often unreliable. In Windows XP, which is what the system used to have on it, it’s a simple 4 or 5 clicks followed by an OK to get you set up. In Debian, this appears to be a much different story. It shouldn’t be a shock to anybody that you need to be root to perform these operations.

The file that you’re looking for here is: /etc/network/interfaces

In the file, you’ll probably see some auto-generated information about your current interfaces. Now, for me, my ethernet card is eth1. eth0 was mysteriously stolen by the firewire interface I didn’t even know I had. In order to set a  static IP for eth1, I had to enter the following (I really wish I had a code box):

iface eth1 inet static
address 192.168.1.20
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1

This tells eth1 to use the address 192.168.1.20… somehow. I hear that broadcast and gateway are both optional!

Configuring Programs to Run at Boot in Debian

This is something that sounds a hell of a lot easier than it actually is (at least the first time you do it). First of all, you need to write  a shell script that goes in the /etc/init.d/ directory. I’ll post the one that I use to start SABnzbd+ at boot. Feel free to correct me if there’s something wrong with it, but it works and that’s really all I care about.

— sabnzbd.sh —

#!/bin/sh

case “$1″ in
start)
echo “Starting SABnzbd.”
/usr/bin/sudo -u warren -H /etc/sabnzbd/SABnzbd.py -d -f /home/warren/.sabnzbd/sabnzbd.ini
;;
stop)
echo “Shutting down SABnzbd.”
/usr/bin/wget -q –delete-after “http://192.168.1.20:1200/sabnzbd/shutdown”
;;
*)
echo “Usage: $0 {start|stop}”
exit 1
esac

exit 0

— end of file —

So essentially it launches python to start running SABnzbd+. You can start and stop it manually by typing:

% /etc/init.d/sabnzbd.sh start/stop

In addition to placing this script in the directory, you also have to make the necessary symlinks to have it run at boot. To do this, I simply type the command:

% update-rc.d sabnzbd.sh defaults

Hooray. Done.

I’m sure I’ll run into other adventures with my setup and I’ll be sure to post anything educational here. Either way, I’m pretty happy with the fact that it’s actually up and running now, and I hope it stays that way….

Leave a Comment more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...