view counter

Oracle Linux Yum Server Setup

Engage the Author Roddy Rodstein Today for your Oracle Project!

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.
 
Copyright © 2012 Mokum Solutions, Inc. All rights reserved.
Distribution of the Oracle Cloud Cookbook or derivative of the work in any form for commercial purposes is prohibited unless prior permission is obtained from the copyright holder.
 
Author: Roddy Rodstein
 
Change Log
Revision
Change Description
Updated By
Date
.9
Beta Release
Roddy Rodstein
07/16/12
1.0 First Release Roddy Rodstein 08/30/12
1.1 Content Refresh Roddy Rodsten 12/29/12
1.2 How to Patch the Oracle Linux Yum Server Operating System Roddy Rodstein 04/23/13
This document applies to Oracle Linux and Red Hat Enterprise Linux 4, 5 and 6, Oracle VM 2 and 3, Exadata and Exalogic.
 
Table of Contents
 
Oracle Linux Yum Server Setup Introduction
This chapter of the Oracle Cloud Cookbook describes how to setup an Oracle Linux yum server. An Oracle Linux yum server can be used to host Oracle Linux, Red Hat Enterprise Linux, Oracle VM, Exadata and Exalogic RPM packages, the latest software patches, updates and fixes. With an Oracle Linux yum server, administrators can centrally manage and install Oracle Linux, Red Hat Enterprise Linux, Oracle VM, Exadata and Exalogic RPM packages and updates locally over your network, not over the internet, using a yum client. An Oracle Linux yum server can also host custom channels with Oracle RPMs and 3rd party RPMs. A custom channel is a RPM repository created by you to host a collection of RPM packages from Oracle or any vendor, i.e. EMC, HP, IBM, Red Hat, Open Source, etc..
 
An Oracle Linux YUM Server can be configured to host Oracle Unbreakable Linux Network RPMs, Oracle public yum server RPMs as well as custom channels. The Oracle Unbreakable Linux Network and the Oracle public yum server are Oracle' cloud repositories for Oracle VM, Oracle Linux, Red Hat Enterprise Linux, Exadata and Exalogic RPMs, software patches, updates and fixes. Access to Unbreakable Linux Network requires an Oracle Single Sign-on account, a valid customer service identifier (CSI) and registration. Access to the Oracle public yum server is open to the public without registration.
 
Table 1 reviews the Oracle Linux yum server components:
Unbreakable Linux Network (ULN)
The Oracle Unbreakable Linux Network is Oracle' cloud repository for Oracle VM, Oracle Linux, Red Hat Enterprise Linux, Exadata and Exalogic RPMs, software patches, updates and fixes. The Oracle Unbreakable Linux Network is part of the Oracle Linux support program.
Oracle Linux Support Oracle Linux is not a licensed Oracle technology product. There are no license fees for Oracle Linux. Oracle offers enterprise support for Oracle Linux on third-party hardware as well as bundled support with Sun hardware. Support for Oracle Linux for third-party hardware is purchased as an add-on component of Oracle’s enterprise support package. Support for Oracle Linux on Sun x64 hardware is bundled with hardware support as an add-on to the Premier Support for Systems package.
Customer Service Identifier A valid Oracle Linux and/or Oracle VM customer service identifier (CSI) is required to access the RPM repositories, software patches, updates and fixes at the Oracle Unbreakable Linux Network. Oracle Linux and/or Oracle VM customer service identifiers (CSIs) are only valid for the Oracle Unbreakable Linux Network, not for My Oracle Support.
Oracle public yum server
The Oracle public yum server is Oracle' public cloud repository for Oracle VM, Oracle Linux and Red Hat Enterprise Linux RPMs, software patches, updates and fixes.
ULN Channel
An Unbreakable Linux Network channel is a collection of RPM packages hosted on Unbreakable Linux Network. The Oracle Unbreakable Linux Network hosts ULN Channels for Oracle Linux, Red Hat Enterprise Linux, Oracle VM, Exadata and Exalogic.
RPM Repository
A RPM repository is a directory on an Apache web server which contains RPM packages.
Yum server A yum server hosts RPM packages for yum clients. The Oracle Unbreakable Linux Network and Oracle public yum servers host Oracle's RPM channels. The RPM channels include the base OS version installation RPM packages along with the latest software patches, updates and fixes. With a local Oracle yum server, Oracle Linux, Red Hat Enterprise Linux, Oracle VM, Exadata and Exalogic hosts can install packages and updates locally over your network, not over the internet, using the yum client. Custom channels can be created with 3rd party RPM packages to install packages and updates from any vendor, i.e. EMC, HP, IBM, Red Hat, Open Source, etc..
Custom Channel
A custom channel is a RPM repository created by the user to host a collection of RPM packages.
Oracle's public yum server allows us to keep Oracle Linux, Red Hat Enterprise Linux, and Oracle VM  system up to date to the latest update version, using the "_latest" RPM repository. The Oracle public yum repository RPMs, patches, updates and erratas do not include Oracle support or any of the benefits of the Oracle Linux Support program.
 
The Oracle Linux Support program offers the following benefits over and above the free Oracle Linux RPM patches, updates and erratas from the Oracle public yum server:
  • Full indemnification against intellectual property claims.  Remember the SCO lawsuits?
  • Use of the Oracle Enterprise Manager 12c Linux Host Patching feature for patch management. Oracle Enterprise Manager 12c Linux Host Patching feature has feature parity with Red Hat Satellite Server.
  • Use of the Oracle Enterprise Manager 12c Virtualization Plug-in for Oracle VM for provisioning, patching, management and monitoring.
  • Access to additional Oracle software channels on the Unbreakable Linux Network (ULN).
  • Patch channels for each Linux update level.
  • The ability to create Support Requests with Oracle' World Class support organization.
