• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to Create Yum Repository For System Packages Installation in CentOS/RHEL

By admin

A yum repository holds the rpms and metadata about the rpms. A yum repository must be configured in order to use yum on any yum based Linux system. This post provides steps to configure a yum repository for installing packages on CentOS/RHEL systems.

Configuring yum repository server

1. Create a directory for you local repository, e.g. /home/mypackage_dir/repository. Move the RPMs into that directory.

# cp /media/packages/* /home/mypackage_dir/repo

2. Fix some ownership and filesystem permissions:

# chown -R root.root /home/mypackage_dir/repo

3. Install the createrepo package if not installed yet, and run

# createrepo /home/mypackage_dir/repo
# chmod -R o-w+r /home/mypackage_dir/repo

4. Create a repository configuration file, e.g. /etc/yum.repos.d/customrepo.repo containing:

[local]
name=My RPM System Package Repo
baseurl=file:///home/mypackage_dir/repository
enabled=1
gpgcheck=0

5. Install your package using yum command like below, replace package_name with the package you want to install and locate on mypackage_dir/repository:

# yum install package_name
Note: If there is requirement to use same repository on multiple nodes. The below instructions given for patching a DB node with patch channels packages.

6. To use the yum repository configured on node1 on node2 through http url please follow the below instructions.

# yum install httpd
# ln -s /var/www/html/repo /home/mypackage_dir/repo
# service httpd start

Then in a web browser access the URL http://[node1-ip]/repo

Configuring yum Client Server

In node 2 configure .repo file as below.

[node1-repo]
name=My RPM System Package Repo
baseurl=http:///repo
enabled=1
gpgcheck=0

Then run the below command on node2 followed by yum update to update the machine.

# yum repolist
# yum update

Filed Under: CentOS/RHEL 5, CentOS/RHEL 6, CentOS/RHEL 7, Linux

Some more articles you might also be interested in …

  1. CentOS / RHEL 7 : Chrony V/s NTP (Differences Between ntpd and chronyd)
  2. How to get Fibre Channel HBA information from Linux SOSreport
  3. Linux OS Service ‘syslog’
  4. pvcreate Fails With Error: “Device /dev/mapper/mpatha Not Found (or Ignored By Filtering).”
  5. ‘Found duplicate PV’ warnings when using LVM with multipath storage in RHEL/CentOS
  6. How to install and configure sosreport under CentOS / RHEL
  7. CentOS / RHEL 7 : Never run the iptables service and FirewallD service at the same time!
  8. How to Change the VNC Server Resolution in Linux
  9. Beginners guide to vi editor (command line reference)
  10. How to Disable os-prober in CentOS/RHEL 7

You May Also Like

Primary Sidebar

Recent Posts

  • How to disable ICMP redirects on CentOS/RHEL
  • What are Oracle Key Vault Roles
  • What Is Oracle Key Vault
  • Auditing with Oracle Database Vault Reports
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary