DIGIT-ARC read-only archive · snapshot: July 23, 2026

Package management through Live-CD

25 posts · originally from https://geek.digit.in/community/threads/package-management-through-live-cd.65739/

faraaz
faraaz Original post #1
Aug 16, 2007 at 5:44 PM
Hi...I have a pretty simple question. Is it possible to use a Live-CD & USB stick combination on a Windows machine to boot up, download packages then transfer to my Ubuntu machine (which has no internet connection) to install the software that way?

Is there anyway someone could help me out?? I know there's a command with apt-get to download programs to the cache without installing. And I also know that there is a particular dpkg command with options and syntaxes and what not which will install all the .deb files in a defined location. So...help?
M
Aug 16, 2007 at 5:51 PM
So, what's the problem then? If you don't want to use command line at all. Check apt-on-cd. But, alas it doesn't come on Ubuntu live CD.
faraaz
faraaz #3
Aug 16, 2007 at 6:32 PM
@mehulved: When I said I know that there are commands for these things, I meant that I know they exist, but I haven't got a clue to exactly what they are! So I was hoping someone could post the actual commands I would need to use with an example or two!

Plus apt-get saves .deb files to the /var/apt/cache/ folder if I remember correctly...and I have no idea how this works when running from a read-only media like a Live-CD. If I get help with commands, I'd also need to know how to make apt-get download the files to a custom location (in this case something like /media/sdb1 or /media/usb)...
int86
int86 #4
Aug 16, 2007 at 6:45 PM
^^^^
Its /var/cache/apt/archives
praka123
Aug 16, 2007 at 6:58 PM
faraaz said:
Hi...I have a pretty simple question. Is it possible to use a Live-CD & USB stick combination on a Windows machine to boot up, download packages then transfer to my Ubuntu machine (which has no internet connection) to install the software that way?
First thing will be to configure internet on ubuntu.reg,ur question-u can boot a livecd and mount ur ubuntu partn rw(root).then there is a command called chroot.if ur livecd got internet u can chroot from livecd to ubuntu hdd which can download packages to the original /var/cache/apt/archives/ dir.downloading packages manually and moving them to apt cache dir is illogical id say.if ur thinking of d/ling from win to usb stick and use livecd to mount ubuntu hdd partn and transfer the files,is possible.but what is the use?
faraaz said:
Is there anyway someone could help me out?? I know there's a command with apt-get to download programs to the cache without installing. And I also know that there is a particular dpkg command with options and syntaxes and what not which will install all the .deb files in a defined location. So...help?
sudo apt-get update,sudo apt-get upgrade,sudo apt-get autoclean(remove old stuff).<< is common house keeping.
as for ur option to just download package to the local repo(//var/cache..).u need to use the format:
Code:
sudo apt-get  -d install packgname
u can install .deb packages by right clicking now a days with gui(gdebi).for cli- dpkg -i /dir/afa.deb is the format.dpkg is the management tool.while apt more or less manages the whole things.
M
Aug 16, 2007 at 7:18 PM
See, when you run a live cd it's not a read only file system. How else would programs run correctly. Many programs need to write to file system and it is accessed by other programs. I don't know how exactly it works, you will have to read up on it. I believe squashfs is one such fs.
To solve your problem
1) Mount your pen drive as /var/cache/apt/archives - so that all the downloaded files will be saved in the right format and structure.
2) Download the required softwares and do remember which ones they are
2) Take the drive to your PC and cp all the contents to your Ubuntu's /var/cache/apt/archives folder. And now give
sudo apt-get install <package>
Where package is the name of the software that you want.
faraaz
faraaz #7
Aug 16, 2007 at 8:40 PM
@praka & Mehulved: That is pure genius!! I knew I had read it somewhere, but what you fellows told is exactly what I wanted, although all that chroot stuff kinda flew over my head.

So here's what I understand, in summary:

1) Boot from Live CD
2) Use the mount -o loop "filename" "mountpoint" command (I know that's not the exact thing but you know what I mean) to set my pen drive (/dev/sdb1 on my laptop) as the /var/cache/apt/archives folder.
3) Fire up apt-get and download everything I want.
4) Copy these packages including the dependencies to my desktop system.
5) Install everything by typing dpkg -i *.deb (or something similar...I have to look it up...)

