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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • 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. How to Disable Docker Process and docker0 Interface on CentOS/RHEL
  2. How to Capture More Logs in /var/log/dmesg for CentOS/RHEL
  3. What are /dev/zero and /dev/null files in Linux
  4. How to Identify NIS Authenticated Users
  5. CentOS/RHEL 8: “ACPI MEMORY OR I/O RESET_REG” Server Hung after reboot
  6. Understanding How Umask Controls the Initial File / Directory Permissions in Linux
  7. How to set udev rule for setting the disk permission on ASM disks when using multipath on CentOS/RHEL 6
  8. Linux OS Service ‘named’
  9. Basic vi commands (cheat sheet)
  10. How to change the interface name in CentOS/RHEL 8 using prefixdevname

You May Also Like

Primary Sidebar

Recent Posts

  • vgextend Command Examples in Linux
  • setpci command – configure PCI device
  • db_load command – generate db database
  • bsdtar command – Read and write tape archive files

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright