Create Local YUM Repository from Systemd Mounted DVD on RHEL 7

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 /etc/systemd/system/mnt-rhel7dvd.mount:




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:

name=rhel7 dvd


# 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

4 thoughts on “Create Local YUM Repository from Systemd Mounted DVD on RHEL 7

  1. Hi Tomas , just wanted to know what is the purpose of using a mount unit file instead of using normal mount command to mount the rhel7 DVD.

Leave a Reply

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