So, in short, will this work? If yes, my internet worries are solved, and I can just use my regular windows pc without worries...
kalpik
kalpik #8
Aug 16, 2007 at 8:56 PM
I think you can install aptoncd on the live system too! Just try it out..
M
Aug 16, 2007 at 9:11 PM
kalpik said:
I think you can install aptoncd on the live system too! Just try it out..
But he'll have to do so everytime. But, thinking of it again, it's not a big download so he can do that.

faraaz my method doesn't involve using dpkg at all. Once you place the contents of your drive in /var/cache/apt/archives then you can use synaptic as if you were getting it from net. My only concern is if it will work fine if the package isn't in the specified repositories, but it's still there in archive folder.
faraaz
faraaz #10
Aug 16, 2007 at 9:51 PM
@mehulved: yeah, it will work...i used to get error msgs from using aptoncd based cd repositories also, that the files were not authenticated. But apart from that, it worked fine.

But hang on, if i download, say...apt-get install -d insertpackagenamehere to the archives, then copy it to the same folder on my desktop, I can run "apt-get install insertpackagenamehere" and it will install like normal?? I dunno man, last time I tried this with aptoncd, it didn't work...
kalpik
kalpik #11
Aug 17, 2007 at 7:41 AM
@mehulved, nothing will happen if the package is in the cache, and not in the repos.

@faraaz, when you copy it to desktop, you would have to use dpkg to install, not apt-get. And aptoncd works every time! Just create an iso and copy that! Then on the target system, install aptoncd and restore the ISO. As simple as that!
faraaz
faraaz #12
Aug 17, 2007 at 9:49 AM
@kalpik: Cool...thanks for the tip.
praka123
praka123 #13
Aug 17, 2007 at 12:49 PM
^while on Ubuntu,who cares for dpkg manual install :rolleyes: there is gdebi(double click install) na? :p
faraaz
faraaz #14
Aug 17, 2007 at 7:38 PM
@praka123: Do one thing, open up your /var/cache/apt folder and see how many deb fils are there JUST for multimedia codecs (including dependencies and what not)... its a pain to double click one by one. Especially when if you click a file, it says "missing dependency" and you have to hunt down the dependency deb just to go back to the other one. Its like reverse dependency hell.

With dpkg, if I use *.deb, I will be able to install ALL the packages in the folder in one go, am I right?? Why would I want to use gdebi?

Or else I will just make an apt-on-cd metapackage, copy the stuff to my archive folder and then just install the metapackage through synaptic. Eitherway...I wont have this stupid no-internet means no applications problem.

Okay, update...I tried doing this, but it didn't install anything...said I had broken dependencies.

