mrepo is a rpm repository management tool. I know that today lots of folks are using pulp or cobbler or something else, but mrepo has worked great for us and it keeps working nicely.
Download the tar.bz file from http://dag.wiee.rs/home-made/mrepo/ and unpack it somewhere. Go the the folder where you unpacked it and run 'make' (install make if necessary).
That's it, mrepo it's installed :-)
Well, not quite; mrepo was written in the pre-centos 7 time, before systemctl. And provided I prefer to configure the mrepo data repositories in nfs exports so I do not run out of local disk space (just expand the nfs volume/dataset and done) and those exports are mounted using autofs, and autofs is started from systemd and not from chkconfig as the mrepo init script, stuff was not started properly.
So after making mrepo, we have a config file /etc/mrepo.conf and a dir /etc/mrepo.conf.d/ where we can drop our .conf files.
/etc/mrepo.conf, modify the srcdir directive to point to our nfs volume (no root_squashing):
### Configuration file for mrepo ### The [main] section allows to override mrepo's default settings ### The mrepo-example.conf gives an overview of all the possible settings [main] #srcdir = /var/mrepo srcdir = /net/nfsserver/vol/mrepo wwwdir = /var/www/mrepo confdir = /etc/mrepo.conf.d arch = i386 shareiso = yes hardlink = no lftpcmd = /usr/bin/lftp lftp-exclude-debug = yes lftp-exclude-srpm = yes ## Add extra options to lftp mirror command lftp-mirror-options = -c mailto = root@localhost smtp-server = localhost #rhnlogin = username:password ### Any other section is considered a definition for a distribution ### You can put distribution sections in /etc/mrepo.conf.d ### Examples can be found in the documentation. # cat /etc/mrepo.conf.d/centos7.conf [centos7_1] name = CentOS $release ($arch) release = 7.1 arch = x86_64 metadata = yum repomd iso = CentOS-7-$arch-Everything-????.iso updates = updates = http://mirror.centos.org/centos/7.1.1503/updates/$arch/Packages/
Download the Everything.iso from the centos mirrors and save it in in the nfs share in a new folder called 'iso'.
Create the target file for mrepo:
# cat /usr/lib/systemd/system/mrepo.service [Unit] Description=mrepo distribution server Requires=autofs.service After=autofs.service [Service] Type=simple User=root Group=root ExecStart=/usr/bin/mrepo -q -c /etc/mrepo.conf [Install] WantedBy=multi-user.target
and enable the new service:
systemctl enable mrepo.service systemctl start mrepo.service
After that you should see that the everything.iso is mounted from the nfs export in /var/www/mrepo/centos_version/disc1 and the srcdir volume in /net/nfsserver/vol/mrepo. Now you can start downloading the updates repo and generating the local repos. You probably need to install the createrepo package for this.
The repos will be created in /net/nfsserver/vol/mrepo/centos7_1-x86_64, and this structure will be automatically created:
# ls -l centos7_1-x86_64/ total 117 drwxr-xr-x. 2 nobody nobody 302 Apr 1 18:36 updates
Where as in /var/www/mrepo we see this
# ls -l /var/www/mrepo/centos7_1-x86_64/ total 618 drwxr-xr-x. 8 root root 2048 Mar 27 23:36 disc1 lrwxrwxrwx. 1 root root 50 Mar 31 21:34 HEADER.shtml -> ../../../../usr/share/mrepo/html/HEADER.repo.shtml drwxr-xr-x. 2 root root 48 Mar 31 21:36 iso lrwxrwxrwx. 1 root root 50 Mar 31 21:34 README.shtml -> ../../../../usr/share/mrepo/html/README.repo.shtml drwxr-xr-x. 2 root root 20480 Apr 1 18:40 RPMS.all drwxr-xr-x. 3 root root 462848 Mar 31 21:53 RPMS.os drwxr-xr-x. 3 root root 20480 Apr 1 18:40 RPMS.updates
And if we look inside the iso dir we see it's a symlink to the iso in the nfs volume:
# ls -l /var/www/mrepo/centos7_1-x86_64/iso/CentOS-7-x86_64-Everything-1503.iso
The rest of the dirs have also symlinks in there, so we
This can take a while, I usually run it from a screen session and go do something else.
We need to configure apache as well. The make command has been helpful and left a mrepo.conf file in /etc/httpd/conf.d. Review it. I needed to allow symlinks explicitly in it.
And finally, allow httpd to use an nfs mount in selinux:
setsebool -P httpd_use_nfs on
After that you should be able to go to http://your.ip/mrepo and see your centos7 repo. Now you can use that for your kickstart intallations.