Linuxdoc Linux Questions
Click here to ask our community of linux experts!
Custom Search
Next Previous Contents

8. Debian Server Setup

This section explains how to set up your server machine to be an install server for Debian. You can set up any Linux distribution to be a Debian install server, this machine does not necessarily have to be running Debian. Don't forget that there are already plenty of Debian mirrors out there that provide free access to the Debian archive so unless you really need your own archive it might be best just to use one that already exists.

This guide starts from the point where you have a machine installed with Linux which is already up and running and connected to your network. If you require help with installing Linux on your server then please consult the Further Information section of this HOWTO in Appendix A.

8.1 Setting Up Filespace

In order for your server to act as a Debian network install server you will need to set up your machine to be a mirror of the Debian archives. Unlike most Linux distributions, Debian is commonly installed over the network, so you are not likely to have obtained a set of CD images containing Debian. A mirror system is provided that enables you to copy all the required data to your own server machine, for free.

Before you even think about setting up your machine as an install server, you must check that you have the required space available. This sounds like a trivial thing to check but it is very important and easily forgotten when you're setting up.

How much space will you need?

The entire Debian archives are roughly around 40Gb at the time of writing but if you are going to set up a full mirror then bear in mind that this will grow. It is possible for you to mirror only parts of the Debian archive and you can obviously mirror just the parts that you think you will require. For example, if you do not use a certain machine architecture then there may be little point in your mirroring this part of the archive.

The latest information about the size of the Debian archive is available from their website at http://www.debian.org/mirror/size.

How much space do you have?

You will need the appropriate amount of space available to your system on some local filesystem. It does not matter what form this takes, whether it's a RAID device, local disk (either SCSI or IDE), etc. Ensure that the space you intend to use is formatted with your chosen filesystem and is mounted.

You can check this space with the command:

df -h

If this output shows you have enough space then great, you can continue. If not then it's time to think about an upgrade to your intended server machine!

8.2 Mirror the Debian Archive

When you are confident that you have enough space for the data you want to mirror then you can move on to this step. If you are not sure you have enough space to mirror all the parts of the Debian archive that you want then you can always try this method, then if you run out of space, remove some parts of the archive from the mirror and try again.

Debian maintain their own guide on how to set up your own Debian mirror. You are welcome to view this at http://www.debian.org/mirror/ftpmirror. The list of steps below is based on the Debian instructions but is my own interpretation of them, designed to be easy to use and understand.

Where to Mirror From?

There are an awful lot of Debian sites out there that you could mirror from. It is best for you to choose one that is near your location or one that you know will have a good bandwidth to your location. Please remember, that if everybody uses the same sites for their own mirrors then things will get rather slow, so choose carefully.

A list of sites that you can choose to mirror from can be found at http://www.debian.org/misc/README.mirrors

How to Mirror?

I would recommend using a program called rsync to copy the data from your chosen server to your own server. This is a program that is ideally suited to mirroring data from one system to another. If you want to find out more information about rsync itself then see the webpages or the man pages for it.

Debian provide a well commented script at http://www.debian.org/mirror/anonftpsync that will perform the mirroring for you. Go to this site and download the script to your server machine, we will then need to set up the script to mirror the archive as you want it.

Now go through the entire script (it's not very long) and look at each line. Decide whether you want the line to be active in your script or not. If you don't know what a line does then it is probably best to leave it at it's default setting. However, you must set up the script with some minimal settings in order for it to work at all. These will include your chosen server, the location to put the archive on your machine, etc.

Once you have set up the script with all the required information requested in it then you are ready to run it and it will start copying data from the server you have chosen to your own server machine. Don't forget to change the permissions of the script so that it is executable and then run it from the command line.

The Debian archive is regularly updated and in order to maintain your own archive and make sure it is up to date, you will need to periodically run the script again to copy any changes made. NOTE: the script uses rsync which is a one-way transaction, you can never copy from your machine to your chosen server (as you don't have permission to do so!). It is probably best to run the script daily, so you can edit your crontab to do this or put the script in /etc/cron.d/cron.daily if your Linux distribution has this set up.

8.3 Enable Remote Access

Time to make your install data available to other machines on the network. Debian can be installed using NFS, HTTP and FTP protocols. You can select which of these will be used at install time on the client. If one of the services is not setup on the machine then it will still be available for selection by the client but the install will not work. Therefore, it is either best to enable all three services on your server (so they all work on each client machine) or if you don't enable all three then advertise the fact very well and say which service should be used for your particular install server.

NFS

To install over NFS you need to meet certain conditions on the server:

To export your install directory edit the /etc/exports file and add an entry for directory you have copied your Debian archive to. In our examples throughout this HOWTO, we would use the folowing line:

/install *(ro)
When you have saved your exports file you must then get your NFS daemon to read its configuration file again in order to export the directory you just added. Do this by running the command:
exportfs -r
This gives us the most simple read-only export to all hosts on our network. If you want to include more advanced options in your export e.g. only exporting to certain hosts on the network or a certain subnet, etc then see your man page for the exports file at exports (5).

FTP

To install over FTP you need to allow FTP access to the directory that you have setup on the server as the installation directory. This can be either anonymous FTP access or access through a named account with a password. Anonymous access is probably best unless you have a reason to protect your install server via a password.

If you want anonymous FTP to point to a different directory then you can use sym links to point to the directory that you have set up as the install directory on the server. This will allow FTP into a chrooted environment but still give you access to the install images in a different location.

HTTP

If you have a web server running and want to enable HTTP access to your install server then add sym links from your document root to the install server directory and this will grant access. If you are not familiar with web servers or are not comfortable with this approach then leave out HTTP access from your install server as it provides no benefits over NFS or FTP installs which may be simpler to set up.

If you do choose to use HTTP then basically all you have to do is make the install directory visible to your web server by making it appear under the document root by some means. If you are using the Apache webserver then Debian recommend adding the following to your http.conf file

<directory /org/ftp.debian.org/ftp>
   IndexOptions NameWidth=* +SuppressDescription
   DirectoryIndex .
</directory>

You have now completed the basic setup of your install server.


Next Previous Contents