一次性装100台电脑的系统 批量安装系统软件


Cobbler是一款Linux生态的自动化运维工具,基于Python2开发,用于自动化批量部署安装操作系统;其提供基于CLI的管理方式和WEB配置界面,其中WEB配置界面是基于Python2和Django框架开发 。另外,cobbler还提供了API,方便二次开发 。Cobbler属于C/S模型(客户端/服务器模型)
1、查看系统版本
# cat /etc/redhat-release CentOS Linux release 7.1.1503 (Core) (备注本次部署是在Centos7中进行)
# uname -rm 3.10.0-229.el7.x86_64 x86_64
2、安装epel源,安装epel库
#yum install -y epel-release#wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo 3、安装cobbler环境所需的包
下载最新版的pip,然后安装
#wget https://bootstrap.pypa.io/get-pip.py#python get-pip.py#ln -s /usr/local/python27/bin/pip2.7 /usr/bin/pip2#pip2 install Django==1.8.9 4、开始安装cobbler
#yum install -y httpd dhcp tftp tftp-server rsync pykickstart xinetd #yum install -y cobbler 5、centos7安装cobbler-web(cobbler-web2.8版本必须用django1.8.9版本)
#yum install httpd-devel#yum install -y cobbler-web 6、配置HTTPD的配置文件,更改项目存放的权限
#vim /etc/httpd/conf/httpd.conf SSLRequireSSLNSSRequireSSLSetEnv VIRTUALENVOptions Indexes MultiViewsOrder allow,deny##apache2.4必须改为AllowOverride AllAllow from all##apache2.4必须改为Require all granted 7、开启服务和加开机启动
#systemctl enable xinetd#systemctl start xinetd#systemctl start httpd#systemctl start cobblerd#systemctl enable httpd#systemctl enable cobblerd#systemctl enable rsyncd#systemctl start rsyncd 8、检查cobbler
#cobbler check按照上面的提示,逐步修改配置如下:
修改cobbler的settings文件,备份
# cp /etc/cobbler/settings{,.ori} 修改server,Cobbler服务器的IP 。
#sed -i \\\'s/server: 127.0.0.1/server: 192.168.0.131/\\\' /etc/cobbler/settings 如果用Cobbler管理DHCP,修改本项
#sed -i \\\'s/next_server: 127.0.0.1/next_server: 192.168.0.131/\\\' /etc/cobbler/settings#sed -i \\\'s/manage_dhcp: 0/manage_dhcp: 1/\\\' /etc/cobbler/settings 防止循环装系统,适用于服务器第一启动项是PXE启动 。
#sed -i \\\'s/pxe_just_once: 0/pxe_just_once: 1/\\\' /etc/cobbler/settings 设置新装系统的默认root密码123456 。random-phrase-here为干扰码,可以自行设定 。
# openssl passwd -1 -salt \\\'cobbler\\\' \\\'123456\\\' $1$cobbler$sqDDOBeLKJVmxTCZr52/11
# vim /etc/cobbler/settings default_password_crypted: “$1$cobbler$sqDDOBeLKJVmxTCZr52/11”
修改tftp配置,启用tftp
#vim /etc/xinetd.d/tftp

推荐阅读