How to Install Sublime Text 2 on Ubuntu 14.04

Posted on June 15th, 2014

I recently started using Sublime Text 2 as my text editor in both Windows and Ubuntu 14.04. I've always been a big Notepad++ guy on Windows, and a Geany fan on Linux. But after messing around with Sublime Text 2 for quite awhile, I'm hooked. Here is what you need to do to get it running on your Ubuntu 14.04 machine.

Method 1 - Easiest
As Jeff T points out in the comments below, it is actually quite simple to install Sublime Text 2. Here are the commands:

sudo add-apt-repository ppa:webupd8team/sublime-text-2
sudo apt-get update
sudo apt-get install sublime-text


Method 2

Download and Extract the tar file
First, head over to Sublime's website, and download the tar file for linux. After you have it downloaded, extract it with the following command (yours may vary, depending on the version you downloaded).

# unzip the file
tar xf Sublime\ Text\ 2.0.1\ x64.tar.bz2
You should see a Sublime Text 2 folder after you finish extracting the contents.

Move the extracted contents
After extracting the file, we are going to move it to the /opt directory.

sudo mv Sublime\ Text\ 2 /opt/

Launching from Terminal
Next, we are going to make it so we can simply type "sublime" into the terminal in order to launch it. To do so, run the following command:

sudo ln -s /opt/Sublime\ Text\ 2/sublime_text /usr/bin/sublime

Creating a Launcher in Unity
You may also want to create a launcher for Sublime (these commands are specific to Unity).

# create launcher in Unity
sudo sublime /usr/share/applications/sublime.desktop
Once sublime opens, paste the following content into sublime.desktop

# paste the following content into sublime.desktop
[Desktop Entry]
Version=1.0
Name=Sublime Text 2
GenericName=Text Editor

Exec=sublime
Terminal=false
Icon=/opt/Sublime Text 2/Icon/48x48/sublime_text.png
Type=Application
Categories=TextEditor;IDE;Development
X-Ayatana-Desktop-Shortcuts=NewWindow

[NewWindow Shortcut Group]
Name=New Window
Exec=sublime -n
TargetEnvironment=Unity

Default Text Editor
If you would like to set Sublime Text 2 as your default text editor, run the following command, and replace every instance of gedit.desktop with sublime.desktop.

# You will need to replace every instance of gedit.desktop with sublime.desktop
sudo sublime /usr/share/applications/defaults.list

That's it! You should not only have a luncher available to run Sublime, but you can also launch it via the terminal by just typing "sublime". If you have any questions, feel free to leave them in the comments below!



comments powered by Disqus
Andrew Backes

A Software Engineer living in Milwaukee, WI. Passionate about web/software development, tech, open source, and gaming.