Symlink Git on cPanel

These days cPanel comes with Git. However, it is not available as a command by default but is instead hidden away in cPanel’s usual obscure location.

However, you can make it accessible using a symlink.

ln -s /usr/local/cpanel/3rdparty/bin/git /usr/local/bin/git

That will allow you to use the git command as normal. The version you get is likely to behind the current version of Git though.

Error resolving hostname on SSH tunnels

Lets say you are trying to create an SSH tunnel.

ssh -L 27017:somehost:27017 you@examplehost.net

You may get the following error message.

ssh: Error resolving hostname \342\200\223L: nodename nor servname provided, or not known

This is caused by using the wrong kind of minus symbol. If you have copied and pasted the command from somewhere, this is probably the case. This is easy to fix – simply paste the command into your terminal, then go through it, remove the existing minus symbol and put a new – in.

Speed up really slow SSH connections

Sometimes, you might find that when you try and SSH into another server, it seems to hang, but then after around 30 seconds or so, will suddenly start working again. You can diagnose where it is stopping by using verbose mode.

ssh -vv user@example-server

If you find it is to do with GSS API, you can disable this in your SSH configuration.

cd ~/.ssh/
vim config

Add the following to it.

GSSAPIAuthentication no

This should then speed the login up.

Screen resolution drop on Ubuntu

If you find your screen resolution suddenly drops too 800×600 on Ubuntu 12.04, the following set of commands may help you resolve it. First, stop the graphical environment.

sudo service lightdm stop

Now remove all the Nvidia packages and reboot the system.

sudo apt-get purge nvidia*
sudo reboot

This will reset you to the default video driver. You now need to reinstall the Nvidia driver, which you can do by going to System settings > Additional Drivers and selecting the top option with the following name.

NVIDIA binary Xorg driver, kernal module and VPDAU library

Select this and click activate. Now reboot your system again and the Nvidia drivers will be re-installed and hopefully working again.

Gnome fails to start after switching Nvidia drivers on Ubuntu

If you’ve tried to switch to a different Nvidia graphics driver on Ubuntu and suddenly found that X / Gnome will no longer load and all you have is a command line, you can fix it by switching back to the original driver.

jockey-text -l
jockey-text -e xorg:nvidia_current

These commands will show you a list of drivers available, and then activate the standard Nvidia driver.

Installing Imagick on Ubuntu 12

To install Imagick, you would normally do this via PECL.

sudo pecl install imagick

However, when trying this on Ubuntu 12.04 LTS, you may get an error similar to the following.

checking ImageMagick MagickWand API configuration program...
configure: error: not found. Please provide a path to MagickWand-config or Wand-config program

You can resolve this by installing a few extra packages.

sudo apt-get install libmagickwand-dev libmagickcore-dev

Now try re-running the original command and it should be successful.

Start services automatically on boot in Gentoo

If you want a service to start automatically when Gentoo boots up, you need to tell Gentoo to start it. Gentoo looks at /etc/runlevels/boot to see what it needs to run, so all you need to do is add a symlink in here to your init.d script. In this example, I’ll use exim.

cd /etc/runlevels/boot
ln -s /etc/init.d/exim exim

Next time Gentoo boots, it will see exim in the boot directory and run the script. This isn’t just limited to boot either – /etc/runlevels also has directories for shutdown and system initialisation.

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.