1、需要 python 頭文件,下載安裝。
2、下載安裝 distcc-3.1.tar.bz2。
3、export DISTCC_HOSTS='localhost 10.10.13.162‘ //添加所有欲分發的distcc服務器IP列表,ip應按各服務器性能由好到差排列。
export DISTCC_VERBOSE=1 //給出調試信息
export DISTCC_LOG=”/root/disstcc.log” //編譯出錯時可以查看日志,默認路徑是 /var/log/messages
以上可以寫入到 ~/.bash_profile 中,以便開機有效。
4、在每一台服務器上安裝好 distcc 之后,先啟動服務器 distccd --daemon --user nobody --allow 10.10.0.0/16 接收來自10.10網段的所有TCP連接,最好加入開機啟動。(如果不加--user nobody則會提示:distccd[4596] (dcc_preferred_user) Warning: no such user as "distcc")
5、可以通過 distccmon-text 1 命令查看分布編譯情況,1表示1秒。如果在 ./configure 時,加上了 --with-gnome or --with-gtk 選項,則還可以使用 distccmon-gnome 1 這個圖形界面來查看。
6、可以和 ccache 配合 : time make -j12 CXX="ccache distcc",不過感覺同時使用 distcc 和 ccache 的效果跟只使用 distcc 的效果差不多。如果只有一台機器,就使用 ccache ,如果有多台機器就只使用 distcc 吧。
7、使用 dmucs 配合 distcc 解決分布式編譯的負載均衡問題:
http://www.ibm.com/developerworks/cn/aix/library/0905_yangyi_distcc/
下面轉自:http://blog.chinaunix.net/uid-20553497-id-3214404.html
distcc是一個分布式的編譯工具,包含distccd和distcc。其中distccd是服務端,需要安裝在遠程協助編譯的多台服務器上,而distcc是一個客戶端,需要安裝在分發編譯任務的服務器上。centos可以直接在http://pkgs.repoforge.org/distcc/ 上下載2個RPM包:
- # cat /etc/sysconfig/distccd
- ### See distcc(1) manual page for more information on these options.
- ###
- OPTIONS="--nice 5 --jobs 10 --port 3632 --allow 127.0.0.1 --allow 10.0.0.0/8 "
- #USER="distcc"
- ### Set this if don't want distccd to use gcc or g++ by accident.
- #DISTCCPATH="/usr/lib/distcc/bin"
- chkconfig --level 2345 distccd on
- service distccd restart
- export CC=distcc; ./configure
- export DISTCC_HOSTS="test1.inner.net .... test5.inner.net"
- make -j 20