How to Setup Local Yum Repository from CD-ROM/DVD-ROM image on CentOS 6.2

In this guide, we will delve into the process of updating and installing RPM packages from a CD-ROM/DVD-ROM image on CentOS 6.2. This method proves to be particularly beneficial when dealing with a slow internet connection. By utilizing your local CD/DVD-ROM as a yum repository, you can bypass the need for an internet connection entirely.

We will explore two distinct methods to install and configure a local CentOS 6.2 yum repository. Both methods have been tested and confirmed to work on a CentOS 6.2 Linux server.

You can choose the method that best suits your preferences.

Method 1: Using DVD/ISO

Insert the DVD/ISO into the DVD-Drive.
Mount the ISO from the DVD-ROM into the /mnt directory using the following command:

mount /dev/cdrom /mnt

You should see a message indicating that the block device is write-protected and is mounting as read-only.

Create a text file named centos62.repo in the /etc/yum.repos.d/ directory with the following content:

vi /etc/yum.repos.d/centos62.repo

[CentOS6.2-Repository]
name=DVD-CentOS6.2 repository
baseurl=file:///mnt
enabled=1
gpgcheck=0

You can now start installing, removing, and updating using the yum command. For example, to install httpd, you would use:

yum install httpd -y

Method 2: Using Existing Partition

Check the existing partition on your CentOS 6.2 server using the df command:

df

Create a directory named localrepo in the /mnt directory:

mkdir /mnt/localrepo

Create directories named 1, 2, and 3 in the /mnt/localrepo directory:

mkdir -p /mnt/localrepo/{1,2,3}

Mount the ISO from the DVD-ROM into the /mnt/localrepo/1 directory:

mount -o loop /dev/cdrom /mnt/localrepo/1
df -lh

Create a Temporary repo folder under /tmp to store the required rpm’s packages for the createrepo installation:

mkdir /tmp/repo

Copy the required packagesto install create repo:

cp /mnt/localrepo/1/Packages/createrepo* /tmp/repo
cp /mnt/localrepo/1/Packages/deltarpm* /tmp/repo
cp /mnt/localrepo/1/Packages/libxml2-python* /tmp/repo
cp /mnt/localrepo/1/Packages/python-deltarpm* /tmp/repo

You can verify the copied packages with the ls command:

ls /tmp/repo

Install the rpm packages using the following command:

rpm -ivh /tmp/repo/*

Navigate to the /mnt/localrepo directory:

cd /mnt/localrepo/

Run the createrepo command:

createrepo .

Clean up the repo:

yum clean all

Create a repo config file in the /etc/yum.repos.d/ directory:

vi /etc/yum.repos.d/local.repo

[CentOS6.2-Repository]
name=CentOS6.2 repository
baseurl=file:///mnt/localrepo
enabled=1
gpgcheck=0

Commands Mentioned

  • mount – This command is used to mount a filesystem or storage device.
  • vi – A text editor command used to create or edit files.
  • yum – The package management tool for installing, updating, and removing packages in CentOS.
  • mkdir – This command is used to create directories.
  • cp – The copy command used to copy files from one location to another.
  • rpm – The RPM Package Manager tool for installing, uninstalling, and managing software packages in CentOS.
  • createrepo – This command is used to create a repository of RPM packages.
  • df – The disk filesystem command used to display disk space usage.
  • ls – The list command used to list files and directories.
See also  How to Increase PHP File Upload Size Limit

Conclusion

In this tutorial, we have explored two methods to set up a local yum repository from a CD-ROM/DVD-ROM image on CentOS 6.2. This process is particularly beneficial when dealing with a slow internet connection, as it allows you to bypass the need for an internet connection entirely. Both methods have been tested and confirmed to work on a CentOS 6.2 Linux server, and may also be applicable to other versions of CentOS server.

Remember, understanding the different types of web servers and hosting services is crucial to making the best decisions for your specific needs.

See also  How to Install FTP Client to connect FTP Server on RHEL 6

Whether you’re using Apache, Nginx, or LiteSpeed on a dedicated server, VPS server, cloud hosting, or shared hosting, these methods can help you manage your software packages more efficiently.

We hope this guide has been informative and helpful in setting up your local yum repository.

FAQ

  1. What is the purpose of the yum command?

    The yum command is a package management tool used in CentOS and other RPM-based Linux distributions. It is used to install, update, and remove software packages.

  2. What does the mount command do?

    The mount command is used to mount a filesystem or storage device to a specific directory, making it accessible to the system.

  3. What is the purpose of the createrepo command?

    The createrepo command is used to create a repository of RPM packages. This repository can then be used by package managers like yum for installing software.

  4. What does the df command do?

    The df command, short for disk filesystem, is used to display the amount of disk space used and available on the filesystems in your system.

  5. What is the function of the cp command?

    The cp command, short for copy, is used to copy files and directories from one location to another on a Linux system.

Comments

Leave a Reply

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