The default port for the Open Build Service for the published repositories is 82.

If you are using the Internet through an http proxy, this can cause trouble, as it did for me when I wanted to install from the OBS run by KolabSystems, for installing Kolab from OBS: Downloading from the URL http://obs.kolabsys.com:82/Kolab:/3.1:/Updates/CentOS_6/Kolab:3.1:Updates.repo does not work.

The solution is to setup a small php script on a server somewhere on the Internet, that does not have the restrictions of port 82.

In my sample configuration, I use a Debian server with Lighttpd and PHP.

Install:

apt-get install lighttpd spawn-fcgi php5-curl php5-cgi

changes to /etc/lighttpd/lighttpd.conf:

server.modules = (
        [...]
        "mod_fastcgi",
        "mod_rewrite",
)
 
fastcgi.server = ( ".php" => ((
                     "bin-path" => "/usr/bin/php5-cgi",
                     "socket" => "/tmp/php.socket",
                     "max-procs" => 2,
                     "bin-environment" => (
                       "PHP_FCGI_CHILDREN" => "16",
                       "PHP_FCGI_MAX_REQUESTS" => "10000"
                     ),
                     "bin-copy-environment" => (
                       "PATH", "SHELL", "USER"
                     ),
                     "broken-scriptfilename" => "enable"
                 )))
 
url.rewrite-once = (
    "^/obs\.kolabsys\.com/index.php" => "$0",
    "^/obs\.kolabsys\.com/(.*)" => "/obs.kolabsys.com/index.php?page=$1"
)

and in /var/www/obs.kolabsys.com/index.php:

<!--?php 
 
// it seems file_get_contents does not return the full page
function curl_get_file_contents($URL)
{
    $c = curl_init();
    curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($c, CURLOPT_URL, str_replace('&#038;', '&#038;', $URL));
    $contents = curl_exec($c);
    curl_close($c);
    if ($contents) return $contents;
    else return FALSE;
}
 
$page = $_GET['page'];
$filename = basename($page);
$content = curl_get_file_contents("http://obs.kolabsys.com:82/".$page);
if (substr($page, -strlen("/")) === "/")
{
        # print directory listing
        $content = str_replace("http://obs.kolabsys.com:82/", "http://download.pokorra.de/obs.kolabsys.com/", $content);
        $content = str_replace('href="/', 'href="http://download.pokorra.de/obs.kolabsys.com/', $content);
        echo $content;
}
else if (substr($filename, -strlen(".repo")) === ".repo")
{
        header("Content-Type: plain/text");
        echo str_replace("http://obs.kolabsys.com:82/", "http://download.pokorra.de/obs.kolabsys.com/", $content);
}
else
{
        header("Content-Type: application/octet-stream");
        header('Content-Disposition: attachment; filename="'.$filename.'"');
        header("Content-Transfer-Encoding: binary\n");
        echo curl_get_file_contents("http://obs.kolabsys.com:82/".$page);
}
 
?-->

Now it is possible to download the repo files like this:

cd /etc/yum.repos.d/
wget http://download.pokorra.de/obs.kolabsys.com/Kolab:/3.1/CentOS_6/Kolab:3.1.repo
wget http://download.pokorra.de/obs.kolabsys.com/Kolab:/3.1:/Updates/CentOS_6/Kolab:3.1:Updates.repo
yum install kolab

This works for all other projects and distributions on obs.kolabsys.com too.

Feel free to use my “mirror”, but also consider to set it up for yourself, if you are using it extensively!

Downloading from OBS repo via php proxy file
Tagged on: