在Ubuntu上编译atom编辑器

atom编辑器,不得不说,确实很棒,不知道为什么,比起sublimetext,我更喜欢它,虽然在os x上可以直接下载安装包进行安装,但由于开源才不久,还没有一个完美的源提供安装,这里我们就阅读一下官方的安装说明,看看在64位 xubutnu 14.04下如何编译与安装atom编辑器(同样适用于32位)。文章末尾附上我自己编译好的deb包,应该可以在其他的64位ubuntu下直接安装的,出现组件缺失的提示的话,请运行apt-get install -f 或者换中国官方源,更新后再运行

7月15号补充:在64位ubuntu 13.10下安装必要组件后可以直接安装咱编译好的atom.deb~

首先,官方的说明是这样的

Ubuntu LTS 12.04 64-bit is the recommended platform.

OS with 64-bit or 32-bit architecture
C++ toolchain
    on Ubuntu/Debian: sudo apt-get install build-essential
node.js v0.10.x
    Ubuntu/Debian/Mint instructions
npm v1.4.x
    npm comes with node.js so no explicit installation is needed here.
    You can check npm 1.4 or above is installed by running npm -v.
libgnome-keyring-dev
    on Ubuntu/Debian: sudo apt-get install libgnome-keyring-dev
npm config set python /usr/bin/python2 -g to ensure that gyp uses Python 2
Git
    on Ubuntu/Debian: sudo apt-get install git

总之呢,只要是ubuntu 12.04版本及以上,运行如下命令就可以了

sudo -s(由于过程中大多需要以超级用户身份来安装与设置环境,所以在编译器,默认使用超级用户)

apt-get install build-essential (安装编译工具)

add-apt-repository ppa:chris-lea/node.js (添加node.js源,以便安装最新版node.js)

apt-get update

apt-get install nodejs (目前最新版会同时默认安装新版npm v1.4.14(node.js的包管理器),不用修改atom源文件来编译了)

apt-get install npm (如果未安装npm或者npm -v输出的版本低于1.4的话,请运行这个命令)

apt-get install libgnome-keyring-dev (抱歉不知道这个是什么,但必需的)

npm config set python /usr/bin/python2 -g (确保gyp使用python 2环境)

apt-get install git (安装git以便从gitHub上下载最新版atom)

git clone https://github.com/atom/atom (下载atom源代码,默认放在当前目录下)

开始编译吧!

cd atom script/build # Creates application at $TMPDIR/atom-build/Atom sudo script/grunt install # Installs command to /usr/local/bin/atom script/grunt mkdeb # Generates a .deb package at $TMPDIR/atom-build

完成安装只需要前三个命令,最后的命令会在/tmp文件夹中生成一个安装包,然后经过漫长的等待~atom安装完成!

按照官方的说明一步一步安装下去就没错滴,但有点坑爹的是关于node.js安装的说明(我一点也不了解这个东西)在linux公社上的教程说要修改源代码,但咱不在意,直接安装了最新版的node.js与npm,编译全程无error~

如果atom在gitHub上有更新出现,那么运行一下命令更新源代码

cd atom

git pull

自己动手,丰衣足食~

最后附上运行效果图与deb地址

链接: http://pan.baidu.com/s/1eQh82VC 密码: rvpt