Install Sublime Text2 on Linux

来源:互联网 发布:数据库用户权限有哪些 编辑:程序博客网 时间:2024/06/07 02:32
In Mac, people use Textmate as there prime text editor. In Linux we have vi, vim, gedit and a more advanced Eclipse. But these days I came across with a new Text Editor, called Sublime Text Editor. I have used it in Windows machine previously. But recently I saw that they were providing the package for Linux. So that was it. I tried to install it in CentOS 6.3. After a few hiccups I was able to install it. So now I am sharing it with the text editor lovers.
  1. First download the text editor from the original website,  Also you can do,
    [root@stepzhibin wzb]# wget http://c758482.r82.cf2.rackcdn.com/Sublime%20Text%202.0.1%20x64.tar.bz2

    The above is for Linux 64 Version.  If you want to install  32-bit  version, do

    [wzb@stepzhibin ~]# wget http://c758482.r82.cf2.rackcdn.com/Sublime%20Text%202.0.1.tar.bz2

    After we download it, it is time to extract it.

  2. So in the file browser we extract the tar-ball file. It will create a directory like, "Sublime Text 2". Rename this directory to "Sublime_Text_2".
  3. Move this directory to /opt/ directory. I choose it as I put all custom text editor there. It depends upon you where you will put it. So open up the terminal and type in the following,
    [aneek@localhost ~]$ mv /home/aneek/Downloads/Sublime_Text_2/ /opt/Sublime_Text_2

    This will move the file to /opt/ directory. Inside the file structure will be,

    [root@stepzhibin Sublime_Text_2]# ls -ltotal 8532drwxr-xr-x. 7 wzb  wzb     4096 Jul 14  2012 Icondrwxr-xr-x. 2 wzb  wzb     4096 Jul 14  2012 lib-rw-r--r--. 1 wzb  wzb     4205 Jul 14  2012 PackageSetup.py-rw-r--r--. 1 root root    4709 Feb 18 11:45 PackageSetup.pycdrwxr-xr-x. 2 wzb  wzb     4096 Jul 14  2012 Pristine Packages-rw-r--r--. 1 wzb  wzb    10838 Jul 14  2012 sublime_plugin.py-rw-r--r--. 1 root root   13435 Feb 18 11:45 sublime_plugin.pyc-rwxr-xr-x. 1 wzb  wzb  8679096 Jul 14  2012 sublime_text
    So far, we have done the directory related work. Next we have to make the short cuts and desktop icons.
  4. Next we create a shortcut in the "/usr/bin/" directory. So again in the Terminal write, 
    [root@stepzhibin Sublime_Text_2]# touch /usr/bin/sublime
    [root@stepzhibin Sublime_Text_2]# chmod 755 /usr/bin/sublime

    Open up the file

    [root@stepzhibin Sublime_Text_2]# vim /usr/bin/sublime

    Then paste the following in it,

    #!/bin/shexport SUBLIME_HOME="/opt/Sublime_Text_2" $SUBLIME_HOME/sublime_text $*

    Save and close the file.
    This will create a system variable in the system. We can access the Sublime text editor by calling sublime in the terminal.  

  5. In the Next step, we have to create the desktop entry. So again in Terminal write,
    [root@stepzhibin Sublime_Text_2]# vim /usr/share/applications/sublime.desktop

    This will create a file called sublime.desktop. In that file paste

    [Desktop Entry]Encoding=UTF-8Name=SublimeComment=Sublime Text EditorExec=sublimeIcon=/opt/Sublime_Text_2/Sublime_Text_2.pngTerminal=falseType=ApplicationCategories=GNOME;Application;Development;StartupNotify=true

    That is it. You are done. save and exit the file. Logout from your system.Then login and Sublime shortcut will be in Applications/Programming. .


原创粉丝点击