Next Previous Contents

5. Setting up an FTP server for yum.

Setting up an FTP server is very simple. The steps are as follows:

5.1 Download the RPM

There are many ftp servers available for Linux. Most ftp servers do the same thing so the choice is really up to you. The ftp server that I like to use is vsftpd. The rpm is usually available from the installation discs or can be downloaded from rpmfind or just use google. vsftpd is used by many large companies as the ftp server of choice and is very secure (it's part of the name so it must be true, right?).

5.2 Install the ftp server.

First check to see if VSFTPD is already installed on your machine, this is easily done by using:

root@cartman> rpm -q vsftpd
The system will tell you if the server is installed or not. If you get this message 'package vsftpd is not installed' then you will need to install the ftp server.

First download the latest version of VSFTPD from your preferred mirror and save it to e.g. /tmp on the server. The ftp directory structure required for your repository is unlikely to exist yet so you will need to create the repository directories that you planned out above, for example:

root@cartman> mkdir -p /var/ftp/pub/9/updates/ 
(the -p flag tells mkdir to create the whole tree of directories as required).

To install/upgrade the ftp server run the following as root:

root@cartman>rpm -Uvh /tmp/vsftpd-1.1.3-8.i386.rpm
Note that one will want this rpm to be in a repository the server itself uses to yum update from in the long run. It is very likely to be in a primary distribution repository you mirror, but you may have to put it in a local/update repository you maintain yourself from some other source.

(You can of course use rpm -ivh vsftpd-1.1.3-8.i386.rpm to install the package if the package is not already installed. The flag -U is for upgrade and -i is for install. No big deal, they will both work if the package does not exist on your system, IMHO -U is just better practise. It is not a good idea to use rpm -i if a previous version of the package already exists on your system.)

5.3 Edit the vsftpd.conf file

After the ftp package has been installed you will need to edit the vsftp.conf file. This is usually found at /etc/vsftpd/vsftpd.conf. If it is not here then just run:

jdip@cartman>rpm -ql vsftpd
and look in the list where the .conf file is. To edit the .conf file you can use kate, gedit, vi or any other text editor. This is the configuration file for the ftp server. You will need to be root to change the file:
root@cartman>vi /etc/vftp/vsftp.conf

If your network is secure and behind a firewall then you can leave the following option in the .conf file. This option allows for anonymous ftp access to your server:

# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
You can also change the welcome message of the ftp server.
# You may fully customise the login banner string:
ftpd_banner=Welcome to yum FTP service.

If you want increased security for your ftp server then set the flag anonymous_enable=NO. This will force the user to log into the ftp server to get access to the packages. If you want to use this option then you will need to create a yum user on the server that can be used by the yum client to access the server. It is prudent to make users log into the ftp server, but if this is your private server then it may not be necessary.

Save the .conf file.

You will need to (re)start the service to activate the changes to the ftp server (see next section).

5.4 Start the server

If you installed VSFTPD from the rpm then VSFTPD can be started as a service:

root@cartman>service vsftpd restart
You should get this message:
Shutting down vsftpd:                               [  OK  ] or [ FAILED ]
Starting vsftpd for vsftpd:                         [  OK  ]

You will want your ftp server to start every time you start Linux so it is also prudent to run:

root@cartman>chkconfig vsftpd on
root@cartman>chkconfig --list vsftpd
You should get a message that looks like this:
vsftpd          0:off   1:off   2:on    3:on    4:on    5:on    6:off
Your ftp server will now start every time you start Linux on this machine. The ftp server is up and waiting for connections.

5.5 Testing the FTP server

It is a good idea to test that the ftp server is working correctly. This is easily done by logging onto the ftp server:

Connected to (
220 Welcome to yum FTP service.
Name ( anonymous
331 Please specify the password.
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
If you type ls at the prompt you will see that you are in the 'pub' directory. This is /var/ftp/pub. This path (and the full path of the repository you're setting up) are important to remember for when you use rsync to build the mirrors, for when you use yum-arch to "yummify" the repository (see below), and for setting up a local yum.conf for your local clients so that they can update from this ftp-based repository.

That is it. The ftp server is running and waiting for connections. Skip ahead to where it describes how to get and install yum and yummify the repository.

Next Previous Contents