0 Replies Latest reply on May 15, 2017 5:02 AM by rgb

    How to host a local copy of AlexT's Galileo repository on a Galileo


      Set up a repository mirror for the Galileo on a Galileo


           A few years ago Intel was nice enough to donate some Galileo 1 boards and Grove kits to my university, which I have been using in  my classes, and students have been using them for projects and competitions. As you may know, the Intel Galileo has two different Images, an eglibc-based image, which can be downloaded from  https://software.intel.com/en-us/iot, and a uclibc based image, that can be downloaded from  http://alextgalileo.altervista.org/blog/updated-galileo-devtools-image/ (latest).

           Since EmuTek (http://www.emutex.com) created a nice little library for the Galileo that lets one use Arduino-like commands in Python for the uclibc image, I decided to use the uclibc based image, and still see no reason to change.

           AlexT of Intel was also nice enough to create a repository and arrange for it to be hosted at http://repo.opkg.net/galileo/, however, downloads are quite slow (I am in Vietnam) with frequent timeouts, and I do not know how much longer the repository will be kept, as the Galileo 1 board is no longer being produced or supported and the official eglibc image is being touted as the proper image to use.

          I therefor decided to host a mirror of the repository locally.

          Initially it will be in a lab, connected to a WiFi router which assigns a IP address of, so students can connect with their laptops, which have shared WiFi and are connected to their Galileo boards with an Ethernet cable. The Galileo boards have static IP addresses to make connection easier, but it would also be possible to use if the Laptop and Galileo are not using static IP address by just plugging directly into the WiFi router. Later, we plan to move it onto our university servers, so students can access it anywhere on campus. For now the students just need to edit /etc/opkg/base-feeds.conf

      After making a backup copy change base-feeds.conf from

                src/gz all     http://repo.opkg.net/galileo/all

                src/gz clanton http://repo.opkg.net/galileo/clanton

                src/gz i586    http://repo.opkg.net/galileo/i586


                src/gz all

                src/gz clanton

                src/gz i586


         So, the following is how I set up the local repository.

      1. Download Alex’s repository

      Install httrack on your laptop/PC (I use Linux)

      >sudo apt-get install httrack

      People with other OSs can go to their webpage https://www.httrack.com/

      Run httack

      > httrack http://repo.opkg.net/galilio -O /media/rgb/Galileo

      Copy to the Galileo SD card

          I just created a WWW directory on the card, and copied the downloaded galileo directory to it. It is accessible within the OS as /media/realroot/www/galileo.

            Note: httrack will modify the index.html files to add in a visible comment to the highest level index.html file and hidden comments to the rest. This can be prevented by using a switch, but it wasn’t a problem for me, as I needed to edit the highest level index.html file to get rid of a link to a parent directory and include instructions for use. (Update - or you can just delete them - see paragraph 6)

      Being on the other side of the world, with a slow link, and using a usb hard drive slowed things down, so it took about 19 hours to download. The directory is only about 1.7GB, so I really didn’t need to use the usb disk. Httrack, according to the instructions, will check to see what is new the second time it is run, so should be much faster to synchronize any changes.


      2. Clean up Index,html files (Update - or you can just delete them - see paragraph 6)

      Every directory has an index.html file, that allows one to go to the higher and lower directories, and download files. Since I am only using the galileo repository, I decided that the galileo directory will be the top, so I needed to shorten the path in the index.html files. Search and replace did this quite nicely, with only a little editing needed. I also created a new, top level directory that give some explaination.


      3. Give root a password

      Since the server is going to be in the lab, accessible to mischievous students,



      4. Create a www user

      >useradd www


      5. Change rights to Galileo directory, so www can access it.

      >chmod -R o+rx /media/realroot/www


      6. Install and run  lighttpd web server on the host Galileo.

      I spent a lot of time trying to get  Flask,which didn’t reliably serve files, I think it was choking, and Apache, which was more complex than I wanted to deal with, to work, and settled on lighttpd, which was really simple to setup and use.


      (Source: http://www.onlamp.com/pub/a/onlamp/2007/04/05/the-lighttpd-web-server.html)

          # wget http://www.lighttpd.net/download/lighttpd-1.4.13.tar.gz

          # tar xvzf lighttpd-1.4.13.tar.gz

          # cd lighttpd-1.4.13

              # ./configure

          # make

          # make install

      Create a lighttpd.conf file in the www directory. (see attached file)


      server.document-root = "/media/realroot/www/galileo/"

      dir-listing.activate = "enable"

      server.port = 80


      server.username = "www"

      server.groupname = "www"


      mimetype.assign = (

        ".html" => "text/html",

        ".txt" => "text/plain",

        ".jpg" => "image/jpeg",

        ".png" => "image/png",

        ".ipx" => "image/png"



      Note; AlexT pointed out that lighttpd has the ability to create directory listings (index.html) automatically https://redmine.lighttpd.net/projects/1/wiki/Docs_ModDirlisting

      So if you add

      dir-listing.activate = "enable"

      to the lighttpd.conf file, it will create directory listings, if there is no index.html file in that directory (I, however am using a custom top-level index.html, to give instructions to students, with the rest now automatically generated)



      Test it

      >lighttpd -D -f lighttpd.conf

      Use a browser to connect to the server’s IP address or, if you installed avahi-daemon, <hostname>.local Ex:VGU-GaliRepo.local

      Set it to run automatically

      Create a shell file

      >nano /media/realroot/www/light.sh

      Enter in the  line

      /usr/local/sbin/lighttpd -D -f /media/realroot/www/lighttpd.conf

      save, exit

      make it executable

      >chmod +x /media/realroot/www/light.sh


      Test the script

      From www directory, run ./light.sh


      Set to run automatically

      >cd /etc/init.d

      edit galileod.sh,

      >nano galileod.sh




          echo "Starting galileod"

          start-stop-daemon -q -S -m -p $pidfile -b -x $launcher

          start-stop-daemon -q -S -m -p $pidsreset -b -x $sreset -- -i $input_reset_gpio -o $output_reset_gpio

          /usr/sbin/rdate -s time.nist.gov

          /usr/bin/python /media/realroot/LCDStartup/LCD.py&

         /bin/sh /media/realroot/www/light.sh&

          /usr/bin/python /media/realroot/LCDStartup/button.py&


      7. Setup button to shut down the system. (This uses the Emutex library)

      Since the lab’s power is shut off at night, there needs to be a graceful way to shutdown the Galileo at the end of the day, so I created a small board with an LED and a button, normally pulled low with a 10k resisort.

      (see attached button.py)

      Make it run at startup, see above

      /usr/bin/python /media/realroot/LCDStartup/button.py&



      Hope this of help to someone