Category Archives: Linux

Installing pdftk on RHEL6

A project at work required me to use the Fill PDF module for Drupal. After installation I realized I needed the pdftk package on our VM to leverage the power of the module. Since we have the VM there is no need to use the service option.

Searching for the package with yum did not turn anything up. I did find the package at repoforge.org. We are running a 64bit install so we needed the 64bit RPM. Here are the steps to install.

$wget http://pkgs.repoforge.org/pdftk/pdftk-1.44-2.el6.rf.x86_64.rpm
rpm -K –nosignature pdftk-1.44-2.el6.rf.x86_64.rpm
sudo yum install jre-gcj
sudo rpm -Uvh pdftk-1.44-2.el6.rf.x86_64.rpm
$PATH
which pdftk

First we download the package and check that it a complete package with rpm -K –nosignature command. Then we install the dependency jre-gcj which is a Java Runtime Environment compiler. Next, we install the package using the update -U flag. Run $PATH to list our path and run the which command to verify it is installed in our path.

After that the Fill PDF module detects pdftk is installed and life is good.

RedHat’s documentation on RPMs was fantastic and a big help in making sure this went smoothly.

Drupal APC changes in version 3.1.3p1 for file upload progress.

Many of us use APC for the file upload progress meter in Drupal. Recently, APC expanded what is contained in their apc.ini file rendering the following error message displayed in the Drupal status report rather useless.

“Your server is capable of displaying file upload progress through APC, but it is not enabled. Add apc.rfc1867 = 1 to your php.ini configuration. Alternatively, it is recommended to use PECL uploadprogress, which supports more than one simultaneous upload.”

You can add apc.rfc1867 = 1 in your php.ini file, reload Apache, but alas the error message still appears. Somewhere between APC version 3.1.9 and 3.1.3p1 the APC configuration file got much more robust. To find out what version you are running simply run from the command line $php -i | less and then search for apc using /apc.

Anyhow, the fix is really simple.

Navigate to /etc/php.d/apc.ini and go to line 54. Change that line from 0 to 1. You end up with:

apc.rfc1867 = 1

Save the file and reload apache. Voila, no more error. These paths and commands work on Red Hat Enterprise Linux 6 (RHEL6).

Installing xhprof on RedHat 6

After listening to a great session on PHP profiling at the Pacific Northwest Drupal Summit I decided to install it on a dev machine at work. It runs RHEL6 which is a great system, though sometimes it is a bit of an oddity to work with.

Installation is pretty straight forward, do not expect to be able to use PECL to install the package though as phpize is referenced incorrectly in the PECL package, as far as I could find using Google. However, we can compile it from source without much problem.

First go to the location that you install scripts, I chose /usr/local/bin, then you grab the latest copy of xhprof and start making it happen.


cd /usr/bin/local

wget http://pecl.php.net/get/xhprof-0.9.2.tgz

tar zxf xhprof-0.9.2.tgz

We then navigate into the extension directory of xhprof, run phpize, configure, and then use make to compile the extension.


cd /xhprof-0.9.2/extension

phpize

./configure

make

make install

make test

You should see that you passed all 8/8 tests. Then add xhprof to your php.ini file and restart apache.

You want to add the following to your php.ini file, mine is in /etc/php.ini

vi /etc/php.ini

[xhprof]
extension=xhprof.so
xhprof.output_dir="/var/tmp/xhprof"

You need apache to be able to write to the folder you have just named so go create it and change ownership to apache:root.

cd /var/tmp/

mkdir xhprof

chown apache:root xhprof

Then restart apache. apachectl -k graceful

The final step mentioned, but not shown at the excellent writeup on techportal.ibuildings.com/2009/12/01/profiling-with-xhprof is that you need to symlink the xhprof_html folder so that you can access the reports in a browser. Do this by navigating to your web root, mine is at /var/www/html and create a symlink.
ln -s /usr/local/bin/xhprof-0.9.2/xhprof_html xhprof

Enjoy using xhprof with the devel module in Drupal and with your other projects.

AMAHI CHOWN and backups

I just finished setting up an AMAHI server for our home office use. It was a fairly straight setup except for the backup folder creation. Supposedly it creates a folder called backups automatically upon installation, that did not occur for me.

AMAHI runs on Fedora 12 which I found out is a bit different than Ubuntu 7+. You cannot just create folders in the HDA directory because you do not login as root and cannot do so from the GNOME GUI. You must do it from the command line.

This is not all that bad, just a bit of an annoyance because of AMAHI stating that backups work with a clean install. Here is how you do it.

First you must open a terminal, Applications -> System Tools -> Terminal. Or I think you can use Alt-F2 and type gnome-terminal.

Then you login as root su - it will prompt you for the root password, enter that and press the enter/return key.

Now navigate to the HDA directory where backups is supposed to be cd /var/hda/files/

List the folders in the files directory ls go ahead and make the backups directory because it is not there. mkdir backups

Again list the folders but show the permissions ls -l

You will see that the folder backups is not accessible to the average user so you have to change the owner and group using CHOWN.
chown user:group backupswhere user is the Fedora user you are using with AMAHI and the group is what you also setup, most likely users.

Now you can navigate to the directory in Nautilus, right click on the backups folder and change permissions to allow read and write so that backups with Ubuntu Simple Backup and Windows 7 built in utility will work. I am sure you can do that on the command line with chmod as well but I am not the best with that command.

Backups setup this way are working wonderfully and I am very pleased thus far with AMAHI.

Personal Finance – KMyMoney

KMyMoney
KMyMoney Logo

Recently I have been experimenting with personal finance software on Linux. The most popular program seems to be GnuCash. This would have been a good choice for me since I run Ubuntu with a Gnome desktop. I instead have chosen to use KMyMoney. It is packaged with the KDE desktop environment. Installation was fairly trouble free using the Synaptic package manager. Some features, such as help still give me issues, but I am slowly working them out.

The interface reminds me of Microsoft Money from the late 90’s. It is straightforward and besides the annoyance of double-entry bookkeeping, does a good job. I am sure I will end up liking double-entry the more I use it. KMyMoney does a good job of sugar coating the accounting, especially compared to GnuCash. I have been able to get most of my accounts into the program with little trouble. Online banking is not running smoothly with my institutions as of yet. This is not a big deal to me as I am trying to use the software to better see where my money is going. The reporting features of KMyMoney seem really great. After a few months of use I will share some of the reports it generates.

Compared to Money Manager Ex, another personal finance software application I have used, KMyMoney is superior. Though very similar in features, KMyMoney seems to work better and is more intuitive.

Besides my own wish to better examine how I spend my money I am hoping KMyMoney will fulfill my search for good software to use with students. Learning how to balance a check register is an important skill but with the abundance of debit cards not many students carry checkbooks or cash except for lunch money. Familiarizing students with software that allows them to track their spending, manage stock market research, and loans is a new skill-set that I believe will become vital for people in the new economy. New markets are emerging quickly allowing for people to put pockets of money in many different investment vehicles.

As a class project it would be interesting to provide a micro-loan and then track the repayments using software. The students will still learn the computations so they understand what is happening but it may provide additional engagement for students.

If you are running Linux and looking for personal finance software give KMyMoney a whirl.