View Single Post
Old 18-08-2007, 12:47 PM   #19 (permalink)
mediator
String Phreak
 
mediator's Avatar
 
Join Date: Mar 2005
Location: In ur Evil Mind!
Posts: 2,457
Default Re: Package management through Live-CD

@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 on target ubuntu machine 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 http://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 "http://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"!!
__________________
Bad Bad server.....No candy for u!
mediator is offline