The Oracle public yum server latest RPM channel include the base OS version installation RPM packages along with the latest software patches, updates and fixes. Patch jobs using the latest RPM channel update hosts to their respected latest version update with the latest software patches, updates and fixes. A patch job executed on a Oracle Linux 6 host would update the host from 6 to 6U3 with the latest latest software patches, updates and fixes. To keep a host at its respected update level, a valid CSI and the Unbreakable Linux Network is required. With the Unbreakable Linux Network, it is possible to register a host the el*/ol*_base channel along with the el*/ol*_patch RPM channel. When hosts are patched using the el*/ol*_base and el*/ol*_patch RPM channels, the hosts are patched with the latest software patches, updates and fixes from their respected update channel, i.e. 6, 6U1, 6U2 and 6U3.
 
With an Oracle Linux yum Server, Linux, Oracle VM, Exadata and Exalogic hosts can install packages and updates locally over your network, not over the internet, using the yum client. Custom channels can be created with 3rd party RPM packages to install packages and updates from any vendor, i.e. EMC, HP, IBM, Red Hat, Open Source, etc...
 
The following table shows the steps to setup an Oracle Linux Yum Server using the Unbreakable Linux Network.
Step 1
Step 2
Step 3
Step 4
Step 5
Register the Linux host with ULN
Install and Setup Apache
Access ULN, enable YUM, and select RPM channels
Synchronize the Linux Yum server with ULN
Setup Yum clients
The following table shows the steps to setup an Oracle Linux Yum Server using the Oracle public yum repository.
Step 1
Step 2
Step 3
Install and Setup Apache
Synchronize the Linux Yum server with the Oracle public yum repository
Setup Yum clients
The chapter is broken into three sections. The first section reviews how to setup an Oracle Yum server using the Unbreakable Linux Network. The second section reviews how to setup an Oracle Yum server using the Oracle public yum repository. The third section reviews how to setup Linux yum clients.
 

How to Patch the Oracle Linux Yum Server Operating System

Once an Oracle Unbreakable Linux Network yum server has been set-up, RPM installations and updates for the yum server operating system must be done using the --disablerepo=* and --enablerepo= options to ensure that the RPMs originate only from desired RPM channels. Patching a Linux host using the --disablerepo=* option disables all RPM channels, followed by the --enablerepo= option with a list of desired RPM repositories (separated by a single comma) instruct the yum client to only use the RPM channels listed in --enablerepo=. Oracle Unbreakable Linux Network yum servers that are patched without --disablerepo=* and --enablerepo= will use RPMs from all enabled Unbreakable Linux Network RPM channels, which would promptly corrupt the Linux yum server operating system.
 
To list the configured RPM channels from an Oracle Unbreakable Linux Network yum server, type yum repolist or yum repolist -v for verbose. The next example shows the results from yum repolist on an Oracle Linux 6 Unbreakable Linux Network yum server.
 
# yum repolist
Loaded plugins: rhnplugin, security
This system is receiving updates from ULN.
repo id
repo name
status
el5_x86_64_addons
Enterprise Linux 5 Add ons(x86_64)
231
el5_x86_64_latest
Enterprise Linux 5 Latest (x86_64)
21,976
epel
Extra Packages for Enterprise Linux 6 - x86_64
8,615
ol6_x86_64_addons
Oracle Linux 6 Add ons (x86_64)
82
ol6_x86_64_latest
Oracle Linux 6 Latest (x86_64)
21,156
ovm3_x86_64_latest
Oracle VM 3 latest
825
repolist: 52,885
 
 
 
If the “yum update” command was used on the example Oracle Unbreakable Linux Network yum server, the RPM packages from all of the above listed RPM channels would be used for the update, which would promptly corrupt the operating system.
 
The next example shows how to update the above example Oracle Linux 6 hosts only using the ol6_x86_64_latest and el5_x86_64_addons RPM channels.
 
# yum update --disablerepo=* --enablerepo=ol6_x86_64_latest -y
 
The next example shows how to update the above example Oracle Linux 6 hosts only using the ol6_x86_64_latest RPM channel.
 
# yum update --disablerepo=* --enablerepo=ol6_x86_64_latest, el5_x86_64_addons -y
 
Tip: To list the RPM channels from an Oracle Unbreakable Linux Network yum server, type “yum repolist”. Select the desired RPM channels from “yum repolist” and place them after --enablerepo=, i.e. --enablerepo=el5_x86_64_latest,el5_x86_64_addons to install packages from the el5_x86_64_latest and el5_x86_64_addons RPM channels, etc...
 
To search for and install the bind RPM only from the ol6_x86_64_latest RPM channel, use the following --disablerepo=* and --enablerepo= options.
 
To search for the bind RPM from the ol6_x86_64_latest RPM channel:
yum list bind --disablerepo=* --enablerepo=ol6_x86_64_latest
 
To install the bind RPM ol6_x86_64_latest RPM channel:
yum install bind --disablerepo=* --enablerepo=ol6_x86_64_latest
 

Oracle Linux YUM Server Setup with the Unbreakable Linux Network

Register the Oracle Linux Host with the Oracle Unbreakable Linux Network

Step 1
Step 2
Step 3
Step 4
Step 5
Register the Linux host with ULN
Install and Setup Apache
Access ULN, enable YUM, and select RPM channels
Synchronize the Linux Yum server with ULN
Setup Yum clients

Before an Oracle Linux or Red Hat Enterprise Linux host can connect to the Oracle Unbreakable Linux Network, Oracle’s GPG key must be imported using the rpm command. To import the Oracle’s GPG key, as root type “rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY”, as shown in the next example.

Note: Unbreakable Linux Network registration requires an Oracle Single Sign-on account and a valid customer service identifier (CSI). Before registering the yum server, visit the Unbreakable Linux Network, sign in, or create an Oracle Single Sign-on account, then sign in to the Unbreakable Linux Network portal.
 
# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY
 
Tip: If the RPM-GPG-KEY is not in the /etc/pki/rpm-gpg/ directory, locate the file and use the correct path to import the GPG key. For example, as root, type "find / -name RPM-GPG-KEY -print" to locate the RPM-GPG-KEY file.
 
Once the GPG key has been imported, the Linux host can be registered at the Oracle Unbreakable Linux Network from the command line or using a X Windows application. Linux 4 and 5 systems use the up2date command as root to access the registration screen by typing “up2date --register” for X Windows or "up2date --nox --register" for text mode. Linux 6 systems use the "uln_register" command as root to access the registration screen. The registration process requires you to enter your Unbreakable Linux Network associated Oracle Single Sign-on user name and password and a valid Oracle Linux Support Identifier number (CSI).
 
If a proxy server is in the mix, for Oracle Linux 4 and 5 systems, as root type “up2date --configure” to list and edit the up2date program defaults. There are five proxy configurations that can be edited to allow access from your Linux host to the internet. The next example shows the up2date proxy configuration items with their default settings and item numbers.
  • 3. enableProxy        No
  • 4. enableProxyAuth    No
  • 11. httpProxy
  • 21. proxyPassword
  • 22. proxyUser
To edit an up2date program item, type the item number, i.e. enter 3 or 4, etc.... then type C to clear the default value or type q to quit without saving. Next, type the new value and press Enter to save the new value and to exit. If you need to enter multiple values, separate them with semicolons (;).
 
Oracle Linux 6 systems use the “--proxy” option to specify a http proxy, i.e. “# uln_register –proxy=<HOST NAME>:<PORT NUMBER> “. If your proxy server requires authentication, use the “--proxyUser” and “--proxyPassword” to add a username and password, i.e “# uln_register –proxy=<HOST NAME>:<PORT NUMBER> --proxyUser=<USER NAME> --proxyPassword=<PASSWORD>”
 
List 4 shows the six steps to register a Linux host with the Oracle Unbreakable Linux Network:
1.      Review the Unbreakable Linux Privacy Statement
2.      Register a User Account
3.      Register a System Profile—Hardware
4.      Register a System Profile—Packages
5.      Send Profile Information to the Unbreakable Linux Network
6.      Finished Registration
 
The following examples walk through the six steps to register a Linux host with the Oracle Unbreakable Linux Network.
 
Step 1. Review the Unbreakable Linux Privacy Statement
From the Review the Unbreakable Linux Privacy Statement screen use the Alt key to select the Next tab, once the Next tab is selected press the Enter key to proceed.  
 
Figure 1 shows the Review the Unbreakable Linux Privacy Statement screen.
Unbreakable Linux Privacy Statement

Step 2. Register a User Account
On the Register a User Account screen, enter your  your Unbreakable Linux Network associated Oracle Single Sign-on User namePassword, Password confirmation and a valid Oracle VM CSI number. Use the Alt key to select the Next tab, and then press the Enter key to proceed.
 
Figure 2 shows the Register a User Account screen.
Oracle Unbreakable Linux Network Register a User Account
 
Step 3. Register a System Profile—Hardware
On the Register a System Profile—Hardware screen, accept the defaults and use the Alt key to select the Next tab. Once the Next tab is selected, press the Enter key to proceed.
 
Note: The information gathered from the system profile step is saved in your user profile at the Oracle Unbreakable Linux Network. 
 
Figure 3 shows the Register a System Profile—Hardware screen.
Oracle Unbreakable Linux Network Register a System Profile
 
Step 4. Register a System Profile— Packages
On the Register a System Profile—Packages screen, accept the defaults and use the Alt key to select the Next tab. Once the Next tab is selected, press the Enter key to proceed.
 
Figure 4 shows the Register a System Profile—Packages screen.
Oracle Unbreakable Linux Network Register a System Profile
 
Step 5. Send Profile Information to the Unbreakable Linux Network
From the Send Profile Information to the Unbreakable Linux Network screen, accept the defaults and use the Alt key to select the Next tab. Once the Next tab is selected, press the Enter key to proceed.
 
Figure 5 shows the Send Profile Information to the Unbreakable Linux Network screen.
Oracle Unbreakable Linux Network Send Profile Information
 
Step 6 Finished Registration
On the Finished Registration screen, accept the defaults and use the Alt key to select the Next tab. Once the Next tab is selected, press the Enter key to proceed.
 
Figure 6 shows the Finished Registration screen.
Oracle Unbreakable Linux Network Registration Finnshed
 
The Oracle Linux host has been successfully registered.
 

Install and Setup Apache

Step 1
Step 2
Step 3
Step 4
Step 5
Register the Linux host with ULN
Install and Setup Apache
Access ULN, enable YUM, and select RPM channels
Synchronize the Linux Yum server with ULN
Setup Yum clients

Installing Apache from an Unbreakable Linux Network registered Oracle Linux host is accomplished by typing “up2date -i httpd” for 5.x hosts or "yum install httpd" for 6.x hosts while logged in as root.

 
Once Apache is installed, configure Apache to automatically start by typing “chkconfig httpd on”. Next, start Apache by typing “service httpd start”. The next example shows how to install, configure and start Apache.
 
Using up2date, as root type (OL 5.x):
# up2date -i httpd
# chkconfig httpd on && service httpd start
 
Using yum, as root type (OL 5 & 6.x):
# yum install httpd
# chkconfig httpd on && service httpd start
 
Once the “up2date -i httpd”, or "yum install httpd", “chkconfig httpd on” and “service httpd start” commands have completed, test Apache by pointing a web browser to the fully qualified domain name (FQDN) or the IP address of the Apache server. You will see the default Apache test page as shown in Figure 7.
 
