This guide has now been updated on my own website. Thanks
http://poppleit.com/how-to-create-a-...ra-09-05-2011/
A simple guide to create your own local repository for later re-installation or backup
I created my own local repository so i could do a complete offline installation on other computers. If you want to get all your fedora extras and 3rd party repositories and their dependencies in your repository you will need to start with a clean installation.
1. The first step is open a terminal and type the following:
.
Code:
gedit /etc/yum.conf
change:
to This way my downloads with will not be deleted as would normally occur. The other option to this is to use 'yum-downloadonly' as described later. Yum-downloadonly is for downloading only and is useful if i wanted to obtain rpms and their dependencies without installing them. It is also necessary for the --downloaddir option which is needed for choosing my local repository directory.
2. The second step is to create a local folder to store all my rpms. I started off like this:
Code:
mkdir /home/jonathon/jonrepo
I like my repository folder in my home directory for easy access.
3. Next i installed the following programs:
Code:
su
yum -y install yum-downloadonly
Code:
yum -y install createrepo --downloaddir /home/jonathon/jonrepo
yum -y install yum-utils --downloaddir /home/jonathon/jonrepo
Yum-downloadonly will give the '--downloaddir' option. Now i can download the next two programs into my repository. If I want to add yum-downloadonly to my repository I can move the rpm from /var/cache/yum/updates/packages to my repository. To do this i use the move command:
Code:
mv /var/cache/yum/updates/packages/* /home/jonathon/jonrepo
NOTE the syntax /packages/* will move all the contents of my /var/cache/yum/updates/packages folder to my repository folder (thanks Leigh123 for helping me with this
). If i want to delete the contents of the folder but not the folder itself i use the remove command:
Code:
rm -rf /var/cache/yum/updates/packages/*
Also if i want to include the rpm packages from the fedora installation disc in my local repository i simply copy the rpm packages to my local repository.
4. The next step is to finish creating my local repository:
Code:
gedit /etc/yum.repos.d/jonrepo.repo
Code:
[jonathon]
name=Fedora Core $releasever - $basearch
baseurl=file:///home/jonathon/jonrepo
enabled=0
gpgcheck=0
The name of my repository is actually 'jonathon' not 'jonrepo' as far as yum is concerned. If i want the title of my local repository to be 'jonrepo' i use the following layout:
instead of As you will have noticed my repository is not yet enabled.
I prefer to enable my repository later once i have created my repository 'repodata' to avoid any update problems.
5. The next step is to download a program into my repository as i did earlier on. I do this with the following command:
Code:
su
yum -y install kshutdown --downloaddir /home/jonathon/jonrepo
The command will download the rpm to my repository and install it in one hit. So easy!
If i want to enable a 3rd party repository such as 'freshrpms' i would use the following command:
Code:
yum -y --enablerepo freshrpms install mplayer mplayer-skins mplayer-fonts mplayer-docs mplayerplug-in --downloaddir /home/jonathon/jonrepo
As you can see this command will download and install mplayer along with all of the needed dependencies to my local repository.
If I want to use yum-downloadonly i would use the following layout:
Code:
yum -y --downloadonly --enablerepo freshrpms install mplayer mplayer-skins mplayer-fonts mplayer-docs mplayerplug-in --downloaddir /home/jonathon/jonrepo
6. The next step is to create my 'repodata' so that yum can read my local repository:
[jonathon@localhost ~]$ Password:
[root@localhost jonathon]#
Code:
createrepo /home/jonathon/jonrepo
1/1 - kshutdown-1.0-3.fc7.i386.rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata
7. The next step is to enable my repository.
Code:
gedit /etc/yum.repos.d/jonrepo.repo
set
save and close
8. Now i need to disable the fedora repositories as my local repository is unlikely to work properly even with internet access. For offline installation I need to disable other repositories that are configured for automatic updates.
Code:
gedit /etc/yum.repos.d/fedora.repo
set:
save and exit
Do the same for fedora-updates:
Code:
gedit /etc/yum.repos.d/fedora-updates.repo
Other repositories that you may have enabled for automatic updates will have to be disabled as well:
Code:
gedit /etc/yum.repos.d/adobe-linux-i386.repo
gedit /etc/yum.repos.d/dries.repo
gedit /etc/yum.repos.d/livna.repo
gedit /etc/yum.repos.d/freshrpms.repo
NOTE Strangely enough i need to reboot my computer each time i update my repository 'repodata'.
Reboot and test your repository. Open a terminal and type at the prompt:
[jonathon@localhost ~]$ Password:
[root@localhost jonathon]#
Code:
yum install kshutdown
Loading "installonlyn" plugin
Loading "downloadonly" plugin
Setting up Install Process
Parsing package install arguments
jonathon 100% |=========================| 951 B 00:00
primary.xml.gz 100% |=========================| 1.0 kB 00:00
jonathon : ################################################## 1/1
Resolving Dependencies
--> Running transaction check
---> Package kshutdown.i386 0:1.0-3.fc7 set to be updated
Dependencies Resolved
================================================== ===========================
Package Arch Version Repository Size
================================================== ===========================
Installing:
kshutdown i386 1.0-3.fc7 jonathon 291 k
Transaction Summary
================================================== ===========================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 291 k
Is this ok [y/N]: y
Downloading Packages:
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: kshutdown ######################### [1/1]
Installed: kshutdown.i386 0:1.0-3.fc7
Complete!
[root@localhost jonathon]#
I could also leave my local repository disabled and enable it with the following command:
Code:
su
yum --enablerepo jonathon install kshutdown
As you can see my repository works fine.
If you decided to install 1.5 GIG of programs i would suggest doing a bit a time especially if you use 'yumex' which is really slow. For yum the command line is the fastest option but not that fast. It took 5 hours to install everything since i did one gigantic installation.
To update my repository 'repodata' after fresh updates i open a terminal and type at the prompt:
NOTE the location of the repodata in your local repository
Code:
su
rm -rf /home/jonathon/jonrepo/repodata
createrepo /home/jonathon/jonrepo
Beware rm -rf ! I accidentally deleted my home directory one night. Use this command with caution otherwise it can cost you dearly as it did me. I lost all of my newly updated installation notes. Luckily i had everything else backed up.
Other useful command line updates that work:
Code:
yum -y groupupdate "Administration Tools" --downloaddir /home/jonathon/jonrepo
yum -y groupupdate "System Tools" --downloaddir /home/jonathon/jonrepo
yum -y groupupdate "Hardware Support" --downloaddir /home/jonathon/jonrepo
yum -y groupupdate "Graphics" --downloaddir /home/jonathon/jonrepo
yum -y groupupdate "gnome-desktop" --downloaddir /home/jonathon/jonrepo
johnny