Google Site SearchFN Site Search FN Blog Login FN Blog Login
Site Navigation:
 
 

Creating a local yum repository

by Alexandre de Abreu

Configuring the Script

With the FTP server ready, yum clients will be able to connect using FTP access method. First we need to stay synchronized with some package mirror on Internet. To do this, you must edit the MIRROR variables inside the yum_repository.sh script choosing where to download the files:

# Fedora Updates Mirror
MIRROR_URL[0]="http://distro.ibiblio.org/pub/linux/distributions/fedora/linux/core/updates/1/"
MIRROR_DIR[0]="/var/ftp/pub/linux/fedora/1/updates/" 
                                                   
# Red Hat Updates Mirror
MIRROR_URL[1]="http://distro.ibiblio.org/pub/linux/distributions/redhat/updates/9/en/os/"
MIRROR_DIR[1]="/var/ftp/pub/linux/redhat/9/updates/"

As you can see above, the default script setup includes two entries, one for Fedora updates mirror and other to Red Hat 9 updates mirror. Note that these mirrors are Apache servers with the "Indexes" option enabled on the httpd.conf file so that when accessing the URL below we can see a list of files on the directory:

http://distro.ibiblio.org/pub/linux/distributions/fedora/linux/core/updates/1/

The MIRROR_URL and MIRROR_DIR are arrays, they make easy to add more entries and mirrors. The array MIRROR_URL points to the download URL, where packages will be downloaded. MIRROR_DIR points to where the packages will reside on the local disk as they're downloaded.

Creating local directories

Now, you have to create the mirror directories following the MIRROR_DIR arrays values:

# mkdir -p /var/ftp/pub/linux/fedora/1/updates
# mkdir -p /var/ftp/pub/linux/redhat/9/updates

The directory /var/ftp will be the root of the FTP server, if we were using a Web server, this would usually be /var/www/html directory or the DocumentRoot option in httpd.conf file.

And then set the right permissions, since user "alex" must be able to write on these directories:

# chmod -R 755 /var/ftp/pub/linux
# chown -R alex /var/ftp/pub/linux

On next page you'll see how to test the script. Click on the blue arrow to continue.