Saturday, 31 October, 2009 I set up an offline Fedora 11 mirror in BCREC. I used the fedx makefile for the purpose of syncing the repository from my pocket HDD to the mirror PC ( an HP dual core system with Fedora 10 installed in it). I then setup a dhcpd server in the machine with the help of gdhcpd. I wrote a how to use the service and put it on the Desktop. I also wrote a fedora-local.repo which could be used by the clients to configure their machines to use the service. This should enable newbies without internet connection to get packages and softwares of Fedora 11.
We were facing a lot of difficulties in setting up Fedora after the installation. Reason? Poor internet connection in the locality. It was a great dissatisfaction for me and Kishan (my friend) and also for the newbies. To resolve this, Arindam Ghosh gave me a copy of “Fedora-mirror” and taught me the How-Tos to setup an offline Fedora-mirror and do the requisite installations. It was really a needed gift for us. We set-up many a system successsfully with its help.
Then I thought of trying to automate this process. So, I started writing shell scripts. My idea was simple. Take a backup of the contents of yum.repos.d and place the local repository files in yum.repos.d. Start the ftp server (vsftpd), and use the loopback (lo) interface which generally has the proxy 127.0.0.1. Then provide the user with a terminal to do the requisite installations. Then exiting that terminal, turning off the ftp server and replacing the original contents of yum.repos.d. I transferred the entire Fedora-mirror to my Maxtor-Portable hard drive.
I created 3 shell scripts – 1)mirror-setup.sh, 2)mirror-start.sh and 3)mirror-stop.sh.
The user jsut needs to invoke the mirror-setup.sh as root and he gets the terminal for doing installations. To exit the terminal, he just needs to type ‘exit’ and press <enter>. The scripts mirror-start.sh is for starting the ftp mirror and the mirro-stop.sh is for stopping the mirror. These two scripts are being called by the mirror-setup.sh. Below are the details of the scripts….
cd /media/My\ storage/fedora-mirror/
echo You are now ready to install packages offline…To quit…enter ‘exit’
sh /media/My\ storage/fedora-mirror/mirror-stop.sh
echo Local Fedora-mirror stopped…
mv /etc/yum.repos.d/* /tmp/yum.repos.bak/
mount –bind /media/My\ storage/fedora-mirror/ /var/ftp/pub/
wget -ivh ftp://127.0.0.1/pub/yum/*
mv /tmp/yum.repos.bak/* /etc/yum.repos.d/
rm -r /tmp/yum.repos.bak
Any suggestions or comments on the topic are welcome.