If the bandwidth, that is the rate of data transfer for your internet plan is limited or worse still your internet connection is problematic, having a local repository is a good option when updating packages on other computers where Fedora is installed.
Originally I posted this how to on FedoraForum but I have now updated it here.
If you intend to update a clean or fresh installation at a later date then you should start with a clean installation. That way all updates will be captured up until to that point. This is an important step if you don’t have internet access during a fresh Fedora installation as you will probably end up with missing packages that are needed.
Here we go:
1. The first step is open a terminal and type the following:
su gedit /etc/yum.conf
This way all yum (Yellowdog Updater, Modified) downloads with will not be deleted as would normally occur by default.
2. The second step is to create a local directory or folder for your local repository.
3. Next, copy the packages taken from the Fedora repositories to the local repository:
cp -v /var/cache/yum/x86_64/14/fedora/packages/* ~/myrepo cp -v /var/cache/yum/x86_64/14/updates/packages/* ~/myrepo cp -v /var/cache/yum/x86_64/14/updates/deltas/* ~/myrepo
If you have the rpmfusion repositories installed:
cp -v /var/cache/yum/x86_64/14/rpmfusion-free/packages/* ~/myrepo cp -v /var/cache/yum/x86_64/14/rpmfusion-free-updates/* ~/myrepo cp -v /var/cache/yum/x86_64/14/rpmfusion-nonfree/packages/* ~/myrepo cp -v /var/cache/yum/x86_64/14/rpmfusion-nonfree-updates/packages/* ~/myrepo
cp -v /var/cache/yum/x86_64/14/google-chrome/packages/* ~/myrepo
Flash Repository by lee123linux at FedoraForum:
cp -v /var/cache/yum/x86_64/14/flash/packages/* ~/myrepo
cp -v /var/cache/yum/x86_64/14/virtualbox/packages/* ~/myrepo
The syntax /* will copy the contents of the directory or folder rather than the directory itself.
The cp (copy) command is the preferred option rather than moving a file with say mv (move) for example because SELinux by default creates the correct SELinux context when a new file is created. From this point of view, the mv command would be depreciated. When a file is copied, the correct file permissions for both user based file permissions (Discretionary Access Control [DAC]) and SELinux contexts (Mandatory Access Control [MAC]) are created accordingly.
After you have copied the packages from the rpm cache to your new repository you may want to clear the cache:
To do this type at the prompt:
su -c "yum clean all"
Another way to remove files from a directory for the sake of interest:
su rm -vrf /var/cache/yum/x86_64/14/updates/packages/*
v=verbose (to see what’s happening)
r or R =recursively (remove directories and their contents recursively)
f=force (force and never prompt)
4. The next step is to finish creating the local repository:
su gedit /etc/yum.repos.d/local.repo
then add the following (you must replace username with your own username):
[local] name=Fedora Core $releasever - $basearch baseurl=file:///home/username/myrepo enabled=1 gpgcheck=0
and save and exit.
The name of my repository is actually ‘local’ instead ‘myrepo’ as seen below.
You can see below that the repository is enabled:
5. The next step is to create repodata for the local repository. To do this type at the prompt:
su -c "yum install createrepo"
su -c "createrepo /home/username/myrepo"
6. To update Fedora from the local repository you can disable the Fedora and RPMFusion repositories so that only the local repository is used for the update:
First thing to do is to check your repository list:
Then for example to update with the RpmFusion and Fedora repositories disabled we use the –disablerepo=repo-name flag:
su -c "yum --disablerepo=updates --disablerepo=fedora --disablerepo=rpmfusion-free --disablerepo=rpmfusion-free-updates --disablerepo=rpmfusion-nonfree --disablerepo=rpmfusion-nonfree-updates --skip-broken update"
That’s it. Hope you enjoyed my guide.
By the way these tutorials take me a lot of time to write so a comment is well appreciated thanks…)