DISTCC(分布式编译)(方法2)

DISTCC安装配置步骤(方法2)

服务器端(计算机名为:zhimingubtpc.local):

$ sudo useradd distcc

$ sudo apt-get install python-dev

$ sudo tar zxfv distcc-3.2rc1.tar.gz

$ cd distcc―3.2rc1

$ sh ./autogen.sh

$ ./configure �Cprefix=/usr/local/distcc

$ make

$ sudo make install

$ sudo mkdir /usr/local/distcc/log

$ sudo touch /usr/local/distcc/log/distcc.log

$ sudo chown �CR distcc:adm/usr/local/distcc/log

$ echo "alias distccd='/usr/local/distcc/bin/distccd --daemon --allow 10.0.1.0/24 --jobs 20 --log-file=/usr/local/distcc/log/distcc.log'" >> ~/.bashrc

$ source ~/.bashrc

--jobs 20表示可接受的最大job数

开启distcc:

$ sudo distccd

关闭distcc:

$ sudo killall distccd

客户端:

$ sudo useradd distcc

$ $ sudo apt-get install python-dev

$ sudo tar zxfv distcc-3.2rc1.tar.gz

$ cd distcc―3.2rc1

$ sh ./autogen.sh

$ ./configure �Cprefix=/usr/local/distcc

$ make

$ sudo make install

$ sudo ln �Cs /usr/local/distcc/bin/distcc/usr/local/distcc/bin/cc

$ sudo ln �Cs /usr/local/distcc/bin/distcc/usr/local/distcc/bin/gcc

$ sudo ln �Cs /usr/local/distcc/bin/distcc/usr/local/distcc/bin/g++

$ sudo mkdir /usr/local/distcc/log

$ sudo touch/usr/local/distcc/log/distcc.log

$ sudo chown �CR distcc:adm/usr/local/distcc/log

$ echo "alias distccd='/usr/local/distcc/bin/distccd --daemon --allow 10.0.1.0/24 --jobs 5 --log-file=/usr/local/distcc/log/distcc.log'" >> ~/.bashrc

$ source ~/.bashrc

如果不想本机承担太多job,可将本机的--jobs 数设的小点,(jobs数范围1-200)

开启distcc:

$ sudo distccd

关闭distcc:

$ sudo killall distccd

$ vi ~/.bashrc (在最后添加)
按a或i进入编辑模式

export DISTCC_HOSTS='--randomize localhost/2 zhimingubtpc.local/8'

export PATH=/usr/local/distcc/bin:/usr/bin:/bin
按Esc键退出编辑模式
:wq (保存并退出)

--randomize表示按照主机列表前后优先分配任务

/2表示分配job为2

$ source ~/.bashrc

查看下gcc路径:

$ which gcc  (如果显示/usr/lib/distcc/gcc则是说明环境变量生效了)


命令行查看任务分配情况的工具为:$ distccmon-text 2

图形化查看任务分配情况的工具为:distccmon-gnome





本文出自 “linux” 博客,谢绝转载!

你可能感兴趣的:(distcc)