Oracle Linux Apache Web Server
 
Tip: If you don’t see the default Apache test page, check if iptables is blocking http traffic on the Apache host. Consider disabling iptables to test Apache by typing “sudo /sbin/service iptables stop”.
 
Next, create the yum repository base directory in /var/www/html by typing "mkdir -p /var/www/html/yum".

Table 2 shows the approximate disk space requirements for the Oracle Unbreakable Linux Network Oracle VM and Linux RPM channels:

RPM Channel
Binaries
el*/ol*_latest
3-10G
el*/ol*_addons
600M
el*/ol*_oracle
1G
el*/ol*_base
3G
el*/ol*_patch
1G
ovm*_latest
500M
ovm*_base
400M
ovm*_patch
100M

Oracle Unbreakable Linux Network Yum Server Setup

Step 1
Step 2
Step 3
Step 4
Step 5
Register the Linux host with ULN
Install and Setup Apache
Access ULN, enable YUM, and select RPM channels
Synchronize the Linux Yum server with ULN
Setup Yum clients
Once your yum server has been registered, and apache has been installed and configured, sign in to Oracle Unbreakable Linux Network and click the Systems tab. From the Systems tab click on the yum server to access its System Details page.
 
Figure 8 shows the Systems tab and the YUM server.
Oracle Unbrekable Linux Network Systems
 
From the YUM servers Systems Details page click the Edit button, as shown in Figure 9.
Oracle Linux YUM Server Configuration Oracle Unbreakable Linux Network
From the Edit Systems Properties page, select the Yum Server check box, enter a valid CSI number, then click the Apply Changes button, as shown in Figure 10.
Oracle Unbreakable Linux Network YUM Server
Next, click the Manage Subscriptions button, as shown in Figure 11.
Oracle Unbreakable Linux Network System Details
 
From the System summary page select the Oracle VM 3 latest channel. Next, click the Save Subscriptions button to save the changes, as shown in Figure 12.
 
Note: A prerequisite to synchronize an Oracle Linux and/or Red Hat Enterprise Linux 5.x yum server with the Oracle Unbreakable Linux Network is the uln-yum-proxy RPM package. To install the uln-yum-proxy RPM, from the Manage Subscriptions page add the Enterprise Linux Add ons (platform) RPM channel. Once the Enterprise Linux Add ons RPM channel has been added, as root, type "up2date -i uln-yum-proxy". The Enterprise Linux Add ons RPM channel can be removed from the Manage Subscriptions page after the uln-yum-proxy RPM is installed.
 
Oracle Unbreakable Linux Network System Summary
 
The yum server has been successfully configured using the Oracle Unbreakable Linux Network dashboard.  The next step is to populated and synchronize the local yum repository with the Oracle Unbreakable Linux Network using the 167283.sh script.
 

Synchronize the Linux Yum Server with Oracle Unbreakable Linux Network

Step 1
Step 2
Step 3
Step 4
Step 5
Register the Linux host with ULN
Install and Setup Apache
Access ULN, enable YUM, and select RPM channels
Synchronize the Linux Yum server with ULN
Setup Yum clients
Local yum repositories are synchronized to the Unbreakable Linux Network using a script (167283.sh) and a cron job, or with Oracle Enterprise Manager. To populate the yum repository using the 167283.sh script, as root type “cd” to change to the /root directory, then “wget http://www.oracle.com/ocom/groups/public/@otn/documents/webcontent/167283.sh to download the 167283.sh script. Next, type “chmod 755 167283.sh” to make the script executable. Then type “nohup sh 167283.sh &” to run the script. Once the 167283.sh script completes, the yum RPM repository will be populated and ready to update or patch Oracle VM Servers.
 
To automatically synchronize your local yum RPM repository to the Unbreakable Linux Network, use a cron job with the 167283.sh script. As root or any other user with access to the 167283.sh script, type "chrontab -e" to edit your crontab file, or create a new crontab file if one does not already exist. The next example shows how to create a crontab file as root that will run the 167283.sh script at midnight every weekday.
 
# crontab -e
0 0 * * 1-5 /root/167283.sh
:wq!

To view the current cronjob on an Oracle Linux host, type "crontab -l". To edit the cronjob type "crontab -e".

Crontab Syntax:
1 2 3 4 5 /path/to/command arg1 arg2
1: Minute (0-59)
   2: Hours (0-23)
       3: Day (0-31)
          4: Month (0-12 [12 == December])
              5: Day of the week(0-7 [7 or 0 == sunday])
                 /path/to/command - Command name or script to schedule
 

Oracle Linux Yum Server Setup using the Oracle Pubic Repository

Install and Setup Apache

Step 1
Step 2
Step 3
Install and configure Apache
Synchronize the Linux Yum server with the Oracle public yum repository
Setup Yum clients
Installing Apache from the Oracle public yum repository is accomplished by typing "cd /etc/yum.repos.d/", then “wget http://public-yum.oracle.com/public-yum-el5.repo” for 5.x hosts or “wget http://public-yum.oracle.com/public-yum-ol6.repo” for 6.x hosts followed by "yum install httpd".
 
Once Apache is installed, configure Apache to automatically start by typing “chkconfig httpd on”. Next, start Apache by typing “service httpd start”. The next example shows how to install, configure and start Apache.
 
Using yum, as root type (Public 5.x):
# cd /etc/yum.repos.d/
# wget http://public-yum.oracle.com/public-yum-el5.repo
# yum install httpd
# chkconfig httpd on && service httpd start
 
Using yum, as root type (Public 6.x):
# cd /etc/yum.repos.d/
# wget http://public-yum.oracle.com/public-yum-ol6.repo
# yum install httpd
# chkconfig httpd on && service httpd start
 
