The EPIKH Project (Exchange Programme to advance e-Infrastructure Know-How) 马兰馨 IHEP, CAS Setting Up a Repository
Why? –gLite includes a large number of tools and software to download –Download from remote servers can require too much time When – Many server to install Large server farms Training events – Slow connection How? – gLite repository are managed by mrepo tool 2 A repository
The mrepo service retrieves rpms from mirror sites and creates a repository with APT-YUM meta-data Manages the local APT and YUM repository for OS and middleware Requires the configuration of both: mrepo and httpd service Supports for ftp, http, sftp, rsync, rhn and other protocals 3 MREPO
Prepare a Scientific Linux 5.x machine Retrieve the mrepo package and install it –Package from(Use the el5 version of the package): wget 1.el5.rf.noarch.rpm –Install with: rpm -Uvh –Ensure that createrepo and httpd rpms are installed on your system wget 1.el5.rf.noarch.rpmhttp://linuxsoft.cern.ch/dag/redhat/el5/en/x86_64/dag/RPMS/createrepo el5.rf.noarch.rpm 4 Repository Installation
Modify the mrepo script, since the path to the comps.xml file is not composed properly *** /usr/bin/mrepo :57: mrepo.modified :58: *************** *** 845,851 **** repoopts = repoopts + ' --cachedir "%s"' % cachedir if os.path.isdir(os.path.join(self.wwwdir, '.olddata')): remove(os.path.join(self.wwwdir, '.olddata')) ! groupfile = os.path.join(cf.srcdir, self.dist.nick, self.name + '-comps.xml') if os.path.isfile(groupfile): symlink(groupfile, os.path.join(self.wwwdir, 'comps.xml')) repoopts = repoopts + ' --groupfile "%s"' % groupfilename , repoopts = repoopts + ' --cachedir "%s"' % cachedir if os.path.isdir(os.path.join(self.wwwdir, '.olddata')): remove(os.path.join(self.wwwdir, '.olddata')) ! # groupfile = os.path.join(cf.srcdir, self.dist.nick, self.name + '-comps.xml') ! groupfile = os.path.join(cf.srcdir, self.dist.nick, self.name + '/comps.xml') ! info(2, 'Groupfile: %s' % (groupfile)) if os.path.isfile(groupfile): symlink(groupfile, os.path.join(self.wwwdir, 'comps.xml')) repoopts = repoopts + ' --groupfile "%s"' % groupfilename 5 mrepo Script
/etc/mrepo.conf ### 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 wwwdir = /var/www/mrepo confdir = /etc/mrepo.conf.d arch = i386 x86_64 metadata=yum repomd lftp-mirror-options = -c -X "*/Fermi/*" -X "*/example/*" #lftp-mirror-options = -c -P=10 -X "*/Fermi/*" -X "*/example/*" createrepo-options = -d –p #(If you mirrot from infngrid, add it) mailto = smtp-server = localhost #rhnlogin = username:password 6 General Settings
/etc/mrepo.conf ### 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 wwwdir = /var/www/mrepo confdir = /etc/mrepo.conf.d arch = i386 x86_64 metadata=yum repomd lftp-mirror-options = -c -X "*/Fermi/*" -X "*/example/*" #lftp-mirror-options = -c -P=10 -X "*/Fermi/*" -X "*/example/*" createrepo-options = -d –p (if you mirror the InfnGrid repositories, add this line) mailto = smtp-server = localhost #rhnlogin = username:password 7 General Settings
/etc/mrepo.conf.d/ca.conf ### CA repository [ca] name = lcg-ca arch = noarch production = Mrepo will create: /mrepo/ca-noarch 8 Specific configuration
/etc/mrepo.conf.d/glite32.gridit.conf ### ### gLite Middleware 3.2 ### [glite_ig_sl5] name = gLite Middleware (R3.2 - x86_64) release = R3.2 arch = x86_64 ### Official repositories ( # Generic Repositories generic-externals = generic-release = generic-updates = Mrepo will create: /mrepo/glite_sl5-x86_64/RPMS.generic-externals /mrepo/glite_sl5-x86_64/RPMS. release /mrepo/glite_sl5-x86_64/RPMS.generic-updates 9 Specific configuration
mrepo command options -c, –config=file specify alternative configfile -g, –generate generate mrepo repositories -q, –quiet minimal output -r, –repo=repo1,repo2 restrict action to specific repositories -u, –update fetch updates -v, –verbose increase verbosity (only mrepo info) -vv, -vvv increase verbosity more Example mrepo –guvv mrepo -gvv mrepo –uvv mrepo -guvv gilda sl4 mrepo -guvv -r app 10 MREPO Usage
mrepo command options -c, –config=file specify alternative configfile -g, –generate generate mrepo repositories -q, –quiet minimal output -r, –repo=repo1,repo2 restrict action to specific repositories -u, –update fetch updates -v, –verbose increase verbosity (only mrepo info) -vv, -vvv increase verbosity more Example mrepo –guvv mrepo -gvv mrepo –uvv mrepo -guvv gilda sl4 mrepo -guvv -r app 11 MREPO Usage
MREPO support the creation of several set of metadata for the clients – apt, yum and repomd supported Tools creating the additional metadata should be installed in the system – apt requires genbasedir binary from apt package – yum < 2.4 requires yum-arch binary from yum package – repomd for apt>=0.5.15lorg and yum>=2.4 requires createrepo binary from createrepo package 12 MREPO Metadata
Example repodata]# ls /var/www/mrepo/ca-current/RPMS.production/repodata filelists.sqlite.bz2 filelists.xml.gz other.sqlite.bz2 other.xml.gz primary.sqlite.bz2 primary.xml.gz repomd.xml 13 MREPO Metadata
Example –Apache web server manages the web interface –Mrepo package installs a own configuration file for http in order to define its urls: /etc/httpd/conf.d/mrepo.conf –The default repository web directory is /var/www/mrepo – Add it to the automatic boot and start the service In SL5 you can use the following commands: /sbin/chkconfig httpd on /sbin/service httpd start 14 WEB server configuration
Verify that mrepo installation created a crontab under /etc/cron.d like this one: ### Enable this if you want mrepo to daily synchronize ### your distributions and repositories at 2:30am * * * root echo "### Mrepo running on: "`date` >> /var/log/mrepo.log 2>&1 ; /usr/bin/mrepo -ugfv >> /var/log/mrepo.log 2>&1 15 Update repo
The machine has to be configure with your repository – E.g. using yum you need to create a repo file in /etc/yum.repos.d/.repo Repo file example –more /etc/yum.repos.d/lcg-ca.repo # # CA repository # [CAs] name = CAs baseurl = enabled = 1 protect = 0 –yum install lcg-CA 16 Using your repo
Official MREPO web page 17 Reference
Official MREPO web page 18
19