Recent Post

Wednesday, January 11, 2012

Creating Local Repository on Ubuntu

Is your computer or laptop connected to the internet??

If yes, you may probably install any linux packages from the Internet or Intranet. Well, now if there is something that we don't expected occurs on our computer such system failed and requires us to reinstall our system. That means we have to redo everything from scratch, from updating our packages list to download the packages needed, and know something about this, it is truly eat much time and anoying (my personal experience, hehehehe :D).

But, there is still one solution that I think can solve the problem, by creating a local repository of packages which already installed on our computer. This method can also be implemented on a other people computer (friends, or relatives) who do not have an internet connection, but have a great willingness to learn linux.

Before we go to the tutorial, there is little information regarding this tutorial.
This tutorial only applies to debian based distro (I have done it in my ubuntu), why? because to create a local list of packages (packages list) in this tutorial, I use dpkg which a package tools from debian and its child.

For debian based distro, any packages that already downloaded with apt-get command or synaptic (GUI), is stored in the cache apt itself, so when the time needed, apt-get does not have to download it again, in consequence it is always eat space to store the packages in our drive.

Okay, because I've done it in my ubuntu so I assume that we will install the new Ubuntu system. Here are the steps:


  1. Backup all packages that already downloaded. Just by copying all files ending in *. deb extention located in the directory '/var /cache/apt/archives' [without quote] to any folder you desire. If it posible, do not copying the packages in the same partitioned with our system where its installed. 
  2. Reinstall the system. After that, move all files *.deb extention that has been previously backed up, into the folder '/home/username/any_folder/', in my computer I moved the files to '/home/andre/repo/'
  3. Install dpkg-dev package. This package is already available in the Ubuntu CD. For those who do not know how, you can use Synaptic Packages Manager. Insert the Ubuntu installation CD. Go to System> Administration> Synaptic Packages Manager. Click on Settings and Repositories. Check the checkbox "Instalable from CD-ROM" and then close. After that, reload it by pressing [Ctrl] + R. If the reading process from the CD-ROM package is complete, locate the package with dpkg-dev name, right click on it, select Mark for installation and then apply.
  4. Create packages list. Open a terminal, type:
    • $ sudo dpkg-scanpackages repo /dev/null | gzip-9c > repo/Packages.gz
  5. Update packages list, so that all packages that we have made and write in to Packages List can be recognized by apt (or Synaptic).
    • $ sudo gedit /etc/apt/sources.list
    • Create a new line in the end of file, then add: deb file: /home/username repo/ (in mine : /home/andre repo/)
    • Then save and close. Still in terminal, apt update with the command
    • $ sudo apt-get update

If those steps above is done correctly, now you should be have your own local repository. Next you can install any packege you desire from this, could be from a terminal or via Synaptic Packages Manager.



Review http://www.computer-issue.blogspot.com on alexa.com

0 comments:

Post a Comment