Install Go Server on CentOS with OpenJDK

If you’re trying to install ThoughtWorks’ Go Server on CentOS (or indeed any Linux variety), you might run into a problem where it says you need JDK installed. Indeed, even if you have OpenJDK installed it may continue to complain.

This is because they have not officially approved OpenJDK yet, so your two options are to a) installed the actual JDK or b) to install OpenJDK to at least the version required (1.6 at time of writing) and then force the installer to ignore dependences. This can be done using the following command.

rpm -i --nodeps go-server.rpm

Providing you already have OpenJDK installed, this should work fine.

Installing Mongo PHP driver on CentOS 6 cPanel

Once again, the PECL installer. In order to get the Mongo driver for PHP working, you need to install it manually.

mkdir mongo
cd mongo
wget https://github.com/mongodb/mongo-php-driver/zipball/master
unzip master
cd mongodb-mongo-php-driver-df8b217
phpize
./configure
make install

Add the extension to your php.ini file.

extension=mongo.so

Restart Apache, and Mongo should appear inf your phpinfo() output.

Install Memcache on CentOS 6 cPanel

Here is how to install Memcache for PHP on a CentOS 6 cPanel / WHM box. Some of the guides suggest that you need libevent (well, you do need libevent), though when I tried it, I already had it installed. But if you need it, yum will sort you out.

yum install libevent

Next, install memcache itself. Note that the package is called memcached.

yum install memcached

Of course, just installing it doesn’t mean that the daemon is running. So don’t forget to start it too!

/etc/init.d/memcached start

Finally, we need to add the PHP extension. Beware that the PECL installer on WHM won’t work! So you need to compile it manually from source. That isn’t too difficult though.

wget http://pecl.php.net/get/memcache
tar zxvf memcache
cd memcache-3.0.6
phpize
./configure
make
make install

And add the extension to your php.ini.

extension=memcache.so

Now restart Apache and a memcache section should appear in your PHP info.

Converting CVS to Git, with branches

There are quite a number of tools to convert a CVS repository to a Git repository out there. However, most of them don’t seem to be able to copy over the branches properly. A work around is to convert it to Mercurial first, then convert it to Git.

In this example I’m using a repository called RedDog.

First, we need to get Mercurial on the system.

yum install mercurial

Next we need to add the convert extension to the .hrc file. This might be a global file, or might be in your home directory, can’t quite remember.

[extensions]
hgext.convert=

Check out from CVS and convert to Mercurial.

cvs checkout RedDog
hg convert RedDog

This will create a Mercurial repository called RedDog-hg. Now we need to get hold of Fast Export.

git clone git://repo.or.cz/fast-export.git

Once we have the software we can initialise a new Git repository that we’re going to use and then CD into the folder.

git init RedDog-git
cd RedDog-git

Run the Fast Export tool, specifying the location of the Mercurial repository.

../fast-export/hg-fast-export.sh -r ../RedDog-hg

This will migrate everything into your new Git repository. If you run an ls -a you should see the .git folder, which you may want to rename to RedDog.git (something.git locations are actually just .git directories).

You may optionally also want to do a check out into that folder.

git checkout HEAD

However, you don’t have to – you can begin using it remotely without doing a local checkout.

Install APD on CentOS 5

Here is how to install APD (Advanced PHP Debugger) on CentOS 5. Lets start by creating a directory for it to log files to.

cd /tmp
mkdir apd
chown apache:apache apd

We need to remove ioncube, or it will cause errors.

rpm -e php-ioncube-loader

Now we can install APD, via PECL.

pecl install apd

Add the following to php.ini.

[apd]
zend_extension=/usr/lib64/php/modules/apd.so
apd.dumpdir=/tmp/apd
apd.statement_tracing=0

My PHP binary was in a different location, so I had to alter the script too.

cd /usr/bin/
vim pprofp

Change /usr/local/bin to /usr/bin and save the file.

You also need to ensure PEAR is in your include path (/usr/share/pear) for the script to work.

Installing GCC 4.4 on CentOS 5

If you’re running CentOS, you may find yourself frustrated that you have GCC 4.2 or older, when you need to be running at least 4.3 for some features – for example, if you want to compile HipHop for PHP.

Never fear, you don’t need to compile a compiler from source!

As well as the gcc RPMs in the repository, there are also a set for GCC 4.4, appropriately enough named gcc44 and you can install them in the usual way.

yum install gcc44 g++44

Installing Git on CentOS 5 cPanel

Following on from my previous post about installing Git on CentOS 4, CentOS 5 is a whole different story. This is because you actually can get the RPM for Git on Cent OS – but cPanel doesn’t make it quite easy enough to do it.

You see, cPanel likes to take control of a lot of it’s own stuff, so it has a long list of packages which it won’t update automatically, because it will end up breaking itself if it does. As Git has two dependencies from the Perl libraries, this causes a problem.

But we can easily fix that.

cd /etc/
vim yum.conf

Remove perl* from the exclude line, then save the file. Now you should be able to run the command.

yum install git

It will gather all the dependencies and install Git. Final step, go back into the YUM configuration and put the exclude pack in to protect cPanel from its malevolent self.

vim yum.conf