But to access the public YUM repository, your server must have internet access.
Maybe you want to limit your internet traffic or you want to shield your servers from the internet.
There's a solution for this:
You configure one server which is connected to 2 VLAN's:
* a public VLAN which has public internet access
* a private VLAN which is connected as well to the other Oracle Linux VM's in your network.
This server will be configured as local yum repository machine.
Repository
Execute these steps to set up this server machine.
# yum install yum-utils createrepo
# mkdir -p /yum/OL6
# mkdir -p /yum/logs
# mkdir -p /yum/scripts
# reposync --newest-only --repoid=public_ol6_latest --repoid=public_ol6_UEK_latest --repoid=public_ol6_UEKR3_latest -p /yum/ol6
# createrepo /yum/ol6/public_ol6_latest/getPackage/
# createrepo /yum/ol6/public_ol6_UEK_latest/getPackage/
# createrepo /yum/ol6/public_ol6_UEKR3_latest/getPackage/
The repo commands from above can be implemented as well in a "repo sync" script that can be executed on a frequently base.
HTTP Server
The repository will be presented through a web server to all the clients.
# yum install httpd
# service httpd start
# chkconfig httpd on
# mkdir -p /var/www/html/repo/OracleLinux/OL6/latest
# ln -s /yum/ol6/public_ol6_latest/getPackage/ /var/www/html/repo/OracleLinux/OL6/latest/x86_64
# mkdir -p /var/www/html/repo/OracleLinux/OL6/UEK/latest
# ln -s /yum/ol6/public_ol6_UEK_latest/getPackage/ /var/www/html/repo/OracleLinux/OL6/UEK/latest/x86_64
# mkdir -p /var/www/html/repo/OracleLinux/OL6/UEKR3/latest
# ln -s /yum/ol6/public_ol6_UEKR3_latest/getPackage/ /var/www/html/repo/OracleLinux/OL6/UEKR3/latest/x86_64
RPM-GPG-KEY File
The RPM-GPG-KEY file must be downloaded as well from the public repository.
# cd /var/www/html/
# wget --quiet http://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol6
# ls RPM-GPG-KEY-oracle-ol6
RPM-GPG-KEY-oracle-ol6
Client-Side Yum Configuration File
Delete the public yum config file of disable all the repositories in this file.
Create a local yum config file that points to your new yum repository:
# cd /etc/yum.repos.d/
# ls
public-yum-ol6.repo
# more local-yum-ol6.repo
[local_ol6_latest]
name=Oracle Linux $releasever Latest ($basearch)
baseurl=http://mylocalyumserver/repo/OracleLinux/OL6/latest/$basearch/
gpgkey=http://mylocalyumserver/RPM-GPG-KEY-oracle-ol6
gpgcheck=1
enabled=1
[local_ol6_UEK_latest]
name=Latest Unbreakable Enterprise Kernel for Oracle Linux $releasever ($basearch)
baseurl=http://mylocalyumserver/repo/OracleLinux/OL6/UEK/latest/$basearch/
gpgkey=http://mylocalyumserver/RPM-GPG-KEY-oracle-ol6
gpgcheck=1
enabled=1
[local_ol6_UEKR3_latest]
name=Latest Unbreakable Enterprise Kernel for Oracle Linux $releasever ($basearch)
baseurl=http://mylocalyumserver/repo/OracleLinux/OL6/UEKR3/latest/$basearch/
gpgkey=http://mylocalyumserver/RPM-GPG-KEY-oracle-ol6
gpgcheck=1
enabled=1
Now, on the client server OL6 machines, the "yum install ..." or "yum update" and other commands will point to the local yum repository.