centos7+cobbler安装

cobbler工作流程
1、安装软件包:
yum -y install httpd dhcp tftp python-ctypes cobbler xinetd cobbler-web pykickstart
ip addr add dev ens3 10.0.0.101/24 配置文件目录:
/etc/cobbler
/etc/cobbler/settings : cobbler 主配置文件
/etc/cobbler/iso/: iso模板配置文件
/etc/cobbler/pxe: pxe模板文件
/etc/cobbler/power: 电源配置文件
/etc/cobbler/user.conf: web服务授权配置文件
/etc/cobbler/users.digest: web访问的用户名密码配置文件
/etc/cobbler/dhcp.template : dhcp服务器的的配置末班
/etc/cobbler/dnsmasq.template : dns服务器的配置模板
/etc/cobbler/tftpd.template : tftp服务的配置模板
/etc/cobbler/modules.conf : 模块的配置文件 数据目录:
/var/lib/cobbler/config/: 用于存放distros,system,profiles 等信 息配置文件
/var/lib/cobbler/triggers/: 用于存放用户定义的cobbler命令
/var/lib/cobbler/kickstart/: 默认存放kickstart文件
/var/lib/cobbler/loaders/: 存放各种引导程序 镜像目录
/var/www/cobbler/ks_mirror/: 导入的发行版系统的所有数据
/var/www/cobbler/images/ : 导入发行版的kernel和initrd镜像用于 远程网络启动
/var/www/cobbler/repo_mirror/: yum 仓库存储目录 日志目录:
/var/log/cobbler/installing: 客户端安装日志
/var/log/cobbler/cobbler.log : cobbler日志 cobbler命令介绍:
cobbler check 核对当前设置是否有问题
cobbler list 列出所有的cobbler元素
cobbler report 列出元素的详细信息
cobbler sync 同步配置到数据目录,更改配置最好都要执行下
cobbler reposync 同步yum仓库
cobbler distro 查看导入的发行版系统信息
cobbler system 查看添加的系统信息
cobbler profile 查看配置信息
2、配置cobbler:
1、安装完成后执行cobbler check(会报以下错误): The following are potential configuration items that you may want to fix:
1 : The 'server' field in /etc/cobbler/settings must be set to something other than localhost, or kickstarting features will not work. This should be a resolvable hostname or IP for the boot server as reachable by all machines that will use it.
2 : For PXE to be functional, the 'next_server' field in /etc/cobbler/settings must be set to something other than 127.0.0.1, and should match the IP of the boot server on the PXE network.
3 : change 'disable' to 'no' in /etc/xinetd.d/tftp
4 : Some network boot-loaders are missing from /var/lib/cobbler/loaders, you may run 'cobbler get-loaders' to download them, or, if you only want to handle x86/x86_64 netbooting, you may ensure that you have installed a *recent* version of the syslinux package installed and can ignore this message entirely. Files in this directory, should you want to support all architectures, should include pxelinux.0, menu.c32, elilo.efi, and yaboot. The 'cobbler get-loaders' command is the easiest way to resolve these requirements.
5 : enable and start rsyncd.service with systemctl
6 : debmirror package is not installed, it will be required to manage debian deployments and repositories
7 : The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobbler/settings) is still set to 'cobbler' and should be changed, try: "openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'" to generate new one
8 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them
Restart cobblerd and then run 'cobbler sync' to apply changes. 错误1:
sed -i 's/^server: 127.0.0.1/server: 10.0.0.101/' /etc/cobbler/settings #修改server的ip地址为本机ip 错误2:
sed -i 's/^next_server: 127.0.0.1/next_server: 10.0.0.101/' /etc/cobbler/settings #TFTP Server 的IP地址 错误3:
修改/etc/xinetd.d/tftp文件:
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot
disable = no #修改为no
per_source = 11
cps = 100 2
flags = IPv4
} 错误4:
cobbler get-loaders # 下载缺失的文件 错误5:
添加rsync到自启动并启动rsync
systemctl enable rsyncd
systemctl start rsyncd 错误6: 跟debian 相关,可以忽略 错误7:
修改root密码为123456:
[root@localhost ~]# openssl passwd -1 -salt '123456' '123456'
$1$123456$wOSEtcyiP2N/IfIl15W6Z0
[root@localhost ~]# vi /etc/cobbler/settings #修改settings配置文件中下面位置,把新生成的密码加进去
default_password_crypted: "$1$123456$wOSEtcyiP2N/IfIl15W6Z0” 错误8:
# fence设备相关,不用配置 2、 修改settings中参数,由cobbler控制dhcp:
vi /etc/cobbler/settings
manage_dhcp: 1 修改dhcp.templates配置文件
vi /etc/cobbler/dhcp.template
subnet 10.0.0.0 netmask 255.255.255.0 {
option routers 10.0.0.2;
option domain-name-servers 10.0.0.2;
option subnet-mask 255.255.255.0;
range dynamic-bootp 10.0.0.100 10.0.0.250;
}
3、重启服务并同步配置,改完dhcp必须要sync同步配置: systemctl restart cobblerd
systemctl start httpd
systemctl enable httpd
systemct1 enable cobblerd
cobbler sync #同步数据
cobbler check #再检查一遍 4、检查dhcp:
netstat -lnup|grep dhcp
3、导入镜像:
1、挂载系统镜像:
mount /dev/centos7.1.iso /mnt
2、导入系统镜像:
cobbler import --path=/mnt/ --name=CentOS-7.1-x86_64 --arch=x86_64 参数解释:
# --path 镜像路径
# --name 为安装源定义一个名字
# --arch 指定安装源是32位、64位、ia64, 目前支持的选项有: x86│x86_64│ia64
# 安装源的唯一标示就是根据name参数来定义,本例导入成功后,安装源的唯一标示就是:CentOS-7.1-x86_64,如果重复,系统会提示导入失败。 cobbler distro list #查看镜像列表 镜像存放目录:
#cobbler会将镜像中的所有安装文件拷贝到本地一份,放在/var/www/cobbler/ks_mirror下的CentOS-7.1-x86_64目录下。因此/var/www/cobbler目录必须具有足够容纳安装文件的空间。 3、指定ks.cfg文件及调整内核参数:
cd /var/lib/cobbler/kickstarts/ #Cobbler的ks.cfg文件存放位置
上传或编辑ks.cfg文件: CentOS-7.1-x86_64.cfg 查看安装镜像文件信息:
cobbler distro report --name=CentOS-7.1-x86_64
查看所有的profile设置:
cobbler profile report
查看指定的profile设置:
cobbler profile report --name=CentOS-7.1-x86_64 # 编辑profile,修改关联的ks文件
cobbler profile edit --name=CentOS-7.1-x86_64 --kickstart=/var/lib/cobbler/kickstarts/CentOS-7.1-x86_64.cfg # 修改安装系统的内核参数,在CentOS7系统有一个地方变了,就是网卡名变成eno16777736这种形式,但是为了运维标准化,我们需要将它变成我们常用的eth0,因此使用下面的参数。但要注意是CentOS7才需要下面的步骤,CentOS6不需要。
cobbler profile edit --name=CentOS-7.1-x86_64 --kopts='net.ifnames=0 biosdevname=0'
cobbler profile report CentOS-7.1-x86_64 # 每次修改完都要同步一次
cobbler sync cobbler的web页面地址:https://10.0.0.101/cobbler_web
之后就可以通过pxe安装系统
4、cobbler-api
cobbler也是通过restful-api来调用对应的接口,下面请看两个小脚本:
都是采用opython2.7版本运行的
[root@linux-node1 ~]# cat cobbler_list.py
#!/usr/bin/python
import xmlrpclib
server = xmlrpclib.Server("http://192.168.56.11/cobbler_api")
print server.get_distros()
print server.get_profiles()
print server.get_systems()
print server.get_images()
print server.get_repos()
下面看看创建system模版的:
[root@linux-node1 ~]# cat cobbler-api.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import xmlrpclib class CobblerAPI(object):
def __init__(self,url,user,password):
self.cobbler_user= user
self.cobbler_pass = password
self.cobbler_url = url def add_system(self,hostname,ip_add,mac_add,profile):
'''
Add Cobbler System Infomation
'''
ret = {
"result": True,
"comment": [],
}
#get token
remote = xmlrpclib.Server(self.cobbler_url)
token = remote.login(self.cobbler_user,self.cobbler_pass) #add system
system_id = remote.new_system(token)
remote.modify_system(system_id,"name",hostname,token)
remote.modify_system(system_id,"hostname",hostname,token)
remote.modify_system(system_id,'modify_interface', {
"macaddress-eth0" : mac_add,
"ipaddress-eth0" : ip_add,
"dnsname-eth0" : hostname,
}, token)
remote.modify_system(system_id,"profile",profile,token)
remote.save_system(system_id, token)
try:
remote.sync(token)
except Exception as e:
ret['result'] = False
ret['comment'].append(str(e))
return ret def main():
cobbler = CobblerAPI("http://192.168.56.11/cobbler_api","cobbler","")
ret = cobbler.add_system(hostname='cobbler-api-test',ip_add='192.168.56.101',mac_add='00:50:56:21:65:78',profile='CentOS-7.0-1406-x86_64')
print ret if __name__ == '__main__':
main()
通过这样api的方式,也能够创建system模版实现安装主机的功能。
centos7+cobbler安装的更多相关文章
- 自动化运维之cobbler安装centos7.3
自动化运维之cobbler安装centos7.3 一.cobbler简介和服务 Cobbler是一款自动化操作系统安装的实现,与PXE安装系统的区别就是可以同时部署多个版本的系统,而PXE只能选择一种 ...
- cobbler 安装centos7.3时GPT问题(五)
磁盘分区表MBR和GPT介绍: MBR(Master Boot Record):最大只支持2 TB的盘,最多只支持4个主分区,信息只存储在一个区域. GPT(GUID partition table) ...
- Centos7 下cobbler安装及配置
1.背景介绍 作为运维,在公司经常遇到一些机械性重复工作要做,例如:为新机器装系统,一台两台机器装系统,可以用光盘.U盘等介质安装,1小时也完成了,但是如果有成百台的服务器还要用光盘.U盘去安装,就显 ...
- Centos7.4 下cobbler安装及配置
1.背景介绍 作为运维,在公司经常遇到一些机械性重复工作要做,例如:为新机器装系统,一台两台机器装系统,可以用光盘.U盘等介质安装,1小时也完成了,但是如果有成百台的服务器还要用光盘.U盘去安装,就显 ...
- centos7+cobbler+kickstart
一.cobbler简介 cobbler 是一个系统启动服务boot server,可以通过pxe得方式用来快速安装,重装系统,支持安装不同linux发行版和windows.这个工具是用python开发 ...
- centos 7 下 cobbler 安装
一.cobbler 介绍: Cobbler 是一个系统启动服务(boot server),可以通过网络启动(PXE)的方式用来快速安装.重装物理服务器和虚拟机,支持安装不同的 Linux 发行版和 W ...
- 在centos7上安装Jenkins
在centos7上安装Jenkins 安装 添加yum repos,然后安装 sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins ...
- CentOS7 Jenkins安装
CentOS7 Jenkins安装 CentOS7 Jenkins安装 Download 从Jenkins下载apache-tomcat-8.0.18.tar.gz Install 安装 上传RPM文 ...
- 在 CentOS7 上安装 zookeeper-3.4.9 服务
在 CentOS7 上安装 zookeeper-3.4.9 服务 1.创建 /usr/local/services/zookeeper 文件夹: mkdir -p /usr/local/service ...
随机推荐
- JavaScript之引用类型
js中的引用类型和其他语言中类的概念很相似,但并不一样. 引用类型是一种数据结构,就像房子的骨架,承载着数据和功能的衔接. 而对象,则是引用类型的具体实现,即实例. var person = new ...
- wb标准
1. WEB标准 WEB标准不是某一个标准,而是一系列标准的集合.网页主要由三部分组成:结构(Structure).表现(Presentation)和行为(Behavior).对应的标准也分三方面:结 ...
- imx6背光驱动调试
1.内核配置pwm背光驱动make menuconfig:Device Driver ---> Graphics support ---> [*] Backlight & LCD ...
- python如何连接mysql数据库
先花点时间来说说一个程序怎么和数据库进行交互1.和数据库建立连接2.执行sql语句,接收返回值3.关闭数据库连接使用MySQLdb也要遵循上面的几步.让我们一步步的进行. 1.MySQL数据库要用My ...
- 面试题:谈谈你对hibernate的理解
说说这类问题一般要和一个东西比較.说说他们的长处和缺点,hibernate就和JDBC比較呗.你就说说JDBC的优缺点.然后说说hibernate的优缺点,最后对照得出hibernate更好. hib ...
- linux c 常常混淆的概念
指针函数 and 函数指针 指针函数是指带指针的函数,即本质是一个函数.函数都有返回类型(假设不返回值,则为无值型),仅仅只是指针函数返回类型是某一类型的指针. 定义格式 类型名 *函数名(函数參数列 ...
- 怎么用源程序把ChemDraw结构复制到Word文档
在学习化学过程中,不可避免的会接触到各种化学结构.这个时候就需要通过绘制化学结构来进行这方面的学习和传播.ChemDraw Professional 15就可以辅助完成这方面的工作.很多的用户朋友会通 ...
- Laravel5.1 -控制器(初步了解)
首先道个歉 这篇笔记是前两天就应该写的,可大K有点事儿要忙 就耽误了,今天抽空学了学控制器,并写个笔记分享下. 为什么要使用控制器 像我们之前写一些逻辑呢都是在Route(路由)中,搞得Route文件 ...
- zoj2770 Burn the Linked Camp --- 差分约束
有n个营地,每一个营地至多容纳Ci人.给出m个条件:第i到第j个营地之间至少有k人. 问n个营地总共至少有多少人. 此题显然差分约束.要求最小值.则建立x-y>=z方程组,建图求最长路. 用d[ ...
- SQL Server 还原错误“restore database正在异常终止 错误 3154”
今天在还原数据库时,先建立相同名字的数据库,然后在该数据库上右键还原数据库.遇到了这样的一个错误: “备份集中的数据库备份与现有的 'RM_DB' 数据库不同. RESTORE DATABASE 正在 ...