CentOS: Install Packages Via yum Command Using DVD / CD as Repo

To install packages on CentOS using the yum command with a DVD or CD as the repository, you can follow these steps:

  1. Insert the DVD or CD into the drive.
  2. Mount the DVD or CD by running the following command:
sudo mount /dev/cdrom /media/cdrom

This command assumes that the DVD or CD is mounted on the /dev/cdrom device and will mount it to the /media/cdrom directory.

  1. Create a new repository file in the /etc/yum.repos.d/ directory by running the following command:
sudo vi /etc/yum.repos.d/dvd.repo

This command will create a new file called dvd.repo and open it in the vi text editor.

  1. Add the following lines to the dvd.repo file:
[dvd]
name=DVD Repository
baseurl=file:///media/cdrom
enabled=1
gpgcheck=0

This configuration sets the name of the repository to “DVD Repository”, sets the base URL to the mounted DVD or CD, enables the repository, and disables GPG signature checking.

  1. Save and close the dvd.repo file.
  2. Run the following command to clear the yum cache and reload the repository data:
sudo yum clean all && sudo yum update

This command clears the yum cache and updates the repository data to include the packages on the DVD or CD.

  1. You can now install packages using the yum command as you normally would, for example:
sudo yum install package-name

This command will install the specified package from the DVD or CD repository.

That’s it! You have successfully installed packages on CentOS using the yum command with a DVD or CD as the repository. Remember to unmount the DVD or CD when you’re done by running the following command:

sudo umount /media/cdrom

Leave a Comment