Sunday, November 4, 2007

Create Local Repo From DVD

1. Copy DVD contents to the folder in web server:
a. Preparing the folder, ie: /var/www/ubuntu, by doing $ sudo mkdir -p /var/www/ubuntu
b. Mount the DVD Repo to the /cdrom, $ sudo mount /cdrom
c. Copying the DVD Content to /var/www/ubuntu using rsync, $ sudo rsync -avx --progress /cdrom/. /var/www/ubuntu/.
d. Do (b) and (c) for all of your dvd repos.

2. Combine divided repo (ie: Gutsy)
a. Enter dvd repo #1, then mount it: $ sudo mount /cdrom
b. $sudo cp /cdrom/dists/gutsy/main/binary-i386/Packages /var/www/ubuntu/dists/gutsy/main/binary-i386/
c. eject the /cdrom, then do for dcd repo #2 $ sudo mount /cdrom
d. cat /cdrom/dists/gutsy/main/binary-i386/Packages >> /var/www/ubuntu/dists/gutsy/main/binary-i386/
should peemission denied, try: (don't forget to change back to 644)
$ sudo chmod 666
/var/www/ubuntu/dists/gutsy/main/binary-i386/
e. recreate the Packages.gz and Packages.bz
$ cd /var/www/ubuntu/dists/gutsy/main/binary-i386/
$ sudo rm Packages.gz Packages.bz2
$ sudo gzip -9 -c Packages > Packages.gz
$ sudo bzip2 -9 -c Packages > Packages.bz2
f. repeat for dvd #3, #4 and #5 for universe libraries.

3. That's all, you can activate it by adding:

deb http://[your-server-address]/ubuntu gutsy main restricted universe multiverse

2 comments:

satrio said...

sir... what's the diffrent copying using 'rsync' and the reguler 'cp' command?

Daniel Adinugroho said...

we can see rsync as the super power special case of cp. When using cp, we copy based on the file path while rsync will skip if the file has the same timestamp and replace it if the timestamp of the source file is newer.