ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
8

How do I set up a ROS mirror?

asked 2011-02-22 06:10:22 -0600

mjcarroll gravatar image

updated 2011-02-22 06:26:47 -0600

Eric Perko gravatar image

At my university, we have several computers that have ROS installed on them. If I have access to a server, how do I set up a mirror of the ROS Ubuntu repository to speed up installing ROS packages?

edit retag flag offensive close merge delete

Comments

Can i get an admin to allow normal users to accept their own answers?
mjcarroll gravatar image mjcarroll  ( 2011-02-22 06:34:04 -0600 )edit
I accepted it for you
kwc gravatar image kwc  ( 2011-02-22 06:42:24 -0600 )edit
Any problems with me adding this to the wiki entry for mirrors?
mjcarroll gravatar image mjcarroll  ( 2011-02-22 11:06:54 -0600 )edit
A link from the ubuntu mirrors page seems like a good idea
kwc gravatar image kwc  ( 2011-02-22 12:35:36 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
11

answered 2011-02-22 06:19:25 -0600

mjcarroll gravatar image

updated 2011-02-22 06:34:32 -0600

To do this, begin by installing apt-mirror on your Ubuntu system.

sudo apt-get update
sudo apt-get install apt-mirror

Then edit the mirror.list (/etc/apt/mirror.list) file so that the ROS repositories will be mirrored, here is an example for both x86 and amd64 systems.

############# config ##################                                                                                                                                                                              
#
# set base_path    /var/spool/apt-mirror
#
# set mirror_path  $base_path/mirror
# set skel_path    $base_path/skel
# set var_path     $base_path/var
# set cleanscript $var_path/clean.sh
# set defaultarch  <running host architecture>
# set postmirror_script $var_path/postmirror.sh
# set run_postmirror 0
set nthreads     20
set _tilde 0
#
############# end config ##############

#deb http://packages.ros.org/ros/ubuntu jaunty main
deb http://packages.ros.org/ros/ubuntu karmic main
deb http://packages.ros.org/ros/ubuntu lucid main
deb http://packages.ros.org/ros/ubuntu maverick main

#deb-i386 http://packages.ros.org/ros/ubuntu jaunty main
deb-i386 http://packages.ros.org/ros/ubuntu karmic main                                                                                                                                                              
deb-i386 http://packages.ros.org/ros/ubuntu lucid main
deb-i386 http://packages.ros.org/ros/ubuntu maverick main

Once apt-mirror is set up, you can mirror the repository by running the command:

sudo su - apt-mirror -c apt-mirror

This may take a while the first time that you run it. This will download a copy of the ROS repository to /var/spool/apt-mirror by default.

You can now set up Apache to point to the mirror so that it is accessible through http.

As an example, here is my Apache configuration (/etc/apache2/sites-available/mirror.<+YOURDOMAIN+>.com)

<VirtualHost *:80>                                                                                                                                                                                                   
    ServerName mirror.<+YOURDOMAIN+>.com
    ServerAlias www.mirror.<+YOURDOMAIN+>.com
    ServerAdmin XXXXXXX@ieee.org
    DocumentRoot "/var/www/mirror.<+YOURDOMAIN+>.com"

    ErrorLog /var/log/apache2/mirror.<+YOURDOMAIN+>.com/error_log

     <Directory "/var/www/mirror.<+YOURDOMAIN+>.com">
            Options +Indexes
            Order allow,deny
            Allow from all
    </Directory>


    <IfModule log_config_module>
            TransferLog /var/log/apache2/mirror.<+YOURDOMAIN+>.com/access_log
    </IfModule>
</VirtualHost>

Then you may enable the site and create a symlink to the apt-mirror directory:

sudo a2ensite mirror.<+YOURDOMAIN+>.com
sudo ln -s /var/spool/apt-mirror/mirror/code.ros.org /var/www/mirror.<+YOURDOMAIN+>.com/archive-ros

Your mirror will be available at http://mirror.<+YOURDOMAIN+>.com/archive-ros/

You can add it to your local apt repository using the following command:

sudo sh -c '. /etc/lsb-release && echo "deb http://mirror.<+YOURDOMAIN+>.com/archive-ros/packages/ros/ubuntu $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'

And then follow the rest of the ROS install guide.

It also helps to set up a cron task to keep the repository synced, do this by uncommenting the line in /etc/cron.d/apt-mirror

#                                                                                                                                                                                                                    
# Regular cron jobs for the apt-mirror package
#
0 4 * * *   apt-mirror  /usr/bin/apt-mirror > /var/spool/apt-mirror/var/cron.log
edit flag offensive delete link more

Comments

can you change the instructions to use packages.ros.org? We are migrating to that being our primary server due to load issues. We actually update packages.ros.org first, then backsync to code.ros.org.
kwc gravatar image kwc  ( 2011-02-22 06:21:12 -0600 )edit
Unless the Ubuntu package automatically enables cron, you may also have to add a cronjob entry in order for apt-mirror to run regularly. I had to do so on my Funtoo box that is the CWRU ROS mirror.
Eric Perko gravatar image Eric Perko  ( 2011-02-22 06:25:34 -0600 )edit
I would have included our mirror, but I'm not sure how our university's IT department feels about that.
mjcarroll gravatar image mjcarroll  ( 2011-02-22 06:30:51 -0600 )edit
You can also get the repository over <a href="http://rsync.samba.org/">rsync</a> from some locations (e.g., umoss.org). Just remember to use the --delay-updates and --delete-delay parameters so that your mirror never enters an inconsistent state. (Any chance of getting an rsync server at WG?)
Ken gravatar image Ken  ( 2011-02-22 06:31:38 -0600 )edit
1

There are now official mirroring instructions at: http://wiki.ros.org/Mirrors

tfoote gravatar image tfoote  ( 2015-04-22 14:10:13 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2011-02-22 06:10:22 -0600

Seen: 3,817 times

Last updated: Feb 22 '11