This is a step by step beginner’s guide shows how to install Sublime Text code editor in Ubuntu 22.04 and Ubuntu 24.04.
Sublime Text is available to install in Ubuntu Linux through 3 different ways. They include:
- Snap package – maintained by contributors.
- Deb pacakge – through its official repository.
- Flatpak package (Sublime Text 3) – maintained by contributors.
Option 1: Snap package
A group of contributers maintain the text editor in Snap package format, which runs in sandbox. The package so far supports amd64
(Intel/AMD) and arm64
(Raspberry Pi) devices.
Ubuntu 20.04 and higher can simply search for and install it from Ubuntu Software (or App Center):
The snap package runs in sandbox and always up-to-date since it receives updates automatically. The only downside could be that some do NOT like sandboxing apps.
For those prefer Linux commands, the package also can be installed by running the command below in terminal:
sudo snap install sublime-text --classic
Option 2: Official Apt repository (.deb package)
Sublime has an official guide for installing the deb package from apt repository. However, it’s outdated due to Debian policy change!
This is the official .deb
package works in Ubuntu, Linux Mint, Debian, and even Raspberry Pi OS (arm64).
1. Firstly, press Ctrl+Alt+T on keyboard to open terminal. When it opens, run the command below to make sure ‘https’ source is supported:
sudo apt install apt-transport-https
2. Add the repository key
The sublime text website still use the ‘apt-key
‘ command in its document, which is deprecated.
For security reason, Debian has updated the policy. And, it’s recommend to use the command below instead to install the key:
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | gpg --dearmor | sudo tee /etc/apt/keyrings/sublimehq-pub.gpg
It will download the key from its website, convert it to un-readable encrypted key, and put into “/etc/apt/keyring” directory.
3. Add the official repository
Next, run the command below to create a source file and edit it via Gnome text editor:
sudo gnome-text-editor /etc/apt/sources.list.d/sublime-text.list
For Ubuntu 22.04 and earlier, replace gnome-text-editor
with gedit
. Or use mousepad
for XFCE, pluma
for MATE, or nano
command line text editor that works in most desktop environments.
When the file opens, add the following line (it’s a single line) and save it.
deb [signed-by=/etc/apt/keyrings/sublimehq-pub.gpg] https://download.sublimetext.com/ apt/stable/
This step can be done alternatively by running the single command below in terminal:
echo "deb [signed-by=/etc/apt/keyrings/sublimehq-pub.gpg] https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
4. Now, run the command below to refresh system package cache:
sudo apt update
In the output, it should print a line looks like “Get: x https://download.sublimetext.com apt/stable …”
5. Finally, install the code editor from that repository by running command:
sudo apt install sublime-text
Option 3: Flatpak package
Sublime Text 4 is NOT available as Flatpak so far. But for the old version 3, you may install it by running the commands below one by one in terminal.
NOTE: Like Snap, the Sublime Text as flatpak is also un-official package maintained by contributors, runs in sandbox.
Firstly, press Ctrl+Alt+T to open terminal and run command to install Flatpak daemon:
sudo apt install flatpak
Then, install Sublime Text 3 via Flatpak by running command:
flatpak install https://dl.flathub.org/repo/appstream/com.sublimetext.three.flatpakref
Uninstall Sublime Text:
For the Snap package, remove it either using Ubuntu Software or by running command in terminal:
sudo snap remove --purge sublime-text
For the Flatpak package, use the command to uninstall the package:
flatpak uninstall --delete-data com.sublimetext.three
and cleanup useless run-times via flatpak uninstall --unused
.
For the official .deb package, remove it by running command:
sudo apt remove --autoremove sublime-text
The apt repository will not display in “Software & Updates” utility, so get rid of it by running command to remove the source file:
sudo rm /etc/apt/sources.list.d/sublime-text.list
And remove the key file by running command:
sudo rm /usr/share/keyrings/sublimehq-pub.gpg
Summary:
Here I introduced 3 ways to install Sublime Text in Ubuntu. The Snap is the easiest, which is available in Ubuntu Software, but the official apt repository is recommended! For those still looking for the old Sublime Text 3, the Flatpak package is available for choice.