I restored an ISO image using aptoncd, then used dpkg -i /var/cache/apt/archive/*.deb

I specifically tried to install win32codecs, libdvdcss and gstreamer plugins...

Now what?
kalpik
kalpik #15
Aug 17, 2007 at 11:05 PM
^^ When you restore the ISO, just use apt-get to install! (provided you would have to run apt-get update once)
faraaz
faraaz #16
Aug 18, 2007 at 1:35 AM
apt-get update on an offline system?? just gives me tons of error msgs as to how it couldnt connect to the repository servers. does apt-get install pckgname work even after that?
kalpik
kalpik #17
Aug 18, 2007 at 8:48 AM
You would have to run apt-get update once, online. After that, you can run apt-get install offline too :)
faraaz
faraaz #18
Aug 18, 2007 at 10:01 AM
But the whole point of this downloading business was because I DONT have internet on my desktop...so how does that help me exactly?
mediator
mediator #19
Aug 18, 2007 at 12:47 PM
@Faraaz : What u r asking is what is called as "local repository".


I guess u already understood what @mehul and @praka bhai suggested!

"-d" option is used to only download the files and not install it! And @praka gave u the format "sudo apt-get -d install packagename". Read man pages!

After having all the needed deb files what u need to do next [SIZE=+1]on target ubuntu machine[/SIZE] is,

1. Make sure u have http server setup on the target ubuntu machine! AFAIR, it comes packed with it! If not then u need to download the server packages and manually click on the install deb files!! When u install it, it runs by default.

U can check that by opening ur browser and typing "127.0.0.1". If error is acknowledge then do "sudo /etc/init.d/apache2 start".

2. Copy the contents of that "archive" directory containing all "deb" files that u downloaded to some place say "/home/faraaz/www/apt/archives/binary" on target ubuntu machine!

3. Next u update the package info. U open terminal in archives directory i.e "cd $HOME/www/apt/archives" and issue "dpkg-scanpackages binary /dev/null | gzip -9c > binary/Packages.gz".
If the command gives permissions error then prepend 'sudo' to it!


4. Now /var/www is where ur local webserver files are located by default. So do "cd /var/www" and then "sudo ln -s $HOME/www/apt/archives apt".

By doing this a link "apt" is created in /var/www which points to "$HOME/www/apt/archives".


5. Next, backup ur sources.list file, like "sudo cp /etc/apt/sources.list /etc/apt/sources.list.back".

Here u add ur local repository! Do,

" echo "deb *localhost/apt binary/" > /etc/apt/sources.list".

Remember, '>>" appends, while ">" erases everything and puts in new! '>' is better coz the repository updates quickly then and u already have a backup of ur original sources.list!

6. Now run 'sudo apt-get update'.

7. If u have mplayer in ur local repo, then do "sudo apt-get install mplayer"! Simple!

Also checkout "*127.0.0.1/apt".


This is the setup for local repository which u can create for ur friends too who dont have internet or update all the machines on the network from just one host. So wheneva u do some update or install u do

1. sudo apt-get clean
2. sudo apt-get install (or wateva u want to do i.e retrieve operation)
3. cp -v /var/cache/apt/archives/*.deb $HOME/www/apt/archives/binary
4. cd $HOME/www/apt/archives
5. sudo dpkg-scanpackages binary /dev/null | gzip -9c > binary/Packages.gz
6. And ur local repository gets updated filling the hardisk space!


* After the use u may stop the web server by "sudo /etc/init.d/apache2 stop" or disabling from "system>administration>services" in gnome!

* Also u may back ur sources.list file if u want "sudo cp /etc/apt/sources.list.back /etc/apt/sources.list" and then "sudo apt-get update"!!
M
mehulved #20
Aug 18, 2007 at 4:38 PM
faraaz you are getting those errors cos you have http and ftp repositories in you /etc/apt/sources.list file. Remove or comment them out.
It can be done by GUI too.
Only keep the cd's having softwares as repositories.
faraaz
faraaz #21
Aug 19, 2007 at 2:20 PM
Oooooh....dude, that makes so much sense!!!

One question though, is it possible to use an ISO file as a repository? Its just that I don't want to have to burn a fresh CD every time I want to install stuff on an offline machine.

Also, @mediator: Dude, your method is really confusing. I'll try out mehulved's suggestion and comment out my sources.list file. If that doesn't work, I'll give your method a go and get back to ya'll.
mediator
mediator #22
Aug 19, 2007 at 4:07 PM
Thats the universal method of updating and installing 'offline' and thats where I described about '>' and '>>' i.e the thing similar to "commenting" => to just backup your 'original' sources.list and instead of commenting it out all, delete the whole content and then insert just one line in ur sources.list pointing towards local repository !!

In any case if u mess up, u can have the whole sources.list from here !!

Neways yes u can have an iso as a respository! But y even care when u can have a simple folder on ur hardisk or a pen drive of size like half a Gb or more as a repository??
faraaz
faraaz #23
Aug 19, 2007 at 11:45 PM
@mediator: You tellin me I don't need to burn a CD for your method?? Whoa...tussi great ho!! I'ma going to go try this out...
mediator
mediator #24
Aug 20, 2007 at 12:21 AM
In my opinion, it wud be best if u have it all on hdd or a pen drive as a backup, coz u wud waste ur time in making ISOs also!!
faraaz
faraaz #25
Aug 20, 2007 at 12:59 PM
@mediator: Okay, the uncommenting of the sources.list method worked fine!! I tried your method but it gave errors, saying path couldn't be found...I'm guessing this is more because of my ineptitude...

Ah well, my system works great after a format and re-install, so lets just leave it at that!! I'm going to save this for future reference though! Thanks man.