cobbler+kickstart安装笔记

本文参考老男孩配置:https://blog.oldboyedu.com/autoinstall-cobbler/

centos7:开机如果不启动网卡,需要修改/etc/sysconfig/network-scripts/本地的网卡(一般为ens-xxx)将onboot改为yes

1.安装epel rpm源(这里使用的阿里云源)

yum clean all

rpm -ivh https://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm

2.安装前置安装环境

关闭防火墙,和selinux(不愿意关的话可以开放相应端口25151 69 22 80)

    systemctl stop firewalld  #停止防火墙

    systemctl disable firewalld  #禁止开机启动防火墙

    vi /etc/sysconfig/selinux  #修改selinux

     SELINUX=disabled

    reboot #重启 

下面安装基础环境

yum -y install cobbler cobbler-web pykickstart debmirror httpd dhcp xinetd xftp rsyncd

#这里我们启动服务,并设置开机启动

systemctl start httpd

systemctl enable httpd

systemctl start cobblerd

systemctl enable cobblerd

systemctl start xftp

systemctl enable xftp

systemctl start rsyncd

systemctl enable rsyncd
ksvalidator /var/lib/cobbler/kickstarts/CentOS7-7-x86_64.cfg #安装的pykickstart里面的工具,用来检查简单的语法错误登,但是有时候会误判,发现有朋友ks文件出问题,当初写的时候忘了补充下

配置cobbler:

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.

按照步骤设置

修改cobbler配置文件

vim /etc/cobbler/settings

#第一项 server 将server设置为提供cobbler服务的服务器ip(我这里是单虚拟机模拟所以就设置的为本机)

#server = 127.0.0.1
server = 192.168.184.130
#可以使用sed直接修改,第一次推荐还是先手动改改,多看看配置,后面就直接改了就行了
#sed -i 's/server: 127.0.0.1/server: 192.168.184.130/' /etc/cobbler/settings

#第一项 next_server 将提供pxe服务的ip

#next_server = 127.0.0.1
next_server = 192.168.184.130 #sed -i 's/next_server: 127.0.0.1/next_server:192.168.184.130/' /etc/cobbler/settings

#第三项 将tftp的disable 值从yes修改为no

vi /etc/xinetd.d/tftp
disable=no
#sed -i 's/disable=yes/disable=no/' /etc/xinetd.d/tftp

#第四项 下载网络安装所需文件

cobbler get-loaders   #注意,在上面步骤中,如果你不小心输错了你配置的server的ip地址的话,会报错,请先检查自己输入的ip是否正确。

#第五项 启动rsync(/etc/xinetd.d/rsync有些人分享的步骤中会有这个文件,但是实际上不用xinetd托管rsync也不影响,所以只要启动了服务就问题不大)

systemct start rsyncd

systemct  enable rsyncd

ps:如果在前面你像我一样启动了,这一步可以省略,这里只是为了对照cobbler的提示

#第六项 配置密码

#(执行下面命令后之后会出现加密后的密码,现在的版本随机值最好不要设置为random-phrase)

openssl passwd - -salt 'random-phrase-here' 'your-password-here' 

#将密码添加到/etc/cobbler/settings中的default_password值
#default_password_crypted: "$1$mF86/UHC$WvcIcX2t6crBz2onWxyac."

重启cobbler

systemctl restart httpd
systemctl restart cobbler

再次检查配置,若没有问题则提交同步

cobbler check

cobbler rsync 

#通过cobbler管理dhcp

#修改/etc/cobbler/settings值manage_dhcp: 1
#sed -i 's/manage_dhcp: 0/manage_dhcp: 1/' /etc/cobbler/settings

#查看cobbler的配置例子

vim /etc/cobbler/dhcp.template

