Sublime is an amazing option if you’re looking for editors for programming. Sublime is famous for its user-friendly interface, speed, as well as a community contribution. It supports a wide variety of programming languages and markups straight out of the box, but you can expand on that to your liking as well, with the use of plugins.
With Sublime Text-Editor, you get auto-completion for a majority of programming languages, cursor jumping efficiently, text snippets, along with the ability to select multiple lines, columns, and words, among many others that make achieving your objective very easy. So, let’s begin and explore the steps of how to install Sublime Text on Ubuntu 22.04.
Update the system repositories
Though it’s not mandatory, it’s always a good idea to update the system apt repositories to avoid any conflicts occurring during the installation process. We can trigger the process using:
$sudo apt update && sudo apt upgrade -y
You can run these two together or separately, however, you like.
Before we install the Sublime Text itself, we need to install the following package to ensure that the text editor runs smoothly.
$sudo apt install software-properties-common apt-transport-https curl wget ca-certificates -y
Importing the repository
Now, the Sublime Text repository isn’t included in the apt repositories. We can import it by first importing the GPG key, using:
$ wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo gpg --dearmor -o /usr/share/keyrings/sublimetext-keyring.gpg
Now you can import the stable Sublime Text repository by:
$echo "deb [arch=amd64 signed-by=/usr/share/keyrings/sublimetext-keyring.gpg] https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
Or if you want to install the dev version, and try out new features before they are released to everyone, you can use the following to import the Sublime-dev repository.
$echo "deb [arch=amd64 signed-by=/usr/share/keyrings/sublimetext-keyring.gpg] https://download.sublimetext.com/ apt/dev/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
Please remember that you cannot install both the stable and the dev versions of Sublime together. After your desired repository has been imported, you need to run the following to update the list of available repositories:
$sudo apt update -y
Installing Sublime Text
After importing the GPG key and the apt repository, you are now ready to install Sublime Text in your Ubuntu 22.04.
$sudo apt install sublime-text -y
Depending on your available bandwidth and/or the state of your system, the installation process will take up some time to complete. Once you get your command prompt back, this will signify that the installation process has successfully completed. Or, if you want to make sure that the installation has been completed, you can run:
After the installation has been completed, you can launch sublime in two ways. If you prefer the GUI way, you can open up applications and type “sublime” to pull up the application icon for launching it.
Or if you want to stay within the terminal, you can type:
Note: You can ignore the “(UNREGISTERED)” in the title of the window unless you want to use Sublime Text for commercial or enterprise use.
If your objective for installing Sublime Text has been completed and you want to remove it from your Ubuntu 22.04, you can simply uninstall it by running:
$sudo apt autoremove sublime-text --purge -y
After the uninstallation has been completed, you can also remove the repository and free up disk space by:
$sudo rm /etc/apt/sources.list.d/sublime-text.list
And finally, to avoid any possible conflicts due to the remaining GPG key, you can remove that using:
$sudo rm /usr/share/keyrings/sublimehq.gpg
Sublime is an extremely powerful text editor. It comes loaded with a plethora of features out of the box, which makes it an easy choice for anyone looking for a text editor. With the added benefit of plugins, it becomes very easy for anyone to customize it and extend the functionality to whatever they like.
Like always, if you run into any issues during the installation, feel free to drop us a message through the comments below and I will gladly help you out.