Jun 152016
 

Add some useful external repositories to install useful third party software packages.

  • install a plugin to add priorities to each installed repositories.
# yum -y install yum-plugin-priorities

set priority=1 to official repository

# sed -i -e "s/\]$/\]\npriority=1/g" /etc/yum.repos.d/CentOS-Base.repo
  • Add EPEL Repository which is provided from Fedora project.
# yum -y install epel-release

set priority=5

# sed -i -e "s/\]$/\]\npriority=5/g" /etc/yum.repos.d/epel.repo

change to enabled=0 and use it only when needed

# sed -i -e "s/enabled=1/enabled=0/g" /etc/yum.repos.d/epel.repo

if enabled=0, input a command to use the repository

# yum --enablerepo=epel install [Package]
  • Add RPMforge Repository which provides many useful packages.
# yum -y install http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm

Download and install DAG’s GPG key for your system.

# wget http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
# rpm --import RPM-GPG-KEY.dag.txt

set priority=10

# sed -i -e "s/\]$/\]\npriority=10/g" /etc/yum.repos.d/rpmforge.repo

change to enabled=0 and use it only when needed

# sed -i -e "s/enabled = 1/enabled = 0/g" /etc/yum.repos.d/rpmforge.repo

if enabled=0, input a command to use the repository

# yum --enablerepo=rpmforge install [Package]
Jun 192011
 

As I’ve been written on my previous post about Maildir Replication using ChironFS in postfix, I will explain step by step it can also be done by using drbd and ocfs2.

Compiling & Installing

note: if your Linux distribution is shipped with a kernel older than 2.6.33 you have to install a kernel module package and packages for the user land code. If your distribution contains a Linux-2.6.33 kernel or newer you only need to install the user land code.

In my case i have my linux distribution older than 2.6.33, so i will also compile drbd kernel module.

Download drbd source and create Binary RPMS packages

$ wget http://oss.linbit.com/drbd/8.3/drbd-8.3.10.tar.gz
$ tar xvzf drbd-8.3.10.tar.gz
$ cd drbd-8.3.10
$ ./configure --enable-spec --with-km
$ cp ../drbd*.tar.gz `rpm -E %_sourcedir`
$ rpmbuild -bb drbd.spec
$ rpmbuild -bb drbd-km.spec
$ sudo rpm -ivh /path/to/RPMS/drbd-*

I’ll be using loop files for this setup since I don’t have access to raw partitions. but if you have raw block device available you can subtitute this part:

resource r0 {
	meta-disk internal;
	device /dev/drbd0;
	disk /dev/loop0;

Into:

resource r0 {
	meta-disk internal;
	device /dev/drbd0;
	disk /dev/sdxx;

sdxx can be sda1, sdb1 sdb2 or what ever your raw disk device called

# dd if=/dev/zero of=/drbd-postfix.img bs=1M count=5000
# losetup /dev/loop0 /drbd-postfix.img

Place this DRBD resource file in /etc/drbd.d/r0.res. Be sure to adjust the server names and IP addresses for your servers.

resource r0 {
	meta-disk internal;
	device /dev/drbd0;
	disk /dev/loop0;

	syncer { rate 1000M; }
        net {
                allow-two-primaries;
                after-sb-0pri discard-zero-changes;
                after-sb-1pri discard-secondary;
                after-sb-2pri disconnect;
        }
	startup { become-primary-on both; }

	on postfix1 { address 192.168.200.18:7789; }
	on postfix2 { address 192.168.200.114:7789; }
}

Continue reading »