一、前言
這篇文章本來是開發工具箱系統的第3篇,但身邊的一些同學在安裝TortoiseHg和kdiff3時碰到了不少軟體的版本和依賴問題,導致無法順利安裝下去。因此,特提前分享我安裝這些軟體的完整過程,希望對其他的同學有協助。
二、環境和準備
1、作業系統:Redhat5 / Centos5
2、需要準備的軟體及其版本(都是通過原始碼編譯進行安裝):
- Python2.7 (Redhat5和Centos5上預設安裝的Python為2.4版本,請升級至2.7。升級Python後,重新編譯安裝mercurial-1.9)
- qt-4.7.3
- kdiff3-0.9.95
- QScintilla-gpl-2.5.1
- iniparse-0.4
- sip-4.12.4
- PyQt-x11-gpl-4.8.5
- tortoisehg-2.1
它們的依賴關係如所示:
三、安裝QT4
1、下載原始碼:
wget
http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.7.3.tar.gz
2、解壓原始碼包:
tar -zxvf qt-everywhere-opensource-src-4.7.3.tar.gz
3、編譯安裝三步曲:
進入解壓後的目錄,分別按順序執行如下命令:
1)./configure -prefix /home/nieyong/local/qt-4.7.3 (註:prefix前面只有一個"-",prefix 後的目錄需根據自己的環境修改,此步驟執行的時間比較久,在我的機器上執行了約2.5小時)
2)gmake
3)gmake install
四、安裝kdiff3
1、下載原始碼
wget
http://nchc.dl.sourceforge.net/project/kdiff3/kdiff3/0.9.95/kdiff3-0.9.95.tar.gzgmake
2、解壓原始碼
tar -zxvf kdiff3-0.9.95.tar.gz
3、配置環境變數
1)編輯目前使用者目錄下的.bash_profile檔案
vi ~/.bash_profile
加入如下配置:
QTDIR=$HOME/local/qt-4.7.3 (需根據本機環境修改)
export QTDIR
PATH=$QTDIR/bin:$PATH
export PATH
LD_LIBRARY_PATH=$HOME/local/qt-4.7.3/lib:$LD_LIBRARY_PATH (需根據本機環境修改)
export LD_LIBRARY_PATH
2)使環境變數配置生效
source ~/.bash_profile
4、安裝kdiff3
進入kdiff3-0.9.95.tar.gz解壓後的目錄,執行如下命令進行安裝:
./configure qt4
五、配置kdiff3
1、編輯目前使用者目錄下的.hgrc檔案,執行如下命令:
vi ~/.hgrc
增加如下配置:
[extensions]
hgext.extdiff=
[extdiff]
cmd.kdiff3=
[merge-tools]
kdiff3.args=$base $local $other -o $output
六、安裝iniparse
1、下載原始碼
wget
http://iniparse.googlecode.com/files/iniparse-0.4.tar.gz
2、解壓原始碼包
tar -zxvf iniparse-0.4.tar.gz
3、安裝
進入iniparse-0.4解壓後的目錄,執行如下命令進行安裝:
python setup.py build
python setup.py install (需要以root身份執行)
七、安裝QScintilla
1、下載原始碼
wget
http://www.riverbankcomputing.co.uk/static/Downloads/QScintilla2/QScintilla-gpl-2.5.1.tar.gz
2、解壓原始碼包
tar -zxvf QScintilla-gpl-2.5.1.tar.gz
3、編譯安裝QScintilla
1)進入QScintilla解壓後目錄下的Qt4目錄,順序執行如下三個命令:
qmake qscintilla.pro
make
make install
2)進入QScintilla解壓後目錄下的Python目錄,順序執行如下三個命令:
python ./configure.py
make
make install (需要以root身份執行)
八、安裝 sip
1、下載原始碼
wget
http://www.riverbankcomputing.co.uk/static/Downloads/sip4/sip-4.12.4.tar.gz
2、解壓原始碼包
tar -zxvf sip-4.12.4.tar.gz
3、編譯安裝sip
進入sip-4.12.4的解壓目錄,執行如下三個命令:
python ./configure.py
make
make install (需要以root身份執行)
九、安裝PyQt4
1、下載原始碼
wget
http://www.riverbankcomputing.co.uk/static/Downloads/PyQt4/PyQt-x11-gpl-4.8.5.tar.gz
2、解壓原始碼包
tar -zxvf PyQt-x11-gpl-4.8.5.tar.gz
3、安裝PyQt4
進入PyQt解壓後的目錄,按順序執行如下三個命令安裝:
python configure.py
然後會顯示如下的協議資訊:
Determining the layout of your Qt installation...
This is the GPL version of PyQt 4.8.5 (licensed under the GNU General Public
License) for Python 2.7.2 on linux2.
Type '2' to view the GPL v2 license.
Type '3' to view the GPL v3 license.
Type 'yes' to accept the terms of the license.
Type 'no' to decline the terms of the license.
Do you accept the terms of the license? (在此輸入yes並按斷行符號表示同意協議並繼續後面的安裝步驟)
最後再分別執行:
make
make install (需要以root身份執行)
十、安裝TortoiseHg
說明:mercurial-1.9對應的tortoisehg的版本是2.1,安裝其他版本會有問題。
1、下載原始碼
wget
https://bitbucket.org/tortoisehg/targz/downloads/tortoisehg-2.1.tar.gz
2、解壓原始碼包
tar -zxvf tortoisehg-2.1.tar.gz
3、安裝TortoiseHg
進入tortoisehg-2.1的解壓目錄,順序執行如下兩個命令安裝:
python setup.py build
python setup.py install (需要以root身份執行)
十一、安裝過程中碰到的問題匯總
請按照上述過程安裝,否則會碰到許多的問題。此部分內容後續再補充……