How to install Sublime Text editor on Linux and setup Package Control

by hash3liZer . 10 November 2018

How to install Sublime Text editor on Linux and setup Package Control

Considering the options for choosing the most suitable editor for the work, Sublime might be another option for you. It's a great versatile editor, pretty light-weight and cross-platform. What's make's it more awesome is it's various features like Python based plugin api which can be utilized for various purposes.

Officially, sublime 3 makers provide the .tar version of editor which has to be manually extracted and placed somewhere on the system. Another dpkg version, I stumbled upon on another blog might be easy to install but is not an updated version of the editor. Sublime is really easy to install. You just have to place the files under a directory and create a symlink to the launcher.

Sublime also provides documentation for package managers like apt and yum. You can check out their official documentation...

Let's see how easy it is:

STEP 1

Acquiring Sublime Officially...

Open console and download tar file (x64) using wget and extract the files under /opt directory:

$ wget https://download.sublimetext.com/sublime_text_3_build_3176_x64.tar.bz2 -O sublime_3

Now, extract the tar file and move the folder to the /opt directory.

$ tar -xvf 
$ mvĀ sublime_text_3 /opt

You can launch sublime now by tying: 

$ /opt/sublime_text_3/sublime_text

STEP 2

SymLink

Create a shortcut link to file under execution directory: 

$ ln -s /opt/sublime_text_3/sublime_text /usr/bin/sublime

It can directly be launched:

$ sublime

STEP 3

Package Control

Sublime provides a Python api which can be used to integrate various plugins into the editor like installing themes and colors. To install package control, a sample code has been given on packagecontrol.io for both versions 2 and 3 which have to be pasted on the editor console. Press CTRL+` to open the console and copy/paste the following code:

import urllib.request,os,hashlib; h = '6f4c264a24d933ce70df5dedcf1dcaee' + 'ebe013ee18cced0ef93d5f746d80ef60'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by) 

Press Enter. This would take a bit time to install all the packages and editor to return back to it's normal state

The installation of Package Control can be verified by looking for Package Control option under Preferences menu.

STEP 4

Installing Cyanide Theme

Let's try TwilightCyanide theme. Press CTRL+Shift+P to launch the control interface and chose Install Package from the list: 

Look for twilight cyanide theme and press Enter. It would be installed shortly: