• 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. cuyo Command Examples in Linux
  2. auditd Command Examples in Linux
  3. ajson – Executes JSONPath on JSON objects (Command Examples)
  4. xz: command not found
  5. How To Limit/Restrict FTP Commands On Vsftpd Services (CentOS/RHEL 6,7)
  6. ctags: Generates an index (or tag) file of language objects found in source files for many popular programming languages
  7. useradd Command Examples in Linux
  8. jobs Command Options In Linux
  9. lvextend command examples in Linux
  10. zypper: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • dig: DNS lookup utility
  • diffstat: Create a histogram from the output of the diff command
  • diffoscope: Compare files, archives, and directories
  • diff-pdf: Tool for comparing two PDFs

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright