Sublime Text is a cross-platform proprietary text editor used for “code, markup, and prose”. It has often been termed the best code editor for a long time.
Sublime Text has been facing tough competition due to new modern code editors like Visual Studio Code. Despite that, Sublime Text on Linux still has a decent user base.
There are various ways of installing Sublime Text on Linux:
- Download the DEB/RPM file
- Add the repository (for Ubuntu/Debian)
- Use Snap packaging (works for all distributions that support Snap)
- Run the editor in the classic Linux method using its tar file
I’ll show the steps for each method here. You can choose to go with the one you prefer.
Method 1: Install Sublime Text on Ubuntu using the DEB file
Sublime Text provides DEB/RPM files for Ubuntu/Fedora, SUSE, etc. You can go to their official page in Ubuntu and download the DEB installer file.
After downloading, open it in the Ubuntu software center.
Now, you can install sublime text by pressing the install button on Ubuntu Software center.
Or you can use other methods like the GDebi package installer to install the downloaded deb file, which will search and install any necessary dependencies also.
Similarly, you can download and use the RPM file in Fedora/openSUSE systems.
Method 2: Install Sublime Text on Ubuntu using the official repository
Since installation through the DEB file won’t add any repository to your system, you may need to reinstall if a new version is out.
Sublime text officially provides a repository, through which you can install Sublime Text either through the stable channel or the dev channel.
Before starting, make sure that apt is set up to work with HTTPS sources:
sudo apt-get install apt-transport-https
Now open a terminal and use the following command one by one:
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/sublimehq-archive.gpg > /dev/null echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list sudo apt update sudo apt install sublime-text
This will add the Sublime Text repository to your system. Now you are getting Sublime Text directly from the developers. If there is a new version available, your installed version gets updated along with the system updates.
You can visit the official installation guide to install Sublime text in other popular distributions like Fedora, Arch Linux, OpenSUSE, etc.
Method 3: Install Sublime Text on any Linux distribution using Snap
Installing Sublime Text on Ubuntu is way easier thanks to Snap support in Ubuntu Software Center. All you need to do is to search for Sublime Text in the software center and install it from there in a couple of clicks.
What you get in Ubuntu Software Center can also be achieved in the command line and is not limited to just Ubuntu.
If your Linux distribution has Snap support enabled, you can use this command to install Sublime Text.
sudo snap install sublime-text
Method 4: The classic Linux way
You can download the tar package from the official download page.
Now extract the tar file. Inside the folder, you will find a
Double-click on it and it will open Sublime Text.
Bonus Tip: Installing older versions of Sublime Text
I have discussed how to install Sublime Text latest version (v4) in Linux distributions. But if you want to run a previous version of Sublime Text, say version 3, you can do that as well.
Sublime Text provides installation media for version 3 as a deb file and version 2 as a tar package on their official download page.
Here, you can download the deb/rpm file and install it, as mentioned in the previous step.
Once installed, it will prompt you that a newer version of Sublime Text is available. but you can ignore that and continue using version 3.
In the end...
Sublime Text is excellent but unfortunately it is not open source. The good thing is that there are plenty other good open source code editors available.
I hope this tutorial helped you to install Sublime Text on Linux. Please let me know in the comment section below if you have any questions or suggestions.