subnet 192.168.184.0 netmask 255.255.255.0 {
option routers 192.168.184.2;
option domain-name-servers 192.168.184.2;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.184.100 192.168.184.254;

#导入镜像 先将镜像挂在,再通过import导入 --path为挂在镜像的路径 --name为名字 --arch为架构

mount /dev/cdrom /mnt
#mount: /dev/sr0 写保护,将以只读方式挂载 如果是虚拟机的朋友,导入挂载没发先cdrom,在虚拟机里将cdrom启动再挂载即可,path为镜像挂载的目录,name为你这个镜像的名称,arch为系统架构 cobbler import --path=/mnt/ --name=CentOS7 --arch=x86_64 #文件镜像位置为/var/www/cobbler/ks_mirror 

#kickstart

#将写好的启动配置文件文件上传至/var/lib/cobbler/kickstarts/CentOS7-7-x86_64.cfg目录下,下面是我使用的配置文件,可以根据自身需求修改配置文件(这个中文注释只是方便理解,在使用中的时候配置文件中不能有中文,需要全部删除)

#System

#设置字符集格式
lang en_US.UTF-
#设置键盘类型
keyboard us
#设置时区
timezone --utc Asia/Shanghai
#Root密码
rootpw --iscrypted $default_password_crypted
#text模式安装
text
#告知安装程序,这是一次全新安装,而不是升级
install
#通过cobbler安装镜像
url --url=$tree
#bootloader安装在mbr扇区(磁盘的0磁道0柱面1扇区前512字节,后64字节为分区信息,每个分区占16个字节)
bootloader --location=mbr
#清除mbr引导(清空引导扇区)
zerombr
#清空分区
clearpart --all --initlabel
#/boot分区
part /boot --fstype xfs --size --ondisk sda
#swap分区
part /swap --size --ondisk sda
#根分区
part / --fstype xfs --size --grow --ondisk sda
#设置密码格式
authconfig --enableshadow --passalgo=sha512
#网络信息
$SNIPPET('network_config')
#重启
reboot
#关闭防火墙
firewall --disabled
#关闭selinux
selinux --disabled
#不配置Xwindows
skipx
#安装包信息
%pre
$SNIPPET('log_ks_pre')
$SNIPPET('kickstart_start')
$SNIPPET('pre_install_network_config')
$SNIPPET('pre_anamon')
%end %packages
@ base
@ core
sysstat
iptraf
ntp
lrzsz
ncurses-devel
openssl=devel
zilb-devel
OpenIPMI-tools
mysql
nmap
screen
%end %post
systemctl disabled postfix.service
%end

上传了之后我们可以更新一下cobbler的默认配置文件(配置文件里面不能有中文,注释也不能有中文,否则会配置文件读取会出问题)

可以通过cobbler list命令查看

cobbler profile edit --name=CentOS7-x86_64 --kickstart=/var/lib/cobbler/kickstarts/CentOS7-7-x86_64.cfg

设置网卡名,因为在CentOS7之后网卡名会被命名为ens-XXXX的格式

cobbler profile edit --name=CentOS7-x86_64 --kopts='net.ifnames=0 biosdevname=0'

确认更新情况

cobbler profile report CentOS7-x86_64

cobbler sync 再次提交更新

可以查看下CentOS的启动文件

cat /var/lib/tftpboot/pxelinux.cfg/default

cobbler(报错):

1.tftp TimeOut :端口未开放
解决方法:systemctl stop firewalld systemctl disable firewalld

2./dev/root does not exist :在安装CentOS7的过程中会遇见这个问题,经过我查资料是(除了注释里有中文或者配置文件中有中文)找不到镜像目录,指定目录即可安装

distro:主要用来定义某个发行版特有的或者特用的ramdisk和kernel的,该命令主要用于对distro进行增加,编辑,拷贝,查找,移除,重命名操作。

https://anaconda-installer.readthedocs.io/en/latest/boot-options.html?highlight=ksdevice我们在anaconda的官方文档中看到的选项使用inst.repo=[http,https,ftp]://<host>/<path>指定镜像目录

cobbler distro edit --name=CentOS7-x86_64 --kopts="ksdevice= inst.repo=http://192.168.184.131/cblr/ks_mirror/CentOS7-x86_64/" --ksmeta="tree=http

cobbler+kickstart安装笔记的更多相关文章

  1. 末学者笔记--Centos7系统部署cobbler批量安装系统

      [前言]: cobbler是一个可以实现批量安装系统的Linux应用程序.它有别于pxe+kickstart,cobbler可以实现同个服务器批量安装不同操作系统版本. 系统环境准备及其下载cob ...

  2. 自动化安装操作系统(Centos7+PXE+Cobbler+kickstart)

    一.简介 PXE称作是一种引导方式而不是安装方式似乎更加准确,PXE(Pre-boot Execution Environment)是由Intel设计的协议,它可以使计算机通过网络启动,但是有一个前提 ...

  3. 使用Cobbler无人值守安装CentOS6.5(一)

    Cobbler是一个快速网络安装linux的服务,而且在经过调整也可以支持网络安装windows.该工具使用python开发,小巧轻便(才15k行代码),使用简单的命令即可完成PXE网络安装环境的配置 ...

  4. kickstart安装

    1.生成ks.cfg 文件 安装Kickstart # yum install system-config-kickstart 8.2 在桌面环境下配置Kickstart 启动X Windows 环境 ...

  5. 批量Linux 网络安装环境建立工具cobbler/kickstart

    批量Linux 网络安装环境建立工具网络安装服务器套件:     Cobbler(Red Hat 2008年发布的项目)    Kickstart(Red Hat08年前项目,相关脚本令人望而却步,现 ...

  6. 一键cobbler批量安装脚本

    前几天机房上架180台服务器,太多了,使用了cobbler批量安装,具体的看我上代码,我把配置cobbler的命令给堆积起来,也算是个脚本吧,欢迎拍砖指正,下面我上脚本: #!/bin/bash # ...

  7. cobbler简介+安装

    (介绍部分的内容部分是借鉴网上的非原创) 回顾pxe+kickstart PXE        PXE(preboot execute environment,预启动执行环境) PXE启动原理: 当计 ...

  8. cobbler部署安装CentOS6.8

    Linux运维:cobbler : 矮哥linux运维群:93324526 学习cobbler的话,必须先搞懂kickstart,原理不是,不懂如何排错. kickstart部署请点击这里 1. Co ...

  9. 使用cobbler批量安装操作系统(基于Centos7.x )

    1.1 cobbler简介 Cobbler是一个Linux服务器安装的服务,可以通过网络启动(PXE)的方式来快速安装.重装物理服务器和虚拟机,同时还可以管理DHCP,DNS等. Cobbler可以使 ...

随机推荐

  1. 初识 MyBatis

    框架技术 使用框架构建项目,当确定使用哪个技术框架后,就已经有了一个 “半成品”,然后在这个半成品上填上内容,完成任务需求. 框架技术的优点: (1)不用再考虑公共问题,框架已经帮我们做好了. (2) ...

  2. CCF201612-1 中间数 java(100分)

    试题编号: 201612-1 试题名称: 中间数 时间限制: 1.0s 内存限制: 256.0MB 问题描述: 问题描述 在一个整数序列a1, a2, …, an中,如果存在某个数,大于它的整数数量等 ...

  3. np.tile(), np.repeat() 和 tf.tile()

    以上三个函数,主要区别在于能够拓展维度上和重复方式: np.tile() 能够拓展维度,并且整体重复: a = np.array([0,1,2]) np.tile(a,(2,2)) # out # a ...

  4. extract a page from a multiple pages pdf on Ubuntu OS

    extract a page from a multiple pages pdf 1 extract a page from a multiple pages pdf use pdftk packag ...

  5. nyoj 8 一种排序(用vector,sort,不用set)

    一种排序 时间限制:3000 ms  |  内存限制:65535 KB 难度:3   描述 现在有很多长方形,每一个长方形都有一个编号,这个编号可以重复:还知道这个长方形的宽和长,编号.长.宽都是整数 ...

  6. noip模拟赛 戏

    [问题背景]zhx 和他的妹子(们) 做游戏.[问题描述]考虑 N 个人玩一个游戏,任意两个人之间进行一场游戏(共 N*(N-1)/2 场),且每场一定能分出胜负.现在, 你需要在其中找到三个人构成“ ...

  7. nginx,tornado,websocket,supervisord配置成型

    因为要上生产环境,所以配置还是专业一些比较好. nginx.conf upstream websocket_host { server 127.0.0.1:9527; } location /ws_l ...

  8. Ubuntu 16.04设置文件夹试图永久以列表显示

    图片来自:http://forum.ubuntu.org.cn/viewtopic.php?p=2043385

  9. VMware 9 安装 Mac OS X 10.8 Mountain Lion 图文全程

    http://unmi.cc/vmware9-install-mac-os-x-mountain-lion 非常详细,赞一下 本教程是在 VMware 9 下安装当前最新版的 Mac OS X Mou ...

  10. Manthan, Codefest 16 C

    建trie树,刚好字符串是反向的,直接在原图上向前搜索就OK了……………… 可怜的我竟然用了RK来hash,在test67那里T了…… 贴个RK的 #include <iostream> ...