How to install Sublime Text 2 on Ubuntu 12.04 (Unity)

96 篇文章 0 订阅
11 篇文章 0 订阅

Sublime Text is an awesome text editor. If you’ve never heard of it, you should check it out right now.

I’ve made this tutorial because there’s no installer for the Linux versions of Sublime Text. While that’s not a real problem, I feel there is a cleaner way to go around this. Also, this post will show you how to integrate Sublime Text to Unity (which, I’m glad to report, has now matured into a fully functional user interface).

So let’s get on with this. Here is my how to install Sublime Text on Ubuntu tutorial.

[This tutorial has been updated following feedback from AskUbuntu. Also, you need to do these steps using your login. Do not start by typing "sudo -s"!]

Step 1

Download the tarfile that suits you best and extract it. Here’s the command to extract tar.bz2 files:

1. tar xf Sublime\ Text\ 2.0.1\ x64.tar.bz2

You’ll notice that I got the 64-bit version. The reason is that it’s lightning fast. So, go for that if you can!

Step 2

You’ll get a “Sublime Text 2″ folder after extraction. This folder contains all the files that Sublime Text will need. So we have to move that folder somewhere more appropriate. Like the “/opt/” folder :

1. sudo mv Sublime\ Text\ 2 /opt/

Step 3

At some point you’d want to be able to call Sublime Text from the Terminal by just typing “sublime”. To do that, we’ll just create a symbolic link in “/usr/bin” like thus:

1. sudo ln -s /opt/Sublime\ Text\ 2/sublime_text /usr/bin/sublime

Step 4

Now that our files are at the right place, we need to create a launcher in Unity. To do this, we’re going to create a .desktop file in “/usr/share/applications”:

1. sudo sublime /usr/share/applications/sublime.desktop

And paste the following content:

[Desktop Entry]
Version=1.0
Name=Sublime Text 2
# Only KDE 4 seems to use GenericName, so we reuse the KDE strings.
# From Ubuntu's language-pack-kde-XX-base packages, version 9.04-20090413.
GenericName=Text Editor

Exec=sublime
Terminal=false
Icon=/opt/Sublime Text 2/Icon/48x48/sublime_text.png
Type=Application
Categories=TextEditor;IDE;Development
X-Ayatana-Desktop-Shortcuts=NewWindow

[NewWindow Shortcut Group]
Name=New Window
Exec=sublime -n
TargetEnvironment=Unity

As you can see, these lines are quite straightforward. Go ahead and experiment a bit with them.

Step 5

Now you would probably want to open all text files with Sublime Text 2. The easiest way to do that is to open up the file associations list:

1. sudo sublime /usr/share/applications/defaults.list

And replace all occurrences of gedit.desktop with sublime.desktop.



转载地址:http://www.technoreply.com/how-to-install-sublime-text-2-on-ubuntu-12-04-unity/

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 1. 打开终端,输入以下命令安装Sublime Text的APT密钥: wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add - 2. 添加Sublime Text APT存储库: echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list 3. 更新APT缓存: sudo apt-get update 4. 安装Sublime Text: sudo apt-get install sublime-text 5. 安装完成后,可以在终端中输入subl命令启动Sublime Text。 ### 回答2: 要安装Sublime TextUbuntu上,可以按照以下步骤进行: 1. 打开终端。可以通过按下Ctrl + Alt + T键盘快捷键打开终端。 2. 添加Sublime Text的官方软件包源。在终端中输入以下命令并按下回车: ``` wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add - ``` 3. 添加Sublime Text的APT存储库。在终端中输入以下命令并按下回车: ``` echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list ``` 4. 更新APT软件包列表。在终端中输入以下命令并按下回车: ``` sudo apt update ``` 5. 安装Sublime Text。在终端中输入以下命令并按下回车: ``` sudo apt install sublime-text ``` 6. 等待安装完成。安装过程可能需要一些时间,取决于您的互联网连接速度。 7. 安装完成后,可以在应用程序菜单中找到Sublime Text的图标,或者可以在终端中输入以下命令来启动Sublime Text: ``` subl ``` 现在,您应该已成功地在您的Ubuntu系统上安装了Sublime Text。您可以在Sublime Text中进行文本编辑和编程开发等任务。 ### 回答3: 安装Sublime TextUbuntu系统中非常简单,可以按照以下步骤进行操作: 1. 打开终端,可以通过按下"Ctrl+Alt+T"组合键来打开终端窗口。 2. 添加Sublime Text的官方软件源。在终端中输入以下命令并按下Enter键: ``` wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add - ``` 3. 添加Stable软件源,用于安装稳定版本的Sublime Text。在终端中输入以下命令并按下Enter键: ``` echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list ``` 4. 更新软件源列表并安装Sublime Text。在终端中输入以下命令并按下Enter键: ``` sudo apt update sudo apt install sublime-text ``` 5. 等待安装完成后,Sublime Text就已经成功安装在你的Ubuntu系统中了。 如果你想卸载Sublime Text,可以在终端中执行以下命令删除相关文件: ``` sudo apt remove sublime-text ``` 希望以上步骤对你安装Sublime Text有所帮助!

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值