To install packages on CentOS using the yum
command with a DVD or CD as the repository, you can follow these steps:
- Insert the DVD or CD into the drive.
- 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.
- 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.
- 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.
- Save and close the
dvd.repo
file. - 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.
- 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