WordPress Reflection Theme plus YAPB and Watermark Plugin

One of my clients required a photo blog created in no time so I decided to go with WordPress and YAPB plugin.

I will not tell you how to install WordPress (2.8.6 atm) since it’s pretty straight forward and there are many sites that provide such info.

Adding themes and plugins to WordPress is pretty easy, just unpack the themes in wp-content/themes and plugins in wp-content/plugins. No big deal.

After installing both YAPB and Reflection theme go to your Admin Dashboard at Appearance / Themes and activate Reflection. Also make sure you visit Plugins and you activate Yet Another PhotoBlog.

There is not much to customize after you are done installing and activating the theme and plugin. Just go to Settings / YAPB and uncheck everything at Automatic Image Insertion or you will get some weird results(double picture showing in Reflection photo blog).

Of course the client also wanted watermark on all his precious photos. So I found this plugin called Marekki’s Watermark. Just download it and unpack in the plugins directory of the blog. As usual go to Admin Dashboard and activate it from Plugins. You have a few settings for it, no doubt you can figure on your own what they do.

Because of the YAPB plugin of course the installation instructions for watermark plugin didn’t work. Instead of changing the file they recommend just go to wp-content/plugins/yet-another-photoblog/lib and edit the file “Yapb.class.php”. Look for a line containing:

 $image = new YapbImage(null, $post_id, $uri);

and add before it this line:

 MM_Execute_WM(ABSPATH . $uri,'');

Voila, you have a cool looking photo blog and all the pictures you upload to it have a watermark. All in less than half an hour which is very nice!

If you are really interested in seeing the blog you can check the result here: Photo Revolution.

Postfixadmin errors executing /usr/local/bin/postfixadmin-*

If you have followed the tutorials on howtoforge to install Postfixadmin and Postfix + CourierIMAP + Maildrop on a CentOS server for virtual domains you may have stumbled upon this problem when trying to add a new mailbox for a virtual domain:

[DATE] [error] [client XX.XX.XX.XX] Running sudo -u vmail /usr/local/bin/postfixadmin-mailbox-postcreation.sh 'user@domain.tld' 'domain.tld' 'domain.tld/user/' '0' yielded return value=1, first line of output=, referer: http://server/postfixadmin/create-mailbox.php?domain=domain.tld

Above this error message you may or you may have not noticed(like I did) this error message:

sudo: sorry, you must have a tty to run sudo

The solution is simple, just run visudo and comment the line containing:

Defaults    requiretty

Hope it will help someone!

ISPConfig3: Updating to myDNS-ng

If you have followed the tutorials “the perfect setup” for installing ISPConfig 3 chances are that you have an older myDNS version (1.1.0 or so). Since I had a few problems with that version I decided to update to myDNS-ng, the latest version.

In this article I will refer to rpmbuilder user, a user I create to compile and/or make RPMs. For more information on how to set it up check this link.

Also the instructions are for CentOs 5.4(but will probably work for any other 5.x version).

su - rpmbuilder
cd /tmp
wget http://downloads.sourceforge.net/project/mydns-ng/mydns/
tar zxvf mydns-
cd mydns-1.2.8

Everything should be ok untill now. I had no problems to compile it. Then I decided to use checkinstall.

sudo yum install checkinstall

It will ask you a few questions, answer them and you should have a rpm package in /usr/src/redhat/RPMS. It will tell you anyway where he created the rpm.
After that I removed the old mydns packages and installed the new one as root:

service mydns stop
yum remove mydns mydns-mysql
yum install /usr/src/redhat/RPMS/i386/mydns-1.2.8-1.i386.rpm --nogpgcheck

After that I needed to create mydns start script:

vi /etc/init.d/mydns
chmod +x /etc/init.d/mydns

I used the script posted by rukus77 on howtoforge. Make sure you read all the comments on that forum (especially the one containing [ -f /usr/sbin/mydns ] || exit 1).
The last step is to run ISPConfig 3 setup:

cd ispconfig3_install/
cd install
php -q update.php

