4

Is there a way to store .deb files on a Apache server on Ubuntu and be able to install them on a Pi with the sudo apt-get install command?

3

OK. Here is the answer you are looking for (done from root, or with sudo)

  1. Install Apache

    apt-get install apache2
    
  2. Create a Debian Package Repository Directory

    mkdir /var/www/debs/arm
    
  3. Move your debs to the /var/www/debs/arm directory

  4. Go to /var/www/debs directory if not already there

    cd /var/www/debs
    
  5. Run the following command to create a packages.gz file

    dpkg-scanpackages arm | gzip -9c > arm/Packages.gz
    
  6. Now we need to make the repository known to apt by updating /etc/apt/sources.list

    sudo nano /etc/apt/sources.list
    

and add line that looks like this (based off examples so far)

deb http://localhost/debs/
  1. Now update APT

    sudo apt-get update
    
  2. Now your pretty much done, the only thing left to do is try it out. I set one up as I was writing this and verified it worked.

This is how i verified. I used node to test it.

 wget http://node-arm.herokuapp.com/node_latest_armhf.deb
 sudo mv node_latest_armhf.deb /var/www/debs/arm

 cd /var/www/debs
 dpkg-scanpackages arm | gzip -9c > arm/Packages.gz

I then edited /etc/apt/sources.list. I commented out the default, and added my created

 sudo nano /etc/apt/sources.list

 #deb http://mirrordirector.raspbian.org/raspbian wheezy main firmware
 #deb http://archive.raspberrypi.org/debian wheezy main
 deb `http://192.168.1.90/debs/ arm/`

 sudo apt-get update
 sudo apt-get install node

Just to show you it worked, but it does give a "The following packages cannot be authenticated!" warning

Proof of work

Edit: As you can see from my example and screenshot, I used my pi's IP address, rather than using local host, but you can go either way.

Also, you may consider using lighttpd or nginx instead of apache as it will use less resources.

Edit 2: Ok, in comments you stated you are getting an error

malformed line 2 in source list /etc/apt/sources.list (dist parse)

So there is something wrong with line 2. I am using Raspbian Minimal (raspbian-ua-netinst), but here is my /etc/apt/sources.list. Yours will probably have more entries. The first two entries are the default, I commented them out just to test the setup as I did not want node to install from anywhere but my package repo. So take a look at line 2 and make sure it matches the format of what I posted below. There is probably an extra space on that line, no space where there needs to be one or maybe an accidental character or something along those lines. Afterwards run

sudo apt-get update

apt-sources

  • i have tried this and get a error on the pi saying malformed line 2 in source list /etc/apt/sources.list (dist parse) – Jhondoe Jan 2 '15 at 15:58
  • I updated the answer. See Edit 2. – geoffmcc Jan 2 '15 at 16:41
  • no it matchs what you have posted but if on firefox i got to localhost/debs/ iget page not found so shall i move it into my html folder where i put my php pages to – Jhondoe Jan 2 '15 at 16:45
  • yes, you must have your host setup differently than the defaults, or your on a vhost. Move the debs directory to html folder. – geoffmcc Jan 2 '15 at 16:47
  • no problem, sorry it took me so long to answer. As I stated in my original answer I didn't think could be done. I found This in a google search and tested on my secondary pi. – geoffmcc Jan 2 '15 at 16:55
4

You can put the debs up on a server on Ubuntu, but you won't be able to install them without first using something like the following from a terminal.

 wget servername/name.deb

Then you can

 sudo dpkg -i name.deb

Another option though would be to setup Ubuntu as an NFS server and use the Pi as a client. Then you can set up /etc/fstab to auto mount the NFS share on the Pi. Then you would just go to wherever you mounted the share in Pi, and run the same command:

sudo dpkg -i name.deb

If the NFS idea is of interest to you, you should have no problem finding out how to do on ask, or other places. It is pretty easy to setup.

  • That doesn't help with what the wusten was about using the apt get comand – Jhondoe Jan 1 '15 at 17:35
  • I was just trying to offer something that will work, cause I don't think what you want will. Only other thing I can suggest is looking up how to make your own repository, but I think you will need to setup and import keys to get out working... Now that I think of it, it may be possible. Looking into it – geoffmcc Jan 1 '15 at 17:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.