Monthly Archives: April 2008

Howto setup mrepo in SME 7.3

0
Filed under SME Server

I often need to test different Linux distributions, or the distributions on different machine types / architectures. And quite often, I need to either update the installed software, or install extra software, which needs to be downloaded from the Internet. SO, I need a way to preserve / save my bandwidth for all those duplicate downloads. One way, is to download what I need to an FTP server on the LAN, and then install it via rpm from the FTP server. This is a lot of work, and when done repeatedly become tedious.

So, instead I’m going to install mrepo, which replicates repos from upstream providers. This will also setup your FTP / HTTP / NFS server with all the repo files to act as a repo on the local LAN. The upside to this?

  • Your Internet bandwidth consumption will be less
  • You’ll have the full repository of any Linux that you install on your local LAN
  • It’s easy to point any PC / server to this repository for updates

<-- more -->

So, let’s get started. First, we need to enable the Dag Wiers repository, as follows:

[php]wget http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt

rpm –import RPM-GPG-KEY.dag.txt /sbin/e-smith/db yum_repositories set dag repository \
Name ‘Dag – EL4′ \
BaseURL ‘http://apt.sw.be/redhat/el4/en/$basearch/dag’ \
EnableGroups no \
GPGCheck yes \
GPGKey http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt \
Visible no \
Exclude freetype,htop,iptraf,rsync,syslinux \
status disabled

expand-template /etc/yum.conf[/php]

I’m not going to go into too much detail on the commands above, but it basically imports the RPM-GPG-KEY from the Dag Wiers website, adds the repository to your list of installable repositories, and then expands / rebuild the yum.conf file to make it active, without having to reboot.

Next we need to configure mrepo for SME purposes to make it easy to use. The config file is in /etc/mrepo.conf

[php]
### 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]
# This is where the repositories will be stored
srcdir = /home/e-smith/files/ibays/linux/files/repo
# This is where the http repository links will be created
wwwdir = /home/e-smith/files/ibays/linux/html/repo
# Add the config dir to the iBays, which makes it easier to add new distro’s from Windows
confdir = /etc/mrepo.conf.d
# We can want setup a repo for the standard i386 as well as x64 PC’s
arch = x86_64 i386

mailto = root@localhost
smtp-server = localhost

### 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 at:
### /usr/share/doc/mrepo-0.8.4/dists/.
[/php]

The full list of options can be found here: http://svn.rpmforge.net/svn/trunk/tools/mrepo/config/mrepo-example.conf

Lastly, we add the Linux distro’s that we want to put in our local repository.
Create a file, /home/e-smith/files/ibays/linux/files/mrepo.conf.d/centos5.conf, which contains the following:

[php]
### Name: The Community Enterprise Operating System v5
### URL: http://www.centos.org/

[centos5]
name = CentOS $release ($arch)
release = 5
#arch = i386 x86_64 ia64 ppc s390 s390x alpha
arch = x86_64 i386
metadata = repomd repoview

### ISO images
iso = http://mirror.centos.org/pub/centos/$release/isos/$arch/CentOS-$release-$arch-bin?of4.iso
#os = http://mirror.centos.org/centos/$release/os/$arch/CentOS/RPMS/

### Additional repositories
updates = http://mirror.centos.org/centos/$release/updates/$arch/RPMS/
fasttrack = http://mirror.centos.org/centos/$release/fasttrack/$arch/RPMS/
centosplus = http://mirror.centos.org/centos/$release/centosplus/$arch/RPMS/
extras = http://mirror.centos.org/centos/$release/extras/$arch/RPMS/
addons = http://mirror.centos.org/centos/$release/addons/$arch/RPMS/

### RPMforge repository
rpmforge = rsync://apt.sw.be/pub/freshrpms/pub/dag/redhat/el5/en/$arch/RPMS.dag/
#rpmforge = ftp://apt.sw.be/pub/dag/pub/redhat/el5/en/$arch/RPMS.dag/
#rpmforge = http://apt.sw.be/redhat/el5/en/$arch/RPMS.dag/

### ATrpms repository
#atrpms-stable = rsync://dl.atrpms.net/dl.atrpms.net/el$release-$arch/atrpms/stable/

### OpenVZ repositories
#ovzkernel = http://download.openvz.org/kernel/rhel5/
#ovztemplate = http://download.openvz.org/template/
#ovzutils = http://download.openvz.org/utils/

### PostgreSQL repository
#postgresql = ftp://ftp.fr.postgresql.org/binary/v8.1.4/linux/rpms/redhat/rhel-as-$release-$arch/

### Custom repository for your own RPM packages
custom =
[/php]

A list of distro’s can be found here: http://svn.rpmforge.net/svn/trunk/tools/mrepo/config/dists/
One last thing I like to change, is in the /usr/bin/mrepo file. I know this isn’t totally recommended, but it’s my preference. mrepo saves the repos as follows: /distro{ver}-{arch} and I prefer to have it /distro{ver}/{arch} – which is a bit neater in my opinion, so we edit /usr/bin/mrepo and change line 319 as follows:

[php]
318> self.dist = dist
319> self.nick = dist + ‘/’ + arch
[/php]
to
[php]
318> self.dist = dist
319> self.nick = dist + ‘/’ + arch
[/php]

Now, you just run mrepo -v -gn centos5 to download the CentOS5 repositories.

More info on mrepo can be found on:
http://dag.wieers.com/home-made/mrepo/
http://svn.rpmforge.net/svn/trunk/tools/mrepo/config/
http://www.brandonhutchinson.com/mrepo_configuration.html

P.S. If you do get an error about lftp not being installed, as follows:
[php]
mrepo: lftp was not found. fish, ftp, http and sftp support (using lftp) is therefor disabled.
[/php]
then simply install it with yum, as such
[php]
yum -y install lftp
[/php]

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • De.lirio.us
  • email
  • Furl
  • laaik.it
  • LinkedIn
  • MySpace
  • Slashdot
  • StumbleUpon
  • Technorati
  • YahooMyWeb
  • Print
  • TwitThis