Sunday, January 22, 2012

Creating Repository in Linux

For ubuntu users, some how due to internet problems they mayn't be able to install packages. Sometimes some packages are not found in synaptic manager that you want to install. Thus normally everyone tries dpkg, but due to dependencies problems it becomes more complex. Hence the apt helps to solve that problems. For that, first-off all you need to save the additional packages (this is for deb packages)  into a directory where every you like.
Open a terminal by pressing Ctrl+Alt+t keys or from the Accessories in the Applications

For setting up repositories, you need to install dpkg-dev, If you haven't installed, then install it by typing ' sudo apt-get install dpkg-dev ' in the terminal. Type your root password if it asks

Now create a directory to keep your packages, where ever you like. For eg:- lets create in your home directory, for that type the following commands in the terminal

you will see that repositories have created. Now move the packages to your created directory ' repositories '. Thus afterwards, enter inside directory through terminal as follows and type the following

Check whether the Packages.gz file is created by typing 'ls' command as above. Now if the Packages.gz is created, then you can proceed, otherwise visit for help. Here, if the dpkg-scanpackages is not installed then try installing it by ' sudo apt-get install dpkg-scanpackages' . The dpkg-scanpackages looks in the directory and writes all details of the packages avialable in the directory thus producing this as the output. Here the output is written to a suitable format that the apt-get update can read, i.e. Packages.gz.
Now take Synaptic Package Manager from the System->Administartion. Type your root password, if it asks. Take the repositories option in the Synaptic Package Manger, i.e Settings->Repositorie. Software Sources window appears, in that take Other Software. Cilck on the Add button below and a small window appears, in that type the location of  your newly created directory. Here repositories folder location is at home so type " deb file : " followed by the loction of the packages and press Add Sources button.
deb file:/home/amith/repositories/ ./

Now untick everything except the newly created Apt line but not the Apt line with source code and now untick everything in the another tabs of Software Source. Atlast close the Software Source window and reload the synaptic package manager. Now enjoy downloading from your synaptic package manger.
Sometimes if your system fails to boot Ubuntu, thus some failure. Then need to install ubuntu again, so at that time you can add your packages which you have installed before. The default path of packages installed by synaptic package manager is
you can copy the packages from these location using the ubuntu live cd if ubuntu fails to start, otherwise copy normally and paste into the directory where ever you like to create repository. Later for updating the Packages.gz file, run the same command after entering inside the directory.
dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz
You can watch its tutorial at the link for more details

No comments:

Post a Comment