Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run sudo apt-get install without internet connection

My end goal is to turn my Raspberry Pi into a FTP Server. It is connected to the network, but with no internet connection. It seems like this would be extremely easy to accomplish if I could just run the "sudo apt-get install ...." command, but since I have no internet this is not possible.

I downloaded the "ftplib" for python which I think will allow me to connect to and interact with my FTP server once I get it up, but right now I am stuck.

I do not know to much about Linux, or web servers so thank you for your patience in advance.

I think a possible solution would be to download a LAMP package on my computer with internet and then transfer it over to the Raspberry Pi, but I am not sure what kind of path and folder issues I might run into then.

like image 820
Shaun314 Avatar asked Dec 27 '22 02:12

Shaun314


1 Answers

Doing this is never ever clean, and never perfect. But below is what I've done to get it to work at times.

You will need a machine that is similar to the FTP server and from the FTP server you will need to download all packages and dependencies. Typically, from the internet machine you will first run:

sudo apt-get clean 

The above command cleans the /var/cache/apt/archives/ directory so that you can ensure it only contains the package and dependencies you desire. Then execute:

sudo apt-get -d build-dep <package_name>

The -d does a download only and build-dep gets all the dependencies required and drops them into /var/cache/apt/archives/. This is why you at least need a similar build. Sometimes you may even need to do a sudo apt-get remove <package name> if your machine already has the package that your destination server requires.

You then take the data out of that directory and put it on some device to transfer to your FTP server. From there you execute on your target machine:

sudo dpkg -i *.deb

The other thing you can do is use apt offline http://apt-offline.alioth.debian.org/

like image 94
hax0r_n_code Avatar answered Dec 31 '22 11:12

hax0r_n_code