We can mount DVDs/partitions using systemd.mount by writing a mount unit file.
Ensure that a RHEL7 DVD is inserted (or attached if using a VM).
Create a mountpoint:
# mkdir /mnt/rhel7dvd
Note that mount units must be named after the mountpoint directories they control. In our case, the mountpoint
/mnt/rhel7dvd has to be configured in the file
mnt-rhel7dvd.mount. The unit file name has to match the mountpoint path.
Here’s the context of the newly created file
[Unit] Description=rhel7dvd [Mount] What=/dev/cdrom Where=/mnt/rhel7dvd [Install] WantedBy=multi-user.target
Reload the systemd daemon and start the unit:
# systemctl daemon-reload # systemctl start mnt-rhel7dvd.mount # systemctl enable mnt-rhel7dvd.mount
Create a Yum repo file
/etc/yum.repos.d/rhel7dvd.repo with the following content:
[dvd] name=rhel7 dvd baseurl=file:///mnt/rhel7dvd enabled=1 gpgcheck=1 gpgkey=file:///mnt/rhel7dvd/RPM-GPG-KEY-redhat-release
# yum clean all && yum repolist Cleaning repos: dvd Cleaning up everything dvd | 4.1 kB 00:00:00 (1/2): dvd/group_gz | 136 kB 00:00:00 (2/2): dvd/primary_db | 3.9 MB 00:00:00 repo id repo name status dvd rhel7 dvd 4,751 repolist: 4,751