How to Install Sublime Text 4 in Ubuntu 23.10 [More Secure Way]

This simple tutorial shows how to install the latest Sublime Text 4 using its official apt repository with updated (more secure) Debian policy.

Ubuntu includes the Sublime Text package in its ‘Ubuntu Software’/’Ubuntu Store’. However, its Snap package run in sandbox! For those who prefer the classic .deb package format, the text editor has an official guide shows how to install it via apt repository.

At the moment of writing this tutorial, the official guide is however outdated and deprecated due  to Debian’s new policy.

The old method installs the key file into /etc/apt/trusted.gpg.d/ directory. Any third-party repository whose key is in there can replace any package in the whole system. It’s a big security risk, though still working in current Ubuntu releases!

Now, it recommends to install key file in other location (Ubuntu prefers /etc/apt/keyrings), and use “signed-by” option to bind the key to a certain repository.

Step 1: Download & Install the GPG key

Firstly, search for and open a terminal window from start menu or ‘Activities’ overview depends on your desktop environment.

Then, make sure the ‘/etc/apt/keyrins‘ directory exist by running command:

sudo mkdir -p /etc/apt/keyrings

Finally, download & install the key by running command in terminal:

wget -qO - | gpg --dearmor | sudo tee /etc/apt/keyrings/sublimehq-archive.gpg > /dev/null

This command download the key file from Sublime Text website, dearmor it (so it will be unreadable), and finally save to “/etc/apt/keyrings” directory.

Step 2: Create the source file

Ubuntu 23.10 by default uses Deb822 file format for 3rd party repositories. However, Sublime Text’s apt repository so far seems not working for this format. So, this step I’m going to use the classic .list format with ‘signed-by’ option.

First, run command to create & edit the source file:

sudo gnome-text-editor /etc/apt/sources.list.d/sublime-text.list

In command you may replace gnome-text-editor depends on your desktop environment. For example, use mousepad for XFCE or nano command line text editor for most Linux.

Then, add the single line below into the file, and save it.

deb [signed-by=/etc/apt/keyrings/sublimehq-archive.gpg] apt/stable/

For nano text editor, press Ctrl+X, type y and hit Enter to save file.

Step 3: Refresh cache & Install Sublime Text

Finally, you can now update the system package cache by running command:

sudo apt update

And, install the latest Sublime Text editor:

sudo apt install sublime-text

When done, search for and launch the editor from start menu or ‘Activities’ overview depends on your desktop environment.

And, you’ll receive future updates for this application, along with system package updates, through “Software Updater” utility.

Uninstall Sublime Text

To remove this apt repository, simply open terminal and run command to delete the source file:

sudo rm /etc/apt/sources.list.d/sublime-text.list

Also delete the GPG key file by running command:

sudo rm /etc/apt/keyrings/sublimehq-archive.gpg

Finally, refresh your system package cache by running sudo apt update.

To remove the Sublime Text editor package, use command:

sudo apt remove --autoremove sublime-text
Hi, I'm Merilyn Ne, a computer geek working on Ubuntu Linux for many years and would like to write useful tips for beginners. Forgive me for language mistakes. I'm not a native speaker of English.