Package management through Live-CD

Status
Not open for further replies.

faraaz

Evil Genius
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?
 

mehulved

18 Till I Die............
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.
 
OP
faraaz

faraaz

Evil Genius
@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)...
 

praka123

left this forum longback
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.
 

mehulved

18 Till I Die............
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.
 
OP
faraaz

faraaz

Evil Genius
@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...
 

mehulved

18 Till I Die............
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.
 
OP
faraaz

faraaz

Evil Genius
@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

In Pursuit of "Happyness"
@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!
 

praka123

left this forum longback
^while on Ubuntu,who cares for dpkg manual install :rolleyes: there is gdebi(double click install) na? :p
 
OP
faraaz

faraaz

Evil Genius
@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?
 
Last edited:

kalpik

In Pursuit of "Happyness"
^^ When you restore the ISO, just use apt-get to install! (provided you would have to run apt-get update once)
 
OP
faraaz

faraaz

Evil Genius
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

In Pursuit of "Happyness"
You would have to run apt-get update once, online. After that, you can run apt-get install offline too :)
 
OP
faraaz

faraaz

Evil Genius
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

Technomancer
@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"!!
 

mehulved

18 Till I Die............
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.
 
Status
Not open for further replies.
Top Bottom