快速安裝git-gitbook(python升級)

0-安裝環境html

[lsug@172-16-1-105 ~]$ uname -a
Linux 172-16-1-105 2.6.32-573.el6.x86_64 #1 SMP Thu Jul 23 15:44:03 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
[lsug@172-16-1-105 ~]$ cat /etc/redhat-release 
CentOS release 6.7 (Final)node

1-安裝gitbook須要的環境python

- 安裝gitlinux

- 安裝nvm,node.js和NPMgit

- 升級python版本到2.7.1以上github

- 安裝gitbook及calibre組件(因爲GitBook生成多格式的文件須要用到calibre,calibre最新版要求Python ≥ 2.7.1 not 3.x )npm

1.1安裝gitjson

安裝依賴包vim

yum install gettext-devel openssl-devel perl-CPAN perl-devel zlib-develbash

下載git版本

wget https://github.com/git/git/archive/v2.11.0.tar.gz

解壓編譯安裝

tar -zxf git-2.11.0.tar.gz 

cd git-2.11.0

autoconf 

mkdir /data/git -p

./configure --prefix=/data/git/

make && make install

將git加入環境變量中

vim /etc/profile

export GIT_HOME=/data/git/
export PATH=$PATH:$GIT_HOME/bin

是修改生效

source /etc/profile

測試是否安裝成功

[root@minion git-2.11.0]# git --version
git version 2.11.0

1.2-安裝node.js和npm

安裝node.js 6.1.0版本,自帶npm3.10.10

[lsug@minion node-6.9.4]$ node -v
v6.9.4

[root@minion lsug]# npm -V

npm@3.10.10 /usr/local/lib/node_modules/npm

1.3 python從2.6.6升級到2.7.3

下載源碼包

wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz

解壓編譯安裝

tar -zxf Python-2.7.3.tgz

cd Python-2.7.3

mkdir -p /data/python2.7.3 -p

./configure --prefix=/data/python2.7.3

make
sudo make install

此時沒有覆蓋老版本,將老版本/usr/bin/python連接改成別的名字

sudo mv /usr/bin/python /usr/bin/python2.6.6

創建新版本python的鏈接

sudo ln -s /data/python2.7.3/bin/python2.7 /usr/bin/python

檢查版本是不是2.7.3

[lsug@minion python-2.7.3]$ python
Python 2.7.3 (default, Jan  7 2017, 14:50:00) 
[GCC 6.1.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.

1.4 安裝calibre

sudo wget -nv -O- https://raw.githubusercontent.com/kovidgoyal/calibre/master/setup/linux-installer.py | python -c "import sys; main=lambda x:sys.stderr.write('Download failed\n'); exec(sys.stdin.read()); main('/data')"

命令的最後 main('/打他') 中/data爲Calibre的安裝目錄,可根據須要修改。

2.安裝gitbook

[root@minion ~]# npm install -ggitbook

[lsug@minion ~]$ npm install -g gitbook-cli
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
/usr/local/lib
└─┬ gitbook-cli@2.3.0 
  ├── bash-color@0.0.4 
  ├─┬ commander@2.9.0 
  │ └── graceful-readlink@1.0.1 
  ├─┬ fs-extra@0.26.5 
  │ ├── graceful-fs@4.1.11 
  │ ├── jsonfile@2.4.0 
  │ ├── klaw@1.3.1 

....................省略....

 

3-檢查是否安裝

[root@minion lsug]# gitbook  -V
CLI version: 2.3.0
Installing GitBook 3.2.2

gitbook@3.2.2 ../../tmp/tmp-11827qTPkl0w2fFNl/node_modules/gitbook
├── bash-color@0.0.4
├── escape-string-regexp@1.0.5
├── escape-html@1.0.3
├── destroy@1.0.4
├── ignore@3.1.2
├── q@1.4.1
├── gitbook-plugin-livereload@0.0.1

....................省略....

相關文章
相關標籤/搜索