How to create a yum repository
Wondering how to create our own CentOS 5 based yum repository? Basically, we want to make rpm packages and then be able to do things like:
yum install our-custom-package
yum remove our-custom-package
yum update our-custom-package
Thanks.
Solution 1:
On the server, place your .rpm files into /some/directory
, then:
yum install createrepo
cd /some/directory
createrepo .
On this server, configure Apache (or other web server) to allow GET access to /some/directory
, and all its contents, using a URI such as http://server.example.com/myrepository
.
You may wish to verify that this works from another machine. Both of these commands should work:
curl http://server.example.com/myrepository/our-custom-package.rpm
curl http://server.example.com/myrepository/repodata/repomd.xml
On each client, as root, create a file:
vi /etc/yum.repos.d/myveryown.repo
This file should contain the following text:
[My Very Own Repository]
baseurl=http://server.example.com/myrepository
enabled=1
gpgcheck=0
Note that you can scp
the file to all the clients, make it available for web download, or even (as some do) make a separate RPM that installs this file into the correct location on the client.
Finally, on the client:
yum clean all
yum search our-custom-package
yum install our-custom-package
yum remove our-custom-package
yum update our-custom-package
That should get you up and running. There are, of course, a lot of options and a lot of things to consider (like GPG security) at each step.
I also learned a bit from http://www.cyberciti.biz/tips/redhat-centos-fedora-linux-setup-repo.html