Once the "yum install httpd", “chkconfig httpd on” and “service httpd start” commands have been completed, test Apache by pointing a web browser to the fully qualified domain name (FQDN) or the IP address of the Apache server. You will see the default Apache test page as shown in Figure 13.
 
Oracle Linux Apache Web Server
 
Tip: If you don’t see the default Apache test page, check if iptables is blocking http traffic on the Apache host. Consider disabling iptables to test Apache by typing “sudo /sbin/service iptables stop”.
 
Next, create a the yum repository base directory in /var/www/html by typing "mkdir -p /var/www/html/yum".

Table 3 shows the approximate disk space requirements for Oracle's public Linux and Oracle VM RPM repositories:

RPM Channel
Binaries
el*/ol*_latest
13-19G
el*/ol*_addons
600M
el*/ol*_base
3G
ovm3_latest 500M
 

Synchronize the Oracle linux Yum Server with the Oracle Public Yum Repository

Step 1
Step 2
Step 3
Install and Setup Apache
Synchronize the Linux Yum server with the Oracle public yum repository
Setup Yum clients
Local yum repositories are setup using Oracle's public .repo files, the reposync and createrepo commands along with a cron job to automatically synchronize the local Yum repository to the Oracle public Yum repository.
 
Tip: The reposync and createrepo commands are part of the yum-utils RPM package. If your Oracle Linux Yum server does not have reposync and/or createrepo, install the yum-utils RPM by typing "yum install yum-utils" as the root user.
 
The first step is to download a repo file for each Linux version that your Yum server will support. To download the repo files, as root type the following commands:
 
# cd /etc/yum.repos.d/
# wget http://public-yum.oracle.com/public-yum-el4.repo (Linux 4)
# wget http://public-yum.oracle.com/public-yum-el5.repo (Linux 5)
# wget http://public-yum.oracle.com/public-yum-ol6.repo (Linux 6)
 
For Oracle VM 3, create a repo file on the yum server name "/etc/yum.repos.d/public-yum-ovm3.repo" with the following contents:
 
[ovm3_latest]
name=Oracle VM Server 3 Latest ($basearch)
baseurl=http://public-yum.oracle.com/repo/OracleVM/OVM3/latest/x86_64/
gpgkey=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5
gpgcheck=1
enabled=1
 
Next, using your favorite text editor, edit the repo files and enable each desired RPM repository by changing enabled=0 to enabled=1. To enable a repository change enabled=0 to enabled=1. Note that enabled=0 disableds an RPM repository and enabled=1 enables an RPM repository.
 
Next, check for and if necessary install the yum-utils and createrepo prerequisite RPM packages. As root, type the following commands to check for and if necessary install yum-utils and createrepo.
 
# rpm -q yum-utils createrepo
yum-utils-1.1.16-21.el5
createrepo-0.4.11-3.el5
 
The above example shows a host with the two prerequisite RPM packages. If your host does not have one or both of the prerequisite RPM packages, install the RPMs as shown in the next example.
 
Note: The Yum server must have a .repo file for the Linux OS version to be able to install RPMs from the Oracle public repository, i.e. if the Yum server is Oracle Linux 5, the public-yum-el5.repo file needs to be in the /etc/yum.repos.d/ directoty to install RPM packages.
 
# yum install yum-utils
# yum install createrepo
 
Next, validate the configured RPM repositories by typing "yum repolist -v". If the RPM repositories are listed, you can proceed. If you see errors check the repo file syntax, and/or the Proxy settings. The Proxy settings can be set by typing "export http_proxy=http://<proxy host>:/port". Substitute http://<proxy host>:/port with your specific Proxy details.
 
Next, download the RPMs for the first time using the reposync command. The next example shows how to dowload the el5_latest RPMs.
# reposync -r el5_latest -p /var/www/html/yum/public/
 
The next example shows how to dowload the ol6_latest RPMs to the /var/www/html/yum/public/ directory.
# reposync -r ol6_latest -p /var/www/html/yum/public/
The next example shows how to dowload the ovm3_latest RPMs.
# reposync -r ovm3_latest -p /var/www/html/yum/public/
 
Note: As needed substitute the path, i.e. -p /var/www/html/yum/public/ with the desired path.
 
The reposync command -r switch is used to indicate which repository in the repo file to download. The reposync command -p switch is used to indicate which directory is used for the local repository. Consult resosync's man pages for further deatails by typing "man reposync". 
 

Once the repositories have been populated, create a script to update the repositories and add it to cron to automatically synchronize the local yum RPM repository to Oracle.

 
The next example shows the contents of a script named update-oracle-repo.log located in the /usr/local/bin/ directory that updates the Oracle Linux 5 and 6 latest repositories.
# cat /usr/local/bin/update-oracle-repo.log
reposync -r ol6_latest -p /var/www/html/yum/public/
createrepo /var/www/html/yum/public/el5_latest/getPackage/
reposync -r el5_latest -p /var/www/html/yum/public/
createrepo /var/www/html/yum/public/ol6_latest/getPackage/
 
Next, make the script executable by typing: chmod +x /usr/local/bin/update-oracle-repo.log
 
As root or any other user with access to the script, type "chrontab -e" to edit your crontab file, or create a new crontab file if one does not already exist. The next example shows how to create a crontab file as root that will run the update-oracle-repo.log script at midnight every weekday and log the results to /var/log/update-oracle-repo-result.log.
 
# crontab -e
15 0 * * * /usr/local/bin/update-repository.sh > /var/log/update-oracle-repo-result.log
:wq!

To view the current cronjob on a Oracle Linux host, type "crontab -l". To edit the cronjob type "crontab -e".

