Having access to the Linbit repositories is one of the many benefits of gaining your subscription to their Enterprise Support. Using those repositories you will find the packaged binaries for your supported distribution. A quick email to sales@linbit.com will help you understand the structures available. However, if you just want to learn DRBD and their SDS and HA products then having access to the source code means that you can run the latest versions of DRBD without subscription. Of course, this is without support too. Using CentOS 6.5 we are going to look at compiling DRBD-SDS from the source tarballs.
Configuring the Host
We are using CentOS 6.5 as the demo system today. Remember if you are using Ubuntu LTS you can install from the PPA repositories. This was a minimal install and we are not running the latest kernel. As compiling DRBD-SDS involves a new kernel module, we will want to make sure we do update the kernel.
First, we add the Development tools that we need to be able to compile code on out CentOS system.
# yum groupinstall -y "Development tools"
This will add in the tools such as make and the gcc compiler as well as the kernel source files that we need for the kernel module compilation. The source files though for the kernel will be the latest and may not match our kernel. To ensure that the current kernel matches the source we update the kernel.
# yum update -y kernel
If you do need to update the kernel then ensure you reboot the system to the new kernel.
# reboot
Another package that we will add now is the libxslt package. An XML parser that is used to create the documentation.
# yum install -y libxslt
For the DRBD Manage tools to work we will need the following three packages added:
# yum install -y dbus dbus-python pygobject2
Compiling DRBD-SDS
We being are compilation journey with compiling the DRBD Kernel module. We can check for the latest tarball and download it from drbd.org. We use the command line browser for ease of demonstration:
# w3m http://www.drbd.org/en/community/download
The first set of files represents the DRBD Kernel module. Download this to your system. You can then expand the file:
# tar -xzf drbd-9.0.5-1.tar.gz #( or your matching filename)
We move to the directory and compile the code. Make sure that you have booted to the latest kernel and you have the development tools installed.:
# cd drdb-9.0.5-1 # make KDIR=/usr/src/kernels/$(uname -r) # make install
To test that the module is working we can use the following commands:
# modprobe drbd # cat /proc/drbd
The output of cat should show that you have the latest version of DRBD installed, in my case 9.0.5-1.
Compiling DRBD-Utils
Having already compiled the DRBD-SDS kernel modules we can turn out attention to the Utilities. This contains the userland tools and documentation. We again need to download them from the same page as before and then we expand the archive.
# tar -xzf drbd-utils-8.9.9.tar.gz #( or your matching filename)
Similarly to before we move into the directory and start the build process. Ensure that you have the libxslt package installed to compile the documentation.
# cd drbd-utils-8.9.9 # ./configure # make # make install
With the documentation, this may take a few minutes, but not too long.
Compiling DRBD Manage
The final part of this trilogy to download and install drbdmanage. The python based management system that vastly simplifies DRBD and disk management. This is achieved by drbdmanage being able to create the underlying LVM or ZFS block devices as well as manage DRBD. We do need to make sure we have the required packages installed first.
# yum install -y dbus dbus-python pygobject2
If you needed to install dbus, then we will also need to start and enable the service.
# service messagebus start # chkconfig --add messagebus
We can then download the source from the website as before.
# tar -xzf drbdmanage-0.98.2.tar.gz # cd drbdmanage-0.98.2 # ./setup.py build# ./setup.py install
You notice here that we use a Python script rather than the normal make compile.
We can test the install with the following command:
# drbdmanage ping
You should see the output pong on your screen. The video steps you through the process.