POKE ME for any consultancy

Tuesday, May 31, 2016

Need to set up yum repository for locally-mounted DVD on Red Hat Enterprise Linux 7

Environment
Red Hat Enterprise Linux 7

Issue
How to set up yum repository to use locally-mounted DVD with Red Hat Enterprise Linux (RHEL) 7
Would like to upgrade server from RHEL 7.x to RHEL 7.y
Have a secure environment that will never be connected to the internet, but still needs to be updated
Way to update the packages on server, with no satellite server and servers disconnected from internet
Offline patches for Red Hat systems
How do I create a local repository in RHEL 7?
Resolution
Please note: If the system is registered to Red Hat Network, yum can be run with the --noplugins option to prevent it from connecting to RHN. The safer option would be to unregister the system to avoid updating to the latest release.

Mount the RHEL 7 installation ISO to a directory like /mnt, e.g.:

Raw
# mount -o loop RHEL7.1.iso /mnt
If you use DVD media , you can mount like below.

Raw
# mount -o loop /dev/sr0  /mnt
Copy the media.repo file from the root of the mounted directory to /etc/yum.repos.d/ and set the permissions to something sane, e.g.:

Raw
# cp /mnt/media.repo /etc/yum.repos.d/rhel7dvd.repo
# chmod 644 /etc/yum.repos.d/rhel7dvd.repo
Edit the new repo file, changing the gpgcheck=0 setting to 1 and adding the following 3 lines

Raw
enabled=1
baseurl=file:///mnt/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
In the end, the new repo file could look like the following (though the mediaid will be different depending on the version of RHEL):

Raw
[InstallMedia]
name=DVD for Red Hat Enterprise Linux 7.1 Server
mediaid=1359576196.686790
metadata_expire=-1
gpgcheck=1
cost=500
enabled=1
baseurl=file:///mnt/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
clear the related caches by yum clean all and subscription-manager clean once

Raw
# yum clean all
# subscription-manager clean
check whether you can get the packages list from the DVD repo

Raw
# yum list --noplugin
if no problem , you wil update

Raw
# yum update --noplugin

Tuesday, May 3, 2016

Install Latest GIT on RHEL 6

So you want to setup a GIT Repository for your developers on RHEL 6/CentOS 6, but notice Red Hat Enterprise Linux 6 contains 1.7.1 in the repositories, which is well behind the current 1.8.3 that is available for GIT at http://git-scm.com.
Well no need to worry, it is easy enough to download and install the latest on a typical RHEL/CentOS installation.
First let’s download all the files that are required for GIT installation:
$ wget http://git-core.googlecode.com/files/git-1.8.3.4.tar.gz
$ wget -O git-manpages-1.8.3.4.tar.gz http://code.google.com/p/git-core/downloads/detail?name=git-manpages-1.8.3.4.tar.gz&can=2&q=
Next, install all required libraries before building GIT:
$ sudo yum install zlib-devel perl-CPAN gettext
Now let’s untar and build and install GIT in the /usr directory:
$ tar xvfz git-1.8.3.4.tar.gz
$ cd git-1.8.3.4
$ ./configure
$ make
$ sudo make prefix=/usr install
$ git --version
git version 1.8.3.4
That’s all you need and now you are ready to configure your repository for access and start developing!
Now if you want to update GIT you can do that using GIT itself:
$ git clone git://git.kernel.org/pub/scm/git/git.git

Basic Git commands

https://www.atlassian.com/git/tutorials/svn-to-git-prepping-your-team-migration/basic-git-commands