Crontab Syntax:
1 2 3 4 5 /path/to/command arg1 arg2
1: Minute (0-59)
   2: Hours (0-23)
       3: Day (0-31)
          4: Month (0-12 [12 == December])
              5: Day of the week(0-7 [7 or 0 == sunday])
                 /path/to/command - Command name or script to schedule
 

Oracle Linux Yum Client Setup

To make a Yum Server available to a Linux or Oracle VM host create a .repo file that points to the Yum Server. On a Linux or Oracle VM host, as root create a file in /etc/yum.repos.d/ directory with the .repo extention, i.e. my-ol5-local-yum-server.repo. The .repo file can have any name as long as it has a .repo extention. In the .repo file add the desired RPM channel connection settings.
 
A yum .repo configuration file can contain one or more sections to define RPM repositories.

Table 4 lists the repository directives.
Directive Description Explanation
baseurl The location of the RPM repository, i.e. file://, ftp://, or http://. This directive is required
enabled If set to 1, enables the RPM repository.
name A descriptive name for the RPM repository. This directive is required

Tip: Consult the yum.conf(5) man page for additional details.

 
The next example shows a .repo file named my-ol5-local-yum-server.repo that points a Linux host to use the el5_latest RPM channel on a Yum server named "<yum_server>". Replace <yum_server> with the IP address or fully qualified domain name (FQDN) of your Yum server.
 
# vi /etc/yum.repos.d/my-ol5-local-yum-server.repo
[el5_latest]
name=Oracle Linux $releasever - $basearch - latest
baseurl=http://<yum_server>/var/www/html/yum/public/el5_latest/getPackage/
gpgcheck=1
enabled=1
 
The next example shows a .repo file named my-ovm3-local-yum-server.repo that points a Oracle VM host to use the ovm3_latest RPM channel on a Yum server named "<yum_server>". Replace <yum_server> with the IP address or fully qualified domain name (FQDN) of your Yum server.
 
# vi /etc/yum.repos.d/my-ovm3-local-yum-server.repo
[ovm3_latest]
name=Oracle VM Server 3 Latest ($basearch)
baseurl=http://<yum_server>/var/www/html/yum/public/ovm_latest/getPackage/
gpgcheck=1
enabled=1
 
The following list shows all of the Oracle public RPM channels that can be added to a Linux host's .repo file. Replace <yum_server> with the IP address or fully qualified domain name (FQDN) of your Yum server.

Oracle Linux 5 .repo File Entries:
[el5_latest]
name=Oracle Linux $releasever - $basearch - latest
baseurl=http://<yum_server>/yum/OracleLinux/OL5/latest/$basearch/
gpgcheck=1
enabled=1

[el5_ga_base]
name=Oracle Linux $releasever GA installation media copy - $basearch - base
baseurl=http://<yum_server>/yum/EnterpriseLinux/EL5/5/base/$basearch/
gpgcheck=1
enabled=0

[el5_u1_base]
name=Enterprise Linux $releasever U1 - $basearch - base
baseurl=http://<yum_server>/yum/EnterpriseLinux/EL5/1/base/$basearch/
gpgcheck=1
enabled=0

[el5_u2_base]
name=Enterprise Linux $releasever U2 - $basearch - base
baseurl=http://<yum_server>/yum/EnterpriseLinux/EL5/2/base/$basearch/
gpgcheck=1
enabled=0

[el5_u3_base]
name=Enterprise Linux $releasever U3 - $basearch - base
baseurl=http://<yum_server>/yum/EnterpriseLinux/EL5/3/base/$basearch/
gpgcheck=1
enabled=0

[el5_u4_base]
name=Enterprise Linux $releasever U4 - $basearch - base
baseurl=http://<yum_server>/yum/EnterpriseLinux/EL5/4/base/$basearch/
gpgcheck=1
enabled=0

[el5_u5_base]
name=Enterprise Linux $releasever U5 - $basearch - base
baseurl=http://<yum_server>/yum/EnterpriseLinux/EL5/5/base/$basearch/
gpgcheck=1
enabled=0

[el5_u6_base]
name=Enterprise Linux $releasever U6 - $basearch - base
baseurl=http://<yum_server>/yum/EnterpriseLinux/EL5/6/base/$basearch/
gpgcheck=1
enabled=0

[el5_u7_base]
name=Enterprise Linux $releasever U7 - $basearch - base
baseurl=http://<yum_server>/yum/EnterpriseLinux/EL5/7/base/$basearch/
gpgcheck=1
enabled=0

[el5_u8_base]
name=Enterprise Linux $releasever U8 - $basearch - base
baseurl=http://<yum_server>/yum/EnterpriseLinux/EL5/8/base/$basearch/
gpgcheck=1
enabled=0

[el5_addons]
name=Enterprise Linux $releasever Add ons ($basearch)
baseurl=http://<yum_server>/yum/EnterpriseLinux/EL5/addons/$basearch/
gpgkey=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5
gpgcheck=1
enabled=0

[el5_oracle_addons]
name=Oracle Software addons for Enterprise Linux $releasever ($basearch)
baseurl=http://<yum_server>/yum/EnterpriseLinux/EL5/oracle_addons/$basearch/
gpgkey=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5
gpgcheck=1
enabled=0

[ol5_UEK_latest]
name=Latest Unbreakable Enterprise Kernel for Oracle Linux $releasever ($basearch)
baseurl=http://<yum_server>/yum/OracleLinux/OL5/UEK/latest/$basearch/
gpgkey=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5
gpgcheck=1
enabled=0

[ol5_UEK_base]
name=Unbreakable Enterprise Kernel for Oracle Linux $releasever ($basearch)
baseurl=http://<yum_server>/yum/OracleLinux/OL5/UEK/base/$basearch/
gpgkey=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5
gpgcheck=1
enabled=0

