Friday, August 19, 2011

DRBD on RHEL6 with YUM group



Building DRBD for 2.6.32-71.el6.x86_64 kernel

1.mkdir -p /root/rpmbuild/SOURCES/

2.wget http://oss.linbit.com/drbd/8.3/drbd-8.3.10.tar.gz

3.cp drbd-8.3.10.tar.gz /root/rpmbuild/SOURCES/

4.tar -xvf drbd-8.3.10.tar.gz

5.cd drbd-8.3.10

6../configure --with-km --with-distro=redhat --enable-spec

7.rpmbuild -bb drbd.spec

8.rpmbuild -bb drbd-km.spec

9.cd /root/rpmbuild/RPMS/x86_64

10.mkdir /YUM/DiskReplicator

11.cp drbd-* /YUM/DiskReplicator/

12.cd /YUM/DiskReplicator/

13.createrepo . ---> The "." is important


14.vi /etc/yum.repos.d/rhel6-1.repo


[DiskReplicator]
name=rhel6-1 LoadBalancer repo
baseurl=ftp://192.168.8.2/DiskReplicator
enabled=1
gpgcheck=0

15.cd /tmp/ -->To avoid rpm name clash

16.yum install yum-utils

17.yum-groups-manager -n "Disk Replicator" --id=drbd --description="DRBD, packages from ANSIL" --save=comps.xml --mandatory drbd.x86_64 --mandatory drbd-bash-completion.x86_64 --mandatory drbd-heartbeat.x86_64 --mandatory drbd-km-2.6.32_71.el6.x86_64.x86_64 --mandatory drbd-pacemaker.x86_64 --mandatory drbd-udev.x86_64 --mandatory drbd-utils.x86_64 --mandatory drbd-xen.x86_64


18.createrepo -g comps.xml /YUM/DiskReplicator/

19.yum grouplist "Disk Replicator"

20.yum groupinstall "Disk Replicator"

Monday, August 15, 2011

How to Configure YUM in RHEL6

Easy way to create your own repo
1. Put your RHEL6 media on DVD drive
2. Create a partition with size 6GB and mount it as /yum
3. Download the below script to /yum
https://sites.google.com/site/ansilh/rhel6_repo.sh
4. Give execute permission to the downloaded script
5. Please open the file and try to understand it. If you found all safe ,then go to next step
6. Execute it...You will get an RHEL repo accessible through ftp


***Please feel free to comment your experience ***

=======================================

Manual Steps (*Different approach from above script .The repo file not look like usual one)

YouTube Link : http://www.youtube.com/watch?v=scBtTTwLze0
 
1.create a directory to store packages .(Better you create a partition with 5GB size and mount it as /YUM)
mkdir /YUM
2.mount RHEL6 DVD
mount /dev/dvd /mnt
3.go to the mounted directory
cd /mnt/Packages/
4.copy all contents of DVD to /YUM (Note the "." in command )
cp . /YUM/
5.Install createrepo package with dependancies
rpm -ivh deltarpm-**.el6.x86_64.rpm python-deltarpm-**.el6.x86_64.rpm createrepo-**.rpm
6.install FTP server
rpm -ivh vsftpd-2.2.2-6.el6.x86_64.rpm
7.Create repository using
createrepo -g /YUM/HighAvailability/repodata/****-comps-rhel6-HighAvailability.xml –o \
/YUM/HighAvailability/ /YUM/Packages/

createrepo -g /YUM/LoadBalancer/repodata/*****-comps-rhel6-LoadBalancer.xml –o \
 /YUM/LoadBalancer/ /YUM/Packages/

createrepo -g /YUM/ResilientStorage/repodata/****-comps-rhel6-ResilientStorage.xml –o  \
 /YUM/ResilientStorage/ /YUM/Packages/

createrepo -g /YUM/ScalableFileSystem/repodata/****-comps-rhel6-ScalableFileSystem.xml –o \
 /YUM/ScalableFileSystem/ /YUM/Packages/

createrepo -g /YUM/Server/repodata/****-comps-rhel6-Server.xml -o /YUM/Server/ /YUM/Packages/
8.Create a repo file in /etc/yum.repos.d/

The Server id contains the main path to the packages.(bold in [Server] baseurl )

vi /etc/yum.repos.d/rhel6-1.repo
[Server]
name=rhel6-1 Server repo
baseurl=ftp://192.168.8.2/Server
              ftp://192.168.8.2/Packages
enabled=1
gpgcheck=0
[HighAvailability]
name=rhel6-1 HighAvailability repo
baseurl=ftp://192.168.8.2/HighAvailability
enabled=1
gpgcheck=0
[ScalableFileSystem]
name=rhel6-1 ScalableFileSystem repo
baseurl=ftp://192.168.8.2/ScalableFileSystem
enabled=1
gpgcheck=0
[ResilientStorage]
name=rhel6-1 ResilientStorage repo
baseurl=ftp://192.168.8.2/ResilientStorage
enabled=1
gpgcheck=0
[LoadBalancer]
name=rhel6-1 LoadBalancer repo
baseurl=ftp://192.168.8.2/LoadBalancer
enabled=1
gpgcheck=0
9.Edit ftp server configuration file to make /YUM as anonymous root
vi /etc/vsftpd/vsftpd.conf 
anon_root=/YUM
10.Restart ftp service
service vsftpd restart
11.Add a rule in iptables to accept ftp connections in /etc/sysconfig/iptables
vi /etc/sysconfig/iptables
-A INPUT -p tcp -s 192.168.8.0/24 --dport 21 -i eth0 -j ACCEPT

12.Add ip_conntrack_ftp module in /etc/sysconfig/iptables-config which is needs to be added for FTP support[ip_nat_ftp]

vi /etc/sysconfig/iptables-config
IPTABLES_MODULES="ip_conntrack_ftp" 
service iptables restart
13.Install the following packages[both clients and server need these packages] to transfer files
You need to install it from DVD
Follow step 2 and 3 and then
rpm -ivh libedit-2.11-4.20080712cvs.1.el6.x86_64 openssh-clients-5.3p1-20.el6.x86_64 ftp-0.17-51.1.el6.x86_64.rpm
14.transfer yum configuraion files to clients

scp /etc/yum.repos.d/rhel6-1.repo *.*.*.*:/etc/yum.repos.d/
15.Check yum configuratoin

yum grouplist will give you these ouputs

Installed Groups:
E-mail server
FTP server
Available Groups:
Additional Development
Afrikaans Support

...

Enjoy RHEL6 Package Management

I've made a video for easy understanding

http://www.youtube.com/watch?v=scBtTTwLze0

LVM thin provisioning - file system usage and pool usage dosn't match

When I was demonstrating LVM thin provisioning to new batch of campus hires ; they pointed out an important mismatch between thin pool usag...