If your Redhat server is not connected to the official RHN repositories, you will need to configure your own private repository which you can later use to install packages. The procedure of creating a Redhat repository is quite simple task. In this article we will show you how to create a local file Redhat repository as well as remote HTTP repository.
2. Using Official Redhat DVD as repository
After default installation and without registering your server to official RHN repositories your are left without any chance to install new packages from redhat repository as your repository list will show 0 entries:
At this point the easiest thing to do is to attach your Redhat installation DVD as a local repository. To do that, first make sure that your RHEL DVD is mounted:
The directory which most interests us at the moment is "/media/RHEL_6.4 x86_64 Disc 1/repodata" as this is the directory which contains information about all packages found on this particular DVD disc.
Next we need to define our new repository pointing to "/media/RHEL_6.4 x86_64 Disc 1/" by creating a repository entry in /etc/yum.repos.d/. Create a new file called: /etc/yum.repos.d/RHEL_6.4_Disc.repo using vi editor and insert a following text:
Once file was created your local Redhat DVD repository should be ready to use:
3. Creating a local file Redhat repository
Normally having a Redhat DVD repository will be enough to get you started however, the only disadvantage is that you are not able to alter your repository in any way and thus not able to insert new/updated packages into it. The resolve this issue we can create a local file repository sitting somewhere on the filesystem. To aid us with this plan we will use a createrepo utility.
By default createrepo may not be installed on your system:
No output indicates that this packages is currently not present in your system. If you have followed a previous section on how to attach RHEL official DVD as your system's repository, then to install createrepo package simply execute:
The above command will install createrepo utility along with all prerequisites. In case that you do not have your repository defined yet, you can install createrepo manually:
Using your mounted RedHat DVD first install prerequisites:
followed by the installation of the actual createrepo package:
If all went well you should be able to see createrepo package installed in your system:
At this stage we are ready to create our own Redhat local file repository. Create a new directory called /rhel_repo:
Next, copy all packages from your mounted RHEL DVD to your new directory:
When copy is finished execute createrepo command with a single argument which is your new local repository directory name:
As a last step we will create a new yum repository entry:
Your new repository should now be accessible:
4. Creating a remote HTTP Redhat repository
If you have multiple Redhat servers you may want to create a single Redhat repository accessible by all other servers on the network. For this you will need apache web server. Detailed installation and configuration of Apache web server is beyond the scope of this guide therefore, we assume that your httpd daemon ( Apache webserver ) is already configured. In order to make your new repository accessible via http configure your apache with /rhel_repo/ directory created in previous section as document root directory or simply copy entire directory to: /var/www/html/ ( default document root ).
Then create a new yum repository entry on your client system by creating a new repo configuration file:
with a following content, where my host is a IP address or hostname of your Redhat repository server:
Confirm the correctness of your new repository by:
Creating your own package repository gives you more options on how to manage packages on your Redhat system even without paid RHN subscription. When using a remote HTTP Redhat repository you may also want to configure GPGCHECK as part of your repository to make sure that no packages had been tampered to prior their installation.