When asked if to reconfigure services answer yes, the rest you can answer no.

That would be all, thanks for reading.

Install Postfix, Courier-IMAP on CentOS 5

Platform: CentOS 5.4 i386
Extra repositories used: utterramblings and rpmforge
You will end up with Postfix 2.6.5, Courier IMAP 4.6.0, authlib 0.62.4 and maildrop 2.2.0

First of all you will need to install gcc++:

yum install gcc-c++ redhat-rpm-config

Create a user to compile packages if you don’t have one already. I used rpmbuilder for the account name.

useradd -m -s /bin/bash rpmbuilder
passwd rpmbuilder

It will need some privileges so type visudo and add this line somewhere (I added it after root):

rpmbuilder ALL=(ALL) ALL

Create the directory structure:

su - rpmbuilder
mkdir $HOME/rpm
mkdir $HOME/rpm/SOURCES
mkdir $HOME/rpm/SPECS
mkdir $HOME/rpm/BUILD
mkdir $HOME/rpm/SRPMS
mkdir $HOME/rpm/RPMS
mkdir $HOME/rpm/RPMS/i386
echo "%_topdir $HOME/rpm" >> $HOME/.rpmmacros

Start downloading the needed courier packages(under the user rpmbuilder):

cd /tmp
wget http://sourceforge.net/projects/courier/files/maildrop/2.2.0/maildrop-2.2.0.tar.bz2/download
wget http://sourceforge.net/projects/courier/files/imap/4.6.0/courier-imap-4.6.0.tar.bz2/download
wget http://sourceforge.net/projects/courier/files/authlib/0.62.4/courier-authlib-0.62.4.tar.bz2/download

These were the latest versions when I wrote the article, feel free to browse sourceforge and get what version you want.
Start building and installing the RPMs:

sudo rpmbuild -ta courier-authlib-0.62.4.tar.bz2
cd $HOME/rpm/RPMS/i386
sudo rpm -ivh courier-authlib-0.62.4-1.i386.rpm courier-authlib-mysql-0.62.4-1.i386.rpm courier-authlib-devel-0.62.4-1.i386.rpm
cd /tmp
rpmbuild -ta courier-imap-4.6.0.tar.bz2
cd $HOME/rpm/RPMS/i386
sudo rpm -ivh courier-imap-4.6.0-1.i386.rpm
cd /tmp
sudo rpmbuild -ta maildrop-2.2.0.tar.bz2
cd $HOME/rpm/RPMS/i386
sudo rpm -ivh maildrop-2.2.0-1.i386.rpm

Done with Courier. Moving to postfix…

Download source RPM from this location:

cd /tmp
wget http://ftp.wl0.org/official/2.6/SRPMS/postfix-2.6.5-1.src.rpm
rpm -ivh postfix-2.6.5-1.src.rpm

I’ve made a few changes to the postfix.spec file (enabled mysql_redhat, vda patch) and also installed the required dependencies:

sudo yum install db4-devel mysql-shared mysql-devel

Building the postfix-2.6.5 rpm:

cd $HOME/rpm/SPECS
rpmbuild -ba postfix.spec

You should have the rpm in $HOME/rpm/BUILD so cd there and type:

sudo rpm -ivh postfix-2.6.5-1.rhel5.i386.rpm

In the end enable required services as root user:

chkconfig --levels 235 courier-authlib on
chkconfig --levels 235 sendmail off
chkconfig --levels 235 postfix on
chkconfig --levels 235 saslauthd on
chkconfig --levels 235 courier-imap on
service sendmail stop
service postfix start
service saslauthd start
service courier-authlib start
service courier-imap start

If everything went ok when telneting on port 25 of localhost you should get something similar to this:

Connected to localhost.localdomain (
Escape character is '^]'.
220 lightbringer.inno-solutions.ro ESMTP Postfix (2.6.5)
ehlo localhost
250-SIZE 10240000
250 DSN

If you already have any of the packages install use rpm -Uvh instead of rpm -ivh.