It is sooooooo easy
but if you start from scratch you might not know where to look for.
I would not recommend Debian 3.1. It is too much outdated by now. Download the netinstaller for Debian Etch. Etch is becoming Stable within the next few months. For intranet it certainly is stable enough.
Perform the netinstall. After that install the additional packages that you want to use. For Apache, PHP and MySQL that would be:
apt-get update
apt-get install apache apache-common apache2-utils libapache-mod-php4 libdbd-mysql-perl libmysqlclient12 mysql-client mysql-common mysql-server php4-common php4-mysql
For ruby, do
apt-cache search ruby and you'll find the ruby package you want to install.
Debian handles dependencies automagically: just accept whatever it says about installing and removing packages. As long as you don't install non-debian packages you can trust apt.
Last time I did install an intranet server it took me 20 minutes to get it up and running.
jlinkels