[el5_unsupported]
name=Productivity Applications for Enterprise Linux $releasever ($basearch)
baseurl=http://<yum_server>/yum/EnterpriseLinux/EL5/unsupported/$basearch/
gpgkey=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5
gpgcheck=1
enabled=0

Oracle Linux 6 .repo File Entries:
[el6_latest]
name=Oracle Linux $releasever - $basearch - latest
baseurl=http://<yum_server>/yum/OracleLinux/OL6/latest/$basearch/
gpgcheck=1
enabled=1

[el6_ga_base]
name=Oracle Linux $releasever GA - $basearch - base
baseurl=http://<yum_server>/yum/OracleLinux/OL6/0/base/$basearch/
gpgcheck=1
enabled=0

[el6_u1_base]
name=Oracle Linux $releasever U1 - $basearch - base
baseurl=http://<yum_server>/yum/OracleLinux/OL6/1/base/$basearch/
gpgcheck=1
enabled=0

[el6_u2_base]
name=Oracle Linux $releasever U2 - $basearch - base
baseurl=http://<yum_server>/yum/OracleLinux/OL6/2/base/$basearch/
gpgcheck=1
enabled=0

[el6_u3_base]
name=Oracle Linux $releasever U3 - $basearch - base
baseurl=http://<yum_server>/yum/OracleLinux/OL6/3/base/$basearch/
gpgcheck=1
enabled=0

[el6_UEK_latest]
name=Latest Unbreakable Enterprise Kernel for Oracle Linux - $basearch - base
baseurl=http://<yum_server>/yum/OracleLinux/OL6/UEK/latest/$basearch/
gpgcheck=1
enabled=1

[el6_UEK_base]
name=Unbreakable Enterprise Kernel for Oracle Linux - $basearch - base
baseurl=http://<yum_server>/yum/OracleLinux/OL6/UEK/base/$basearch/
gpgcheck=1
enabled=0
 
Yum Command Examples – Repository Listing, Install, Uninstall, & Update RPM Packages
Installing, removing, and updating RPM packages is a fundamental Linux lifecycle operation. This section of the Oracle Cloud Cookbook introduces the most frequently used yum commands to query RPM repositories, install, uninstall, & update RPM packages.
 
Linux distributions have one or more package managers. The yum package manager is the default RPM package manager for Red Hat distributions such as Oracle Linux and CentOS. Yum stands for Yellowdog Updater Modified. Yum is a client command for updating RPMs from RPM repositories on yum servers. Yum servers maintain up-to-date RPM header and metadata that point yum clients to RPMs and their RPM dependencies.
 
The yum command requires an argument to specify the action to take. The most commonly used yum commands are:
  • install
  • remove
  • update
  • list
  • search

The install and remove commands work as expected, they install or remove the listed RPM packages. The install, remove and update commands determine what other packages must be installed or removed (dependencies) and presents the details for confirmation. Wildcards can be used in the package names to specify a group of related packages. For example:

# yum install 'foo'
# yum remove 'foo'
# yum update 'foo'
# yum install 'foo fie fo fum'
# yum remove 'foo fie fo fum'
# yum update 'foo fie fo fum'

Repository Listing and Maintenance:
The repolist command with its subcommands queries the RPM repository entries in a yum client's .repo files.
 
The next example shows the output from the "yum repolist enabled" command. The "yum repolist enabled" command lists a yum client's enabled repositories with the status and the number of RPMs.
# yum repolist enabled
Loaded plugins: rhnplugin, security
This system is not registered with ULN.
ULN support will be disabled.
repo id                                             repo name                                                                               status
el5_latest                                       Oracle Linux 5 Latest (x86_64)                                                 4,221
epel                                                Extra Packages for Enterprise Linux 5 - x86_64                       7,194
repolist: 11,415
 
The next example shows the output from the "yum repolist disabled" command. The "yum repolist disabled" command lists a yum client's disabled repositories.
# yum repolist disabled
Loaded plugins: rhnplugin, security
This system is not registered with ULN.
ULN support will be disabled.
repo id                                             repo name                                                                                     
epel-debuginfo                                Extra Packages for Enterprise Linux 5 - x86_64 - Debug                                        
epel-source                                     Extra Packages for Enterprise Linux 5 - x86_64 - Source                                       
epel-testing                                     Extra Packages for Enterprise Linux 5 - Testing - x86_64                                      
epel-testing-debuginfo                   Extra Packages for Enterprise Linux 5 - Testing - x86_64 - Debug                              
epel-testing-source                         Extra Packages for Enterprise Linux 5 - Testing - x86_64 - Source                             
repolist: 0
 
The next example shows the output from the "yum repolist all" command. The "yum repolist all" command lists a yum client's enabled and disabled repositories with the status and the number of RPMs.
# yum repolist all
Loaded plugins: rhnplugin, security
This system is not registered with ULN.
ULN support will be disabled.
repo id                                     repo name                                                                                             status
el5_latest                             Oracle Linux 5 Latest (x86_64)                                                                enabled: 4,221
epel                                      Extra Packages for Enterprise Linux 5 - x86_64                                      enabled: 7,194
epel-debuginfo                     Extra Packages for Enterprise Linux 5 - x86_64 - Debug                        disabled
epel-source                          Extra Packages for Enterprise Linux 5 - x86_64 - Source                        disabled
epel-testing                          Extra Packages for Enterprise Linux 5 - Testing - x86_64                        disabled
epel-testing-debuginfo         Extra Packages for Enterprise Linux 5 - Testing - x86_64 - Debug           disabled
epel-testing-source              Extra Packages for Enterprise Linux 5 - Testing - x86_64 - Source          disabled
repolist: 11,415
 
