Home » Home » How To Setup RPM and Debian Repository?

This article describes a simple way to create a home made RPM and Debian repository, lets start with setting up RPM local repository first.

How To Setup RPM Repository?

There are four simple steps to set up a RPM repository locally, let us assume that the IP address of the host machine which is going to servers rpm repository over web server is

STEP 1: Install createrepo utility to create the required metadata information of a rpm repository, and install httpd to server the rpm packages over the web server

$ yum install crearerepo httpd -y

STEP 2: Create a directory and run the createrepo command to convert directory into a repository

$ mkdir /opt/rpm-repo

$ createrepo /opt/rpm-repo

ensure that you are running createrepo command whenever you are updating the rpm files in /opt/rpm-repo, the command to update the repo is

$ createrepo –update /opt/rpm-repo

STEP 3: Now lets create a httpd conf file to serve the rpm packages in web server

$ vi /etc/httpd/conf.d/rpm-repo.conf

Listen 8081
<VirtualHost *:8081>
ServerName rpm-repo
ServerAlias rpm-repository
DocumentRoot /opt/rpm-repo
ErrorLog logs/repo.example.com-error_log
CustomLog logs/repo.example.com-access_log common
<Directory “/opt/rpm-repo“>
Options Indexes FollowSymLinks
Order allow,deny
Allow from all

In this configuration all the bold letters which are specified can be configurable according to your choice. Then start the web server

$ /etc/init.d/httpd start

STEP 4: To use the repository in remote machine it is necessary to update the repo file in the same machine, the template is given bellow and again all the bold letters which are specified are configurable based on your environment


How To Setup Debian Repository?

To setup Debian repo we would use apache with the default settings, lets assume that the IP address of the machine is

STEP 1: If you have not installed apache web server use following command to install

$ sudo apt-get install apache2

Navigate your browser to the address of your webserver. If this is your default apache webserver configuration you should see a apache default web page

STEP 2: The location of default apache welcome page is served from /var/www/, run the following command to create a repo directory

$ sudo mkdir -p /var/www/deb-repo

STEP 3: Now lets create a package list and metadata information using dpkg-scanpacjages command, refer the bellow steps

$ cd /var/www/deb-repo

$ sudo dpkg-scanpackages deb-repo /dev/null | gzip -9c > deb-repo/Packages.gz

Great home made local Debian package repository is now ready to use.

STEP 4: To access the Debian repo on remote machine it is necessory to edit the source.list file and update the package list on the machine.

$ sudo echo “deb deb-repo/” >> /etc/apt/sources.list

$ sudo apt-get update

All done, now simply install the package using apt-get tool.Hope the article is informative to you, if you have any queries or suggestions please leave your comment.

Leave a Reply

Your email address will not be published. Required fields are marked *