Linux install sublime-text3

Sublime Text3 is a code editor that I mainly use to edit Python. Let's briefly explain the installation process of it in Linux!

1. Add the repository of sublime text3

First press the shortcut key ctrl+alt+t to open the terminal;

Type in the terminal: sudo add-apt-repository ppa:webupd8team/sublime-text-3

After pressing Enter, a lot of information will appear. According to the prompt, press the Enter key to continue.

2. Update the software library

Then enter in the terminal: sudo apt-get update

3. The last step is to install Sublime Text3

Also enter in the terminal: sudo apt-get install sublime-text-installer

After the installation is complete, you can search for sublime in the folder of your computer, and you will see the sublime_text you installed.

As shown in the figure:

However, sometimes it fails to execute the third step. The reason is that the software sublime-text3 is foreign, and the download address is also foreign. When we install it, we first download it from the software source added in the first step. If the website cannot be logged in, the download will fail, and if it cannot be downloaded, it will naturally fail to install.

But there is always a way. We download this package manually, there is a download address behind it, and then manually decompress it is the same.

Download address: Link: https://pan.baidu.com/s/1kVXhpMv Password: ypn1

The file suffix is ​​tar.bz2, which is also a type of compressed file. We can find a location to decompress it.

For example: my software directory: /home/lidd/software/sublime_text_3_build_3143_x64.tar.bz2

To be installed in the /opt directory

Open the terminal and enter the following commands (the meaning of $ and # is explained in the previous blog):

$:sudo  tar -jxvf  /home/lidd/software/sublime_text_3_build_3143_x64.tar.bz2  /opt

Enter the administrator password to extract to /opt

4. Solve the problem of not being able to input Chinese

In fact, this has been installed and can be used. However, there is a bug in sublime_text in linux, and Chinese cannot be input. Let's solve it below:

Download two files:

1.libsublime-imfix.so

Link: https://pan.baidu.com/s/1jJv6vVC     Password: efrw

2.subl

Link: https://pan.baidu.com/s/1htp4Otu    Password: 35xd

Before executing the following command, you must change the name of the sublimetext folder you just decompressed: cd /opt First enter the opt directory,

Then: sudo mv sublime_text_3 sublime_text works

Put the first file in the /opt/sublime_text/ directory and the second in the /usr/bin/ directory, you can use the sudo mv command to copy

These two directories cannot be tested directly. We can put them in the home directory first, such as mine in the /home directory.

Change the current directory to /opt/sublime_text: cd /opt/sublime_text

Then execute: sudo mv /home/libsublime-imfix.so /opt/sublime_text

The first one is moved over, and the second one is moved:

sudo mv /home/subl /usr/bin This is OK, you can enter Chinese

For convenience, put the shortcut in the launcher too

Open /opt/sublime_text/ and find the file sublime_text.desktop: sudo gedit sublime_text.desktop

Edit after opening:

Exec=/usr/bin/subl %F

Icon=/opt/sublime_text/Icon/48x48/sublime-text.png

Exec=/usr/bin/subl -n

Exec=/usr/bin/subl new_file

Change it to this, we will copy it to the /usr/share/applications/ directory: sudo cp sublime_text.desktop /usr/share/applications/

That's it, click the sublime icon in the /usr/share/applications/ directory to open sublime.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324437666&siteId=291194637