背景
我司竟然还是人肉装系统,太TMD老土了。于是找到了cobbler
,官网在http://cobbler.github.io/
先看一段简介
Cobbler is a Linux installation server that allows for rapid setup of network installation environments.
很叼吧。
开启PXE
由于cobbler是通过PXE给裸机装系统的,所以要先改裸机的BIOS设置,改为从网卡启动。
某品牌主板的设置方法
另一品牌主板的设置方法
安装cobbler
参考官网的quick start http://cobbler.github.io/manuals/quickstart/
disable SELinux
由于我对SELinux不熟悉,根据官网的建议,还是把SELinux Disable吧
参考https://www.centos.org/docs/5/html/5.1/Deployment_Guide/sec-sel-enable-disable.html
修改/etc/sysconfig/selinux
,修改SELINUX
的值为disabled
,并增加一行SETLOCALDEFS=0
1 | # This file controls the state of SELinux on the system. |
Installing Cobbler
错误的方法
1 | sudo yum install cobbler |
提示没有package,说明要添加源。
按照http://cobbler.github.io/manuals/2.4.0/3/2_-_Installing_From_Packages.html说
1 | # sudo rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-X-Y.noarch.rpm |
还是不行,因为我不知道具体的版本号。
只好找到最新release的页面http://cobbler.github.io/posts/2015/09/30/cobbler_2.6.10_released.html,根据Packages will be provided as soon as possible, please check
的提示,找到http://download.opensuse.org/repositories/home:/libertas-ict:/cobbler26/CentOS_CentOS-7/noarch/
添加源
1 | sudo rpm -Uvh http://download.opensuse.org/repositories/home:/libertas-ict:/cobbler26/CentOS_CentOS-7/noarch/cobbler-2.6.10-11.2.noarch.rpm |
提示缺少python的一堆库,
1 | python-simplejson is needed by cobbler-2.6.10-11.2.noarch |
使用pip安装simplejson和cheetah,还是报这个错,看来此路不通,需要另想它法。
正确的方法
找到了这个链接http://cobbler.readthedocs.org/en/latest/installation-guide.html
Make sure you have the EPEL repository enabled on your system:
1 | yum -y install epel-release |
接下来
1 | yum install cobbler cobbler-web |
就安装成功了
启动cobbler
改配置
/etc/cobbler/settings
1 | default_password_crypted: "$1$bfI7WLZz$PxXetL97LkScqJFxnW7KS1" # 123456 |
1 | sudo service httpd start |
检查配置
1 | sudo cobbler check |
提示
1 | 1 : SELinux is enabled. Please review the following wiki page for details on ensuring cobbler works correctly in your SELinux environment: |
根据提示一一修改
解决方法
- disable selinux
- 改配置文件
- 执行cobbler get-loaders
- 新建/etc/xinetd.d/rsync,增加disable = no,修改 rsync 和 tftp 这两个服务的 xinetd 配置
1 | # vi /etc/xinetd.d/rsync |
- 不支持debian系,cobbler服务器能同时部署CentOS/Fedora/Debian/Ubuntu系统,所以需要安装debmirror,安装debmirror-20090807-1.el5.noarch.rpm,在此之前,需要先安装一些其他的依赖包:
暂时不管,我这里只测试centos1
2wget ftp://rpmfind.net/linux/epel/6/x86_64/debmirror-2.14-2.el6.noarch.rpm
sudo rpm -ivh debmirror-2.14-2.el6.noarch.rpm
1 | # yum install ed patch perl perl-Compress-Zlib perl-Cwd perl-Digest-MD5 perl-Digest-SHA1 perl-LockFile-Simple perl-libwww-perl |
- 生成密码。修改默认系统密码用 openssl 生成一串密码后加入到 cobbler 的配置文件(/etc/cobbler/settings)里,替换 default_password_crypted 字段:
1 | # openssl passwd -1 -salt ‘bihan’ ‘Abcd1234′ |
- yum install cman或者fence-agents,我装的是fence-agents
改完之后运行
1 | sudo service cobblerd restart |
就只剩下debmirror的问题了,可以暂时不管
下载并挂载iso
1 | wget wget http://mirrors.sina.cn/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-1503-01.iso |
挂载时报错
1 | # sudo cobbler import --name=centos7 --arch=x86_64 --path=/mnt/centos |
删除
1 | sudo cobbler profile remove --name=centos7-x86_64 |
再重来,看看是不是哪里代码的问题
python编码的问题,在python的Lib\site-packages文件夹下新建一个sitecustomize.py1
2
3
4
5# encoding=utf8
import sys
reload(sys)
sys.setdefaultencoding('utf8')
1 | sudo cobbler distro report |
本博客欢迎转发,但请保留原作者信息
github:codejuan