Home How to create a local yum repo CentOS 6.x / RHEL 6.x
Post
Cancel

How to create a local yum repo CentOS 6.x / RHEL 6.x

This is an early junior System Administrator guide:

This time I will show you how to create a local yum repository that you can use in your environment.

First you need to create a directory to host your local yum repo in.

I have decided to create two directories because I might add several local repositories in the future.

sudo mkdir /repostore
sudo mkdir /repostore/nmap6.40-1

Then move or copy the rpm files that you would like to have in your local yum repository.

Move rpm file
sudo mv nmap-6.40-1.x86_64.rpm /repostore/nmap6.40-1/
Or copy rpm file
sudo cp nmap-6.40-1.x86_64.rpm /repostore/nmap6.40-1/

Now we need to run the command createrepo:

sudo createrepo /repostore/nmap6.40-1
[c-johsor@sesstl168 /]$ sudo createrepo /repostore/nmap6.40-1/
Spawning worker 0 with 1 pkgs
Workers Finished
Gathering worker results

Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete

Now we need to create the yum repo configuration file in the folder /etc/yum.repos.d/

sudo vi /etc/yum.repos.d/nmap-6.40-1.repo
[nmap-6.40-1]
name=Nmap Version 6.1.40-1 Local Repo
baseurl=file:///repostore/
enabled=1
gpgcheck=0

The we install the repo with the command:

sudo yum install nmap-6.40-1
[c-johsor@sesstl168 ~]$ sudo yum install nmap-6.40-1
[sudo] password for c-johsor: 
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: mirror.searchdaimon.com
 * extras: mirror.searchdaimon.com
 * updates: mirror.academica.fi
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package nmap.x86_64 2:6.40-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package        Arch             Version            Repository             Size
================================================================================
Installing:
 nmap           x86_64           2:6.40-1           nmap-6.40-1           4.8 M

Transaction Summary
================================================================================
Install       1 Package(s)

Total download size: 4.8 M
Installed size: 17 M
Is this ok [y/N]:

Press y/Y to continue or n/N to cancel

We continue:

Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : 2:nmap-6.40-1.x86_64                                                                                                                                 1/1 
  Verifying  : 2:nmap-6.40-1.x86_64                                                                                                                                 1/1 

Installed:
  nmap.x86_64 2:6.40-1                                                                                                                                                  

Complete!
[c-johsor@sesstl168 ~]$

Let’s run yum info nmap and check the information about nmap.

[c-johsor@sesstl168 ~]$ yum info nmap-6.40-1
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: ftp.funet.fi
 * extras: ftp.funet.fi
 * updates: ftp.lysator.liu.se
Installed Packages
Name        : nmap
Arch        : x86_64
Epoch       : 2
Version     : 6.40
Release     : 1
Size        : 17 M
Repo        : installed
From repo   : nmap-6.40-1
Summary     : Network exploration tool and security scanner
URL         : http://nmap.org
License     : http://nmap.org/man/man-legal.html
Description : 
            : Nmap ("Network Mapper") is a free and open source utility
            : for network exploration or security auditing. Many systems and
            : network administrators also find it useful for tasks such as
            : network inventory, managing service upgrade schedules, and
            : monitoring host or service uptime. Nmap uses raw IP packets in
            : novel ways to determine what hosts are available on the network,
            : what services (application name and version) those hosts are
            : offering, what operating systems (and OS versions) they are
            : running, what type of packet filters/firewalls are in use, and
            : dozens of other characteristics. It was designed to rapidly scan
            : large networks, but works fine against single hosts. Nmap runs on
            : all major computer operating systems, and both console and
            : graphical versions are available.

[c-johsor@sesstl168 ~]$

Let’s check the version information of nmap to get more details:

[c-johsor@sesstl168 /]$ nmap -version

Nmap version 6.40 ( http://nmap.org )
Platform: x86_64-redhat-linux-gnu
Compiled with: liblua-5.2.2 openssl-0.9.8k nmap-libpcre-7.6 nmap-libpcap-1.2.1 nmap-libdnet-1.12 ipv6
Compiled without:
Available nsock engines: epoll poll select
[c-johsor@sesstl168 /]$

That is the end of the tutorial.

Next you can read about how to use namp by checking out the current nmap tutorials here:<ul class = "posts-by-tag-list">

  • Download latest nmap from nmap.org to use in local repo how to CentOS 6.x / RHEL 6.x
  • How to create a local yum repo CentOS 6.x / RHEL 6.x
  • How to install nmap security scanner for CentOS 6.x / RHEL 6.x
  • How to use nmap to scan the network for live hosts CentOS/RHEL

    </ul>

    Or you can check out more information about yum:<ul class = "posts-by-tag-list">

  • install VirtualBox 5 on CentOS 7 using VirtualBox repository
  • Installation instructions to install Ansible with yum on CentOS 7.x, RHEL 7.x, Fedora 7.x
  • how to use yum through ISA proxy using Active Directory account
  • How to create a local yum repo CentOS 6.x / RHEL 6.x

    </ul>

  • This post is licensed under CC BY 4.0 by the author.