Difference between revisions of "Mrepo centos7"
(Created page with "Category:RPM [https://github.com/dagwieers/mrepo mrepo] is a rpm repository management tool. I know that today lots of folks are using pulp or cobbler or something else,...") |
m |
||
Line 12: | Line 12: | ||
/etc/mrepo.conf, modify the srcdir directive to point to our nfs volume (no root_squashing): | /etc/mrepo.conf, modify the srcdir directive to point to our nfs volume (no root_squashing): | ||
− | + | <pre> | |
### Configuration file for mrepo | ### Configuration file for mrepo | ||
Line 49: | Line 49: | ||
iso = CentOS-7-$arch-Everything-????.iso | iso = CentOS-7-$arch-Everything-????.iso | ||
updates = updates = http://mirror.centos.org/centos/7.1.1503/updates/$arch/Packages/ | updates = updates = http://mirror.centos.org/centos/7.1.1503/updates/$arch/Packages/ | ||
− | </pre | + | </pre> |
Download the Everything.iso from the centos mirrors and save it in in the nfs share in a new folder called 'iso'. | Download the Everything.iso from the centos mirrors and save it in in the nfs share in a new folder called 'iso'. | ||
Line 55: | Line 55: | ||
Create the target file for mrepo: | Create the target file for mrepo: | ||
− | + | <pre> | |
# cat /usr/lib/systemd/system/mrepo.service | # cat /usr/lib/systemd/system/mrepo.service | ||
[Unit] | [Unit] | ||
Line 70: | Line 70: | ||
[Install] | [Install] | ||
WantedBy=multi-user.target | WantedBy=multi-user.target | ||
− | </pre | + | </pre> |
and enable the new service: | and enable the new service: | ||
− | + | <pre> | |
systemctl enable mrepo.service | systemctl enable mrepo.service | ||
systemctl start mrepo.service | systemctl start mrepo.service | ||
− | </pre | + | </pre> |
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. | 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. | ||
− | + | <pre> | |
/usr/bin/mrepo -ugvv | /usr/bin/mrepo -ugvv | ||
− | </pre | + | </pre> |
The repos will be created in /net/nfsserver/vol/mrepo/centos7_1-x86_64, and this structure will be automatically created: | The repos will be created in /net/nfsserver/vol/mrepo/centos7_1-x86_64, and this structure will be automatically created: | ||
− | + | <pre> | |
# ls -l centos7_1-x86_64/ | # ls -l centos7_1-x86_64/ | ||
total 117 | total 117 | ||
drwxr-xr-x. 2 nobody nobody 302 Apr 1 18:36 updates | drwxr-xr-x. 2 nobody nobody 302 Apr 1 18:36 updates | ||
− | </pre | + | </pre> |
Where as in /var/www/mrepo we see this | Where as in /var/www/mrepo we see this | ||
− | + | <pre> | |
# ls -l /var/www/mrepo/centos7_1-x86_64/ | # ls -l /var/www/mrepo/centos7_1-x86_64/ | ||
total 618 | total 618 | ||
Line 103: | Line 103: | ||
drwxr-xr-x. 3 root root 462848 Mar 31 21:53 RPMS.os | 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 | drwxr-xr-x. 3 root root 20480 Apr 1 18:40 RPMS.updates | ||
− | </pre | + | </pre> |
And if we look inside the iso dir we see it's a symlink to the iso in the nfs volume: | And if we look inside the iso dir we see it's a symlink to the iso in the nfs volume: | ||
− | + | <pre> | |
# ls -l /var/www/mrepo/centos7_1-x86_64/iso/CentOS-7-x86_64-Everything-1503.iso | # ls -l /var/www/mrepo/centos7_1-x86_64/iso/CentOS-7-x86_64-Everything-1503.iso | ||
− | </pre | + | </pre> |
The rest of the dirs have also symlinks in there, so we | The rest of the dirs have also symlinks in there, so we | ||
Line 118: | Line 118: | ||
And finally, allow httpd to use an nfs mount in selinux: | And finally, allow httpd to use an nfs mount in selinux: | ||
− | + | <pre> | |
setsebool -P httpd_use_nfs on | setsebool -P httpd_use_nfs on | ||
− | </pre | + | </pre> |
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. | 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. |
Latest revision as of 22:10, 28 August 2015
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.
/usr/bin/mrepo -ugvv
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.