8 Setting up a Local Yum Server Using an ISO Image
WARNING:
Oracle Linux 7 is now in Extended Support. See Oracle Linux Extended Support and Oracle Open Source Support Policies for more information.
Migrate applications and data to Oracle Linux 8 or Oracle Linux 9 as soon as possible.
To set up a local yum server (for example, if you have a network of systems that do not have Internet access):
-
Choose one of the systems to be the yum server, and create a local yum repository on it as described in Creating a Local Yum Repository Using an ISO Image.
-
Install the Apache HTTP server from the local yum repository.
sudo yum install httpd
-
If SELinux is enabled in enforcing mode on your system:
-
Use the semanage command to define the default file type of the repository root directory hierarchy as
httpd_sys_content_t
:sudo /usr/sbin/semanage fcontext -a -t httpd_sys_content_t "/var/OSimage(/.*)?"
-
Use the restorecon command to apply the file type to the entire repository.
sudo /sbin/restorecon -R -v /var/OSimage
Note:
The semanage and restorecon commands are provided by the
policycoreutils-python
andpolicycoreutils
packages. -
-
Create a symbolic link in
/var/www/html
that points to the repository:sudo ln -s /var/OSimage /var/www/html/OSimage
-
Edit the HTTP server configuration file,
/etc/httpd/conf/httpd.conf
, as follows:-
Specify the resolvable domain name of the server in the argument to
ServerName
.ServerName server_addr:80
If the server does not have a resolvable domain name, enter its IP address instead.
-
Verify that the setting of the
Options
directive in the<Directory "/var/www/html">
section specifiesIndexes
andFollowSymLinks
to allow you to browse the directory hierarchy, for example:Options Indexes FollowSymLinks
-
Save your changes to the file.
-
-
Start the Apache HTTP server, and configure it to start after a reboot.
sudo systemctl start httpd sudo systemctl enable httpd
-
If you have enabled a firewall on your system, configure it to allow incoming HTTP connection requests on TCP port 80, for example:
sudo firewall-cmd --zone=zone --add-port=80/tcp sudo firewall-cmd --permanent --zone=zone --add-port=80/tcp
-
Disable all existing yum repositories on the server and each client system.
In the
/etc/yum.repos.d
directory, edit any existing repository files and disable all entries by settingenabled=0
. If you have theyum-utils
package installed, as described in Using Yum Utilities to Manage Configuration, you can disable all repositories by running:sudo yum-config-manager --disable \*
-
Edit the repository file on the server (for example,
/etc/yum.repos.d/OL75.repo
):[OL75] name=Oracle Linux 7.5 x86_64 baseurl=http://server_addr/OSimage/OL7.5_x86_64 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY gpgcheck=1 enabled=1
Replace server_addr with the IP address or resolvable host name of the local yum server.
-
On each client, copy the repository file from the server to the
/etc/yum.repos.d
directory. -
On the server and each client, test that you can use yum to access the repository.
sudo yum repolist
Loaded plugins: refresh-packagekit, security ... repo id repo name status OL75 Oracle Linux 7.5 x86_64 5,070 repolist: 5,070