Blog tvlooy

Installing PhpStorm on Ubuntu

PhpStorm, Linux | February 10, 2012

This is about how to install PhpStorm 3.0.2 on Ubuntu 11.10 with Oracle JRE 1.7.0. The reason for this is that PhpStorm doen’t like the OpenJDK for some reason and Ubuntu doesn’t have the Oracle JRE inside it’s repositories anymore (Oracle being a jerk). Some manual work is required which may discourage beginners. The steps below show that it’s not that hard to configure at all.

Downloads

A 30 day trial of PhpStorm can be downloaded at the JetBrains website. The next thing you need to download is the Oracle JRE, get it from their website.

Extract

When you have both PhpStorm-3.0.2.tar.gz and jre-7u2-linux-x64.tar.gz in your ~/Downloads folder, you can extract them. I keep tool installations in my ~/Documents/tools and things like the JRE in /opt. I extracted them like this:

$ tar xzvf ~/Downloads/PhpStorm-3.0.2.tar.gz -C ~/Documents/tools $ sudo mkdir /opt/java $ sudo tar xzvf ~/Downloads/jre-7u2-linux-x64.tar.gz -C /opt/java

Oracle JRE as default

Next up, I added the Oracle JRE as an alternative option in Ubuntu. The second commands sets the Oracle JRE as default selection. For the last command, you can also use sudo update-alternatives --config java and manually select one. You can also use that last command if you want to switch back to OpenJDK as the default.

$ sudo update-alternatives --install "/usr/bin/java" "java" "/opt/java/jre1.7.0_02/bin/java" 1 $ sudo update-alternatives --set java /opt/java/jre1.7.0_02/bin/java

PhpStorm in Unity launcher

For some crazy reason, it seems impossible to just add your own launchers to the Unity launcher menu. Whatever reason, just apt-get install alacarte and run alacarte from your terminal. Here you can add a new item for PhpStorm. The icon (webide.png) and launcher (phpstorm.sh) are both in your ~/Documents/tools/PhpStorm-111.296/bin folder.

Then open the Ubuntu "dash home" thing (press windows key) and type "PhpStorm". Drag that icon to your Unity launcher menu. I for one hope that Canonical improved this in the 12.04 LTS release.