{"id":253,"date":"2011-12-17T21:57:09","date_gmt":"2011-12-18T03:57:09","guid":{"rendered":"http:\/\/www.soljerome.com\/blog\/?p=253"},"modified":"2012-05-03T10:42:18","modified_gmt":"2012-05-03T15:42:18","slug":"mirroring-rhn-with-mrepo-on-rhel6","status":"publish","type":"post","link":"https:\/\/www.soljerome.com\/blog\/2011\/12\/17\/mirroring-rhn-with-mrepo-on-rhel6\/","title":{"rendered":"Mirroring RHN with mrepo on RHEL6"},"content":{"rendered":"<p><strong>Update:<\/strong> Post updated to allow for generation of multiple mirrors of varying versions of RHEL as shown at <a href=\"http:\/\/brandonhutchinson.com\/mrepo_configuration.html\" target=\"_blank\">http:\/\/brandonhutchinson.com\/mrepo_configuration.html<\/a>.<\/p>\n<p>The latest version of mrepo available in EPEL (mrepo-0.8.7-2.el6.noarch.rpm at the time of this writing) won&#8217;t allow you to mirror RHN without some slight modifications. This is a brief howto that will highlight exactly what is needed to allow mrepo to mirror RHN on RHEL6.<\/p>\n<p><strong>NOTE<\/strong>: This howto is loosely based on the RHEL5 mrepo howto available at <a href=\"http:\/\/ln-s.net\/9SlN\" target=\"_blank\">http:\/\/ln-s.net\/9SlN<\/a>.<\/p>\n<p>You will need to install the following packages:<\/p>\n<pre>pyOpenSSL\r\nrhn-client-tools\r\nrhpl\r\nmrepo<\/pre>\n<p>Next, you need to setup mrepo.conf with your RHN login credentials by adding the following to the <code>[main]<\/code> section:<\/p>\n<pre>rhnlogin = &lt;username&gt;:&lt;password&gt;<\/pre>\n<p>Set a silly default for up2date<\/p>\n<pre>echo \"up2date default\" &gt; \/etc\/sysconfig\/rhn\/sources<\/pre>\n<p>Set your machine&#8217;s UUID<\/p>\n<pre>UUID=$(uuidgen) ; \/bin\/echo -e \"uuid[comment]=Universally Unique ID for this server\\nrhnuuid=$UUID\" \\\r\n &gt; \/etc\/sysconfig\/rhn\/up2date-uuid<\/pre>\n<p>Set up additional repositories (RHEL5 in this case). Note that the path will differ depending on your srcdir as specified in <code>mrepo.conf<\/code>.<\/p>\n<pre>gensystemid -u RHN_username -p RHN_password --release=5Server --arch=x86_64 \/srv\/mrepo\/src\/5Server-x86_64\/<\/pre>\n<p>Make sure the proper certificate is in use<\/p>\n<pre>cp `cat \/etc\/sysconfig\/rhn\/up2date|grep ^sslCACert=|cut -d= -f2` \/usr\/share\/rhn\/RHNS-CA-CERT<\/pre>\n<p>Add your RHEL6 (and any additional platforms) mrepo configuration (e.g.):<br \/>\n<code>\/etc\/mrepo.conf.d\/6Server.conf<\/code><\/p>\n<pre>### Name: Red Hat Enterprise Server v6\r\n### URL: http:\/\/www.redhat.com\/\r\n\r\n[6Server]\r\nname = Red Hat Enterprise Server $release ($arch)\r\nrelease = 6\r\narch = x86_64\r\nmetadata = yum repomd\r\n\r\n### RHEL6 repositories\r\nupdates = rhns:\/\/&lt;your satellite server&gt;\/rhel-$arch-server-$release\r\noptional = rhns:\/\/&lt;your satellite server&gt;\/rhel-$arch-server-optional-$release\r\nrhn-tools = rhns:\/\/&lt;your satellite server&gt;\/$repo-rhel-$arch-server-$release\r\nsupplementary = rhns:\/\/&lt;your satellite server&gt;\/rhel-$arch-server-$repo-$release<\/pre>\n<p><code>\/etc\/mrepo.conf.d\/5Server.conf<\/code><\/p>\n<pre>### Name: Red Hat Enterprise Server v5\r\n### URL: http:\/\/www.redhat.com\/\r\n\r\n[5Server]\r\nname = Red Hat Enterprise Server $release ($arch)\r\nrelease = 5\r\narch = x86_64\r\nmetadata = repomd\r\n\r\n### RHEL5 repositories\r\nupdates = rhns:\/\/&lt;your satellite server&gt;\/rhel-$arch-server-$release\r\nvt = rhns:\/\/&lt;your satellite server&gt;\/rhel-$arch-server-$repo-$release\r\nsupplementary = rhns:\/\/&lt;your satellite server&gt;\/rhel-$arch-server-$repo-$release\r\nfastrack = rhns:\/\/&lt;your satellite server&gt;\/rhel-$arch-server-$repo-$release\r\nhts = rhns:\/\/&lt;your satellite server&gt;\/rhel-$arch-server-$repo-$release\r\nrhn-tools = rhns:\/\/&lt;your satellite server&gt;\/$repo-rhel-$arch-server-$release<\/pre>\n<p>Lastly, you need to fix a couple bugs in the current mrepo release so that it will run successfully on RHEL6. The first file to change is <code>\/usr\/share\/mrepo\/up2date_client\/up2dateUtils.py<\/code>:<\/p>\n<pre>--- \/usr\/share\/mrepo\/up2date_client\/up2dateUtils.py     2008-08-14 19:14:47.000000000 -0500\r\n+++ \/var\/lib\/bcfg2\/Cfg\/usr\/share\/mrepo\/up2date_client\/up2dateUtils.py\/up2dateUtils.py   2011-12-02 09:27:07.500138609 -0600\r\n@@ -13,7 +13,7 @@\r\n import time\r\n import rpm\r\n import string\r\n-import md5\r\n+import hashlib\r\n\r\n sys.path.insert(0, \"\/usr\/share\/rhn\/\")\r\n sys.path.insert(1,\"\/usr\/share\/rhn\/up2date_client\")\r\n@@ -158,7 +158,7 @@\r\n\r\n def md5sum(fileName):\r\n-    hashvalue = md5.new()\r\n+    hashvalue = hashlib.md5()\r\n\r\n     try:\r\n         f = open(fileName, \"r\")<\/pre>\n<p>The second file to change is <code>\/usr\/share\/mrepo\/rhn\/transports.py<\/code><\/p>\n<pre>--- \/usr\/share\/mrepo\/rhn\/transports.py  2008-08-14 19:14:47.000000000 -0500\r\n+++ \/var\/lib\/bcfg2\/Cfg\/usr\/share\/mrepo\/rhn\/transports.py\/transports.py  2011-12-13 15:04:19.236104253 -0600\r\n@@ -33,6 +33,7 @@\r\n\r\n class Transport(xmlrpclib.Transport):\r\n     user_agent = \"rhn.rpclib.py\/%s\" % __version__\r\n+    _use_datetime = False\r\n\r\n     def __init__(self, transfer=0, encoding=0, refreshCallback=None,\r\n             progressCallback=None):<\/pre>\n<p>That should do it. You should then be able to run <code>mrepo -ugv<\/code> and update your local mrepo mirror with the latest from RHN.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Update: Post updated to allow for generation of multiple mirrors of varying versions of RHEL as shown at http:\/\/brandonhutchinson.com\/mrepo_configuration.html. The latest version of mrepo available in EPEL (mrepo-0.8.7-2.el6.noarch.rpm at the time of this writing) won&#8217;t allow you to mirror RHN without some slight modifications. This is a brief howto that will highlight exactly what is <a href='https:\/\/www.soljerome.com\/blog\/2011\/12\/17\/mirroring-rhn-with-mrepo-on-rhel6\/' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3,19],"tags":[],"_links":{"self":[{"href":"https:\/\/www.soljerome.com\/blog\/wp-json\/wp\/v2\/posts\/253"}],"collection":[{"href":"https:\/\/www.soljerome.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.soljerome.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.soljerome.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.soljerome.com\/blog\/wp-json\/wp\/v2\/comments?post=253"}],"version-history":[{"count":13,"href":"https:\/\/www.soljerome.com\/blog\/wp-json\/wp\/v2\/posts\/253\/revisions"}],"predecessor-version":[{"id":298,"href":"https:\/\/www.soljerome.com\/blog\/wp-json\/wp\/v2\/posts\/253\/revisions\/298"}],"wp:attachment":[{"href":"https:\/\/www.soljerome.com\/blog\/wp-json\/wp\/v2\/media?parent=253"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.soljerome.com\/blog\/wp-json\/wp\/v2\/categories?post=253"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.soljerome.com\/blog\/wp-json\/wp\/v2\/tags?post=253"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}