Friday, November 13, 2015

How to create the yum repository

Why do we need to create repository?

The purpose of creating a repository is we wants to install offline. If we don't have an internet connection to external, we unable to download package by yum command. This time we can used local repository, in other word, yum install package from local disk. We have to mount it first, and used yum command it will automatic download from the mount place.

Overall it 's a offline install package. I have provided RHEL 6 and RHEL 7.

------------------------------------RHEL7---------------------------------------


1)Create the new directory and mount the RHEL 7 DVD.
# mkdir /rhel7-repo/ 
# mount /dev/cdrom /rhel7-repo/  
# cd  /rhel7-repo/


2)Navigate to /etc/yum.repos.d/ directory.

3) Create a new file with below contents with extension of “.repo” .


# cat unixarena-rhel7.repo
[rhel7_dvd]
gpgcheck = 0
enabled = 1
baseurl = file:///rhel7-repo
name = unixarena-repo

4) After Modify the file, please yum clean it
[root@UnixArena-RHEL7 yum.repos.d]# yum clean all
Loaded plugins: langpacks, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: rhel7_dvd
Cleaning up everything

5)Done

reference: http://www.unixarena.com/2015/04/how-to-create-the-yum-repository-on-rhel-7.html


------------------------------------RHEL6---------------------------------------


1)Create the new directory and mount the RHEL 7 DVD.

# mkdir /dvd/ 
# mount -0 loop /dev/cdrom /dvd
# cd  /dvd/

2)Create a file broexperts.repo  with the following content:
[broexperts]
mediaid=XXXXXX.XXXX   ==> look for mediaid (.diskinfo located in DVD)
name=Local Media Repo
baseurl=file:///dvd/
enabled=1
gpgcheck=0

Find what is our mediaid
#cd /dvd/
#cat .discinfo
xxxxxx.xxx
Red Hat Enterprise Linux 6.0
i386
1
Modify broexperts.repo
# vi /etc/yum.repos.d/broexperts.repo
[broexperts]
mediaid=XXXXXXX.XXXX
name=Local Media Repo
baseurl=file:///dvd/
enabled=1
gpgcheck=0
3. save and exit
reference: https://www.youtube.com/watch?v=NrwDVccKuKw

------------------------------------Let try to see if it work or not---------------------------------------


 yum install httpd

No comments:

Post a Comment