網頁

2013年4月6日 星期六

CentOS 6.3 --- Building and installing DRBD from source (part 2)

Although we can simply install DRBD by using yum, maybe it is another choice to compile DRBD and kernel modules from source due to want to suit the kernel.ScreenHunter_37
Update kernel
Display the current kernel release and hardware platform  by using “uname –rScreenHunter_03by using “yum install kernel-devel” (# 1)
ScreenHunter_05ScreenHunter_06Update the kernel modules by “yum update kernel kernel-devel” next to reboot again.ScreenHunter_42ScreenHunter_43ScreenHunter_44Now the kernel version is from “2.6.32-279.el6.x86_64” to “2.6.32-358.2.1.el6.x86_64ScreenHunter_51
Download and extract DRBD source
Due to wget command doesn’t exist in minimal installation, we have to install this utility by using “yum install wgetScreenHunter_56ScreenHunter_57ScreenHunter_59The console switch to /usr/src and begin to download DRBD source tarballs from LINBIT Open Source Software – drbd by using "wget http://oss.linbit.com/drbd/8.4/drbd-8.4.2.tar.gz "ScreenHunter_60To uncompress DRBD into a directory /usr/src for keeping source code by using “tar zxvf drbd-8.4.2.tar.gzScreenHunter_62ScreenHunter_61
Check build prerequisiteInstall this utility for working C compiler by using “yum install gcc(# 2)ScreenHunter_67ScreenHunter_68ScreenHunter_69Install this utility for scanner(text pattern recongnizer)  generator by using “yum install flex(# 3)ScreenHunter_73ScreenHunter_74ScreenHunter_75 Install this utility for building RPM (or rebuilding SPRM) package by using “yum install rpm-build” (# 4)ScreenHunter_79ScreenHunter_80ScreenHunter_81ScreenHunter_82ScreenHunter_83ScreenHunter_84ScreenHunter_85Install this utility by using “yum install git” (# 5)ScreenHunter_05ScreenHunter_06ScreenHunter_07ScreenHunter_08ScreenHunter_09ScreenHunter_10Install this utility by using “yum install libxml2*” and “yum install libxslt*”  (# 6)
ScreenHunter_23ScreenHunter_24ScreenHunter_26
ScreenHunter_27ScreenHunter_28ScreenHunter_29Install this utility by using “yum install make (# 7)ScreenHunter_07ScreenHunter_04
Build RPM package
Switch to the source directory by using “cd drbd-8.4.2ScreenHunter_63To create the RPM building environment by running the command “mkdir -pv ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}ScreenHunter_31To generate make files by using “./configure”ScreenHunter_32by using “make rpm”ScreenHunter_39ScreenHunter_38ScreenHunter_37ScreenHunter_36ScreenHunter_35ScreenHunter_34ScreenHunter_33by using “make km-rpmScreenHunter_45ScreenHunter_46ScreenHunter_47ScreenHunter_48ScreenHunter_49ScreenHunter_50
Install DRBD
Switch to a RPMS directory by using “cd ~/rpmbuild/RPMS/x86_64” and install drbd package by using “rpm –Uvh drbd-utils-….rpm drbd-km-….rpmScreenHunter_09Load drbd module by using “modprob drbd” and verify whether drbd module is loaded by using "lsmod | grep drbd"ScreenHunter_12
Reference :
(# 1) If no update kernel, RPM build will error when execute the command “make km-rpmScreenHunter_40ScreenHunter_41(# 2) If the system never install gcc package, we will get the following error when execute the command “./configureScreenHunter_65(# 3) If the system never exist flex package, the checking process will fail when execute the command “./configureScreenHunter_72(# 4) If the system never exist rpm-build package, the checking process will fail when execute the command “./configureScreenHunter_76(# 5) If the system never exist git package, the checking process will fail when execute the command “./configureScreenHunter_86(# 6) If the system never exist libxml2 and libxslt package, the checking process will fail when execute the command “./configureScreenHunter_16(# 7) If the system never exist make package, the checking process will fail when execute the command “./configure
ScreenHunter_01

<<< CentOS 6.3 --- Installing pre-built DRBD packages from distribution vendors (part 1)

2013年4月2日 星期二

CentOS 6.3 --- Installing pre-built DRBD packages from distribution vendors (part 1)

Due to DRBD has already merged into Linux 2.6.33 or above, we just only need to install the user land code if the Linux kernel is 2.6.33 or newer. That is the driver code in kernel and the user land code will recommend to use the same version as the kernel component. (# 1)

Due to the package DRBD does exist in the default yum repositories of RHEL 6/CentOS 6, we need to choose an extra package repository for installing DRBD by yum. In the moment, we will point to an extras RPM repository as ELRepo. (# 2)

At first, we have to realize O.S. name、version and information about current kernel by “cat /etc/redhat-release” & "uname -ri”. ScreenHunter_17When understand the related information, we will begin to import the ELRepo public key by “rpm --import http://elrepo.org/RPM-GPG-KEY-elrepo.orgScreenHunter_01To install ELRepo for CentOS-6, we have to execute the command “rpm -Uvh http://elrepo.org/elrepo-release-6-5.el6.elrepo.noarch.rpm” (# 3)ScreenHunter_08So does that we have already added a new yum repository “ELRepo” now.ScreenHunter_20ScreenHunter_02If we also want to use ELRepo mirror system and the package never is installed, we can execute the command “yum install yum-plugin-fastestmirrorScreenHunter_22
Maybe we prefer to keep some packages at the CentOS provided version so that we want to limit these packages don’t be updated by extra repository. For this reason, the package will not be automatically upgraded or installed by ELRepo repository.
To disable ELRepo repository, open the file “/etc/yum.repos.d/repo.repo” and change enabled parameter from 1 to 0
ScreenHunter_24ScreenHunter_25We can search DRBD packages via the command “yum --enablerepo=elrepo search drbd” to realize which version is in the ELRepo repository.ScreenHunter_07To begin to install drbd via ELRepo by the command “yum --enablerepo=elrepo install –y drbd84-utils kmod-drbd84ScreenHunter_08ScreenHunter_09ScreenHunter_12ScreenHunter_14
To view which version of DRBD file is installedScreenHunter_16To know the DRBD kernel moduleScreenHunter_03To realize which the version of the kernel module is installedScreenHunter_02
Of course, we have to install kernel module package and the related packages for the user land code if the Linux kernel is older than 2.6.33.ScreenHunter_01
Reference :
(# 1) When we refer to the Linux releases with DRBD Official Web Site, we can know its relationship is between Linux releases and DRBD releases now.
Linux-release DRBD-release
2.6.33 8.3.7
2.6.34 8.3.7
2.6.35 8.3.8
2.6.36 8.3.8.1
2.6.37 8.3.9
2.6.38 8.3.9
2.6.39 8.3.10
3.0 ~ 3.4 8.3.11
3.5 ~ 3.7 8.3.13
3.8 8.4.2
(# 2) ELRepo --- RPM repository for Enterprise Linux package
(# 3) If the CentOS host is behind the proxy server and want to use yum with a Proxy Server, we need to configure yum to go through proxy server.
         For a specific user with the default bash shell, we need to add some setting into the user’s shell profile ~/.bash_profile
ScreenHunter_04         If the proxy server doesn’t require the authentication, we need to configure the profile settings as the following environment variable.
ScreenHunter_13         If the proxy server require the authentication, we have to add the following variable including a username and password.ScreenHunter_15
         For all users that connect to the proxy server, we can configure /etc/yum.conf to enable all yum operations to use a proxy server.
ScreenHunter_07
Since 2010 Design by Davidwa
©Copyright Davidwa Inc. All rights reserved.