The "yum repolist -v" command verbosly lists all enabled repositories. The yum repolist -v command is useful to list the details from all configured repositories. The next example shows the output from the "yum repolist -v" command.
# yum repolist -v
Loading "rhnplugin" plugin
Loading "security" plugin
Config time: 0.048
This system is not registered with ULN.
ULN support will be disabled.
Yum Version: 3.2.22
Setting up Package Sacks
pkgsack time: 0.039
Repo-id      : el5_latest
Repo-name    : Oracle Linux 5 Latest (x86_64)
Repo-updated : Fri Oct 26 10:30:15 2012
Repo-pkgs    : 4,221
Repo-size    : 5.3 G
Repo-baseurl : http://192.168.4.13/yum/OracleLinux/OL5/latest/x86_64/
Repo-expire  : 3,600 second(s) (last: Fri Oct 26 16:47:06 2012)

Repo-id      : epel
Repo-name    : Extra Packages for Enterprise Linux 5 - x86_64
Repo-revision: 1351273445
Repo-tags    : binary-x86_64
Repo-updated : Fri Oct 26 10:46:18 2012
Repo-pkgs    : 7,194
Repo-size    : 5.4 G
Repo-mirrors : http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=x86_64
Repo-expire  : 3,600 second(s) (last: Fri Oct 26 16:47:13 2012)

repolist: 11,415
 
Clean the yum cache using yum clean
The yum clean command with its subcommands (clean [ headers | packages | metadata | dbcache | plugins | expire-cache | all) is used to clean the yum cache headers, packages, metadata, dbcache, plugins and expire-cache. The yum clean command with its subcommands is useful to make sure the yum cache is clean. The next example shows how to clean the yum cache.
# yum clean all
Loaded plugins: rhnplugin, security
Cleaning up Everything
 
Rebuild the yum cache using yum makecache
The yum makecache command downloads the metadata for all enabled yum repositories. The yum makecache command is useful to make sure the cache is current.
# yum makecache
Loaded plugins: rhnplugin, security
This system is not registered with ULN.
ULN support will be disabled.
el5_latest                                            | 1.9 kB     00:00
el5_latest/filelists_db                          | 7.1 MB     00:00
el5_latest/other_db                             |  20 MB     00:01
el5_latest/primary_db                         | 6.1 MB     00:00
epel                                                     | 3.7 kB     00:00
epel/filelists_db                                    | 5.5 MB     00:06
epel/updateinfo                                    | 473 kB     00:01
epel/other_db                                       | 2.3 MB     00:03
epel/group_gz                                      | 168 kB     00:00
epel/primary_db                                   | 3.8 MB     00:05
Metadata Cache Created
 
Listing RPM Packages & RPM Groups
List all available RPM packages using yum list
The yum list command without any options lists all of the packages in all configured repositories and all of the installed packages on a Linux host. Note that yum list all and yum list generate the same output. The next example shows how to list all the available packages.
# yum list | less
 
List all the installed RPM packages using yum list installed
The yum list installed command lists all the installed packages on the system. The yum list installed command is equivalent to rpm -qa. The next example shows how to list all the installed packages on the system.
# yum list installed | less
 
Check if a particular RPM package is installed using yum list
The next example shows how to confirm if a package, i.e. ntp, is already installed. Substitute the RPM package name ntp with the name of the RPM package you would like to query.
# yum list ntp
Loaded plugins: rhnplugin, security
This system is not registered with ULN.
ULN support will be disabled.
Installed Packages
ntp.x86_64                     4.2.2p1-15.el5_7.1                      installed
 
List available software groups with yum grouplist
Repositories offer package groups to manage related packages as sets. Many 3rd party repositories add packages to these groups and provide their packages as additional groups. The next example shows how to list all the available RPM package groups.
# yum grouplist
 
List which RPM package a file belong to with yum provides
The "yum provides" command lists which package a file belongs to. For example, to list the name of the package that has the /etc/ntp.conf file, type the following:
# yum provides /etc/ntp.conf
Loaded plugins: rhnplugin, security
This system is not registered with ULN.
ULN support will be disabled.
ntp-4.2.2p1-15.el5_7.1.x86_64 : Synchronizes system time using the Network Time Protocol (NTP).
Repo        : el5_latest
Matched from:
Filename    : /etc/ntp.conf

ntp-4.2.2p1-15.el5_7.1.x86_64 : Synchronizes system time using the Network Time Protocol (NTP).
Repo        : installed
Matched from:
Other       : Provides-match: /etc/ntp.conf
 
Installing, Removing, Updating and Searching RPM Packages & RPM Groups
The yum install <packagename> command installs <packagename> including all of the required dependencies. The next example shows how to install the ntp package. Substitute ntp with the package you would like to install.
# yum install ntp
 
It is possible to install multiple packages by adding the package names to the end of the line.
# yum install foo fie fo fum
 
The yum remove <packagename> command removes <packagename> including all of the required dependencies. The next example shows how to remove the ntp package. Substitute ntp with the package you would like to remove.
# yum remove ntp
 
The yum update <packagename> command updates <packagename> including all of the required dependencies. The next example shows how to update the ntp package. Substitute ntp with the package you would like to update.
# yum update ntp
 
The yum update command updates all of the RPM packages that need to be updated, including all of the required dependencies. The next example shows how to update all of the packages that need to be updated.
# yum update
 
TIp: The -y option can be used to answer yes to all questions. For example, yum update -y would install all packages without having to type "yes".
 
The yum search <search term> command searches the enables repositories for the search term. The next example shows how to search for the ntp package. Substitute ntp with the package you would like to find.
# yum search ntp
 
Tip: Wildcards can be used with the search directive, such as * (match anything) and ? (match any single character).
 
The yum groupinstall 'the group's name enclosed in single quotes' command is used to install package groups. The following example shows how to install, update and remove a package group.
# yum groupinstall 'FTP Server'
# yum groupupdate 'FTP Server'
# yum groupremove 'FTP Server'
 
 
view counter