• 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 in CentOS/RHEL

By admin

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

# mkdir /home/mypackage_dir/repository
# 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:

# vi /etc/yum.repos.d/customrepo.repo
[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

Configuring repository over httpd

If there is a requirement to use the same repository on multiple nodes. Follow the instructions given below on each node where you need to install packages using the repository we just configured.

1. 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

2. Then in a webbrowser access the url http://[node1-ip]/repo. In node 2 configure .repo file as below.

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

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

# yum repolist

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

Some more articles you might also be interested in …

  1. How to Stop Audit Log Entries Written to System Logs in CentOS/RHEL 6
  2. What are “segfault” messages in /var/log/messages file
  3. CentOS / RHEL 5 : How to password-protect single user mode
  4. How to verify the integrity of a file with md5 checksum
  5. How to Transfer a File In Passive Mode by FTP
  6. Unable to Run X Applications Through SSH in Linux
  7. How To Disable Ksplice Service on OEL
  8. How to enable IPv6 on CentOS / RHEL 7
  9. How to resolve the error “-bash: xclock: command not found” in CentOS / RHEL
  10. Linux OS service ‘nfs’

You May Also Like

Primary Sidebar

Recent Posts

  • Basics of client connectivity in Oracle Data Guard configuration
  • ORA-354 ORA-353 and ORA-312: Possible corruption in Online Redo Log File Members in a Redo Log Group
  • How to relocate the redo log files to a different location on disk
  • Oracle Database: Redo log operations (Add/Drop/Change Location)
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary