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 192.168.0.50, 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 http://192.168.0.50/all
src/gz clanton http://192.168.0.50/clanton
src/gz i586 http://192.168.0.50/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/
> 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
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.