Third party cookies may be stored when visiting this site. Please see the cookie information.

PenguinTutor YouTube Channel

Raspberry Pi Offline - Downloading debian, git and python files for offline install

Introduction

This is a guide for performing offline installs on a Raspberry Pi, or other debian based Linux computers where you don't have an Internet connection.

Imagine you have a Raspberry Pi that you want to use for controlling some NeoPixels and for whatever reason you don't have an Internet connection. This could be because you are running this at a Raspberry Jam, or because you want to update a computer that is only available via an internal network. This guide will work through the steps you need to follow to complete the instructions in NeoPixel worksheet without having an Internet connection on the Raspberry Pi.

You will still need another computer that does have Internet access (or to have prepared the files in advance) and some way of transferring the files (eg. a USB flash drive).

Using apt to catalog and install deb dpkg files

If you have first need to install Debian software then you can first query the files required on the Raspberry Pi offline computer and then download those on a different computer. The files can then be transferred to the offline computer by USB flash drive an installed using dpkg.

In this case we need to install scons and swig

To identify the required files first run the following command on the offline computer:
apt-get install scons swig --print-uris | tee offline.txt

This will not install the files, but will log the details into a file called offline.txt. An example output is shown below:



Reading package lists...

Building dependency tree...

Reading state information...

The following extra packages will be installed:

  swig2.0

Suggested packages:

  swig-doc swig-examples swig2.0-examples swig2.0-doc

The following NEW packages will be installed:

  scons swig swig2.0

0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.

Need to get 1,874 kB of archives.

After this operation, 6,547 kB of additional disk space will be used.

Do you want to continue? [Y/n] 'http://mirrordirector.raspbian.org/raspbian/pool/main/s/scons/scons_2.3.1-2_all.deb' scons_2.3.1-2_all.deb 

518336 MD5Sum:c0955330e5fc8675cacd4fa8f985172c

'http://mirrordirector.raspbian.org/raspbian/pool/main/s/swig2.0/swig2.0_2.0.12-1_armhf.deb' swig2.0_2.0.12-1_armhf.deb 

1070816 MD5Sum:5031c2378631356c03a2f96f1c83fdb5

'http://mirrordirector.raspbian.org/raspbian/pool/main/s/swig2.0/swig_2.0.12-1_armhf.deb' swig_2.0.12-1_armhf.deb 

285096 MD5Sum:56571ae6501620ce6001c3f4f34e1415

As you can see all the required files (including a required dependency) are listed at the bottom of the file.

You can download these on another computer using wget followed by the name of the file (or download directly within a browser).



wget http://mirrordirector.raspbian.org/raspbian/pool/main/s/scons/scons_2.3.1-2_all.deb

wget http://mirrordirector.raspbian.org/raspbian/pool/main/s/swig2.0/swig2.0_2.0.12-1_armhf.deb

wget http://mirrordirector.raspbian.org/raspbian/pool/main/s/swig2.0/swig_2.0.12-1_armhf.deb

Now copy the files to the offline computer (eg. using a USB flash drive) and then run:
sudo dpkg -i *.deb
(in some circumstances you may need to install these in a specific order, however as long as all the files are in the same directory it usually works as a single install.

Download from github

The next stage in the NeoPixel install is to download some files from github. The instructions in the Raspberry Pi NeoPixel install guide, assume this will be done online, but this can be done using another computer and easily transferred to the offline computer.

To download files from github then you can use either wget on the master.zip file or use the "get ZIP" option from a web broser. The unzip command can then be used to extract the files.

For example instead of using git clone download the files using:
wget https://github.com/jgarff/rpi_ws281x/archive/master.zip
wget https://github.com/penguintutor/neopixel-gui/archive/master.zip

Or download using a web browser from:
https://github.com/jgarff/rpi_ws281x
and
https://github.com/penguintutor/neopixel-gui

You may need to rename these once downloading (especially the wget file which will create files called master.zip).

Transfer these to the Raspberry Pi and extract the files by entering unzip followed by the name of the .zip file.

When downloading the master files from github then it adds "-master" to the end of the directory. You may need to rename the to remove -master eg.
mv rpi_ws281x-master rpi_ws281
mv neopixel-gui-master neopixel-gui

Offline install using Python easy setup.py file

One of the steps in the install of the NeoPixel ws281x library involves downloading and install the Python setuptools from the Internet.

The best way to identify what it is expecting is to run the normal installer and look for any errors where it attempts to get files from the Internet.

In this case the rpi_ws281x library install (eg. sudo python3 setup.py install) attempts to use the python easyinstall which first needs the setuptools. The error message shows this as
https://pypi.python.org/packages/source/s/setuptools/setuptools-5.7.zip
Download this using wget and copy that to the offline computer and install using pip3.
sudo pip3 install setuptools-5.7.zip

Now retry the install
sudo python3 setup.py install
and hopefully it should now work. If not then look for any other errors where it attempts to download something and perform that manually offline.

More information

See the guides and blog posts relating to the Raspberry Pi. Also see the Linux Tutorials for more information on using Linux.

Other Raspberry Pi Projects and tutorials

Previous Linux file access permissions reference
Linux file access permissions reference
Next Automatically running applications on a Raspberry Pi
Automatically running applications on a Raspberry Pi