频道栏目
首页 > 网络 > 其他 > 正文

cobbler无人值守安装centos6和centos7

2019-01-29 11:41:15           
收藏   我要投稿
自动安装部署,局域网不能有多个DHCP,虚拟机网卡-cobbler网络类型,cobbler sync

一、cobbler服务器信息

[root@controller~]#cat/etc/redhat-release

CentOSLinuxrelease7.4.1708(Core)

[root@controller~]#getenforce

Disabled

[root@controller~]#systemctlstatusfirewalld

●firewalld.service-firewalld-dynamicfirewalldaemon

Loaded:loaded(/usr/lib/systemd/system/firewalld.service;disabled;vendorpreset:enabled)

Active:inactive(dead)

Docs:man:firewalld(1)

[root@controller~]#ifconfigeno16777736|awk-F"[:]+"'NR==2{print$3}'

192.168.153.11

[root@controller~]#hostname

controller.www.local

二、安装epel源和cobbler相关包

[root@controller~]#rpm-ivh

http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm

[root@controller~]#yuminstallcobblercobbler-webdhcptftp-serverpykickstarthttpdpython-ctypesxinetd-y

[root@controller~]#systemctlrestarthttpd

[root@controller~]#systemctlstartcobblerd

[root@controller~]#systemctlenablehttpd

[root@controller~]#systemctlenablecobblerd

[root@controller~]#systemctlstatushttpd

[root@controller~]#systemctlstatuscobblerd

三、cobbler配置

1、cobbler check检查并处理。

[root@controller~]#cobblercheckThefollowingarepotentialconfigurationitemsthatyoumaywanttofix:

1:The'server'fieldin/etc/cobbler/settingsmustbesettosomethingotherthanlocalhost,orkickstartingfeatureswillnotwork.ThisshouldbearesolvablehostnameorIPforthebootserverasreachablebyallmachinesthatwilluseit.

2:ForPXEtobefunctional,the'next_server'fieldin/etc/cobbler/settingsmustbesettosomethingotherthan127.0.0.1,andshouldmatchtheIPofthebootserveronthePXEnetwork.

3:change'disable'to'no'in/etc/xinetd.d/tftp

4:Somenetworkboot-loadersaremissingfrom/var/lib/cobbler/loaders,youmayrun'cobblerget-loaders'todownloadthem,or,ifyouonlywanttohandlex86/x86_64netbooting,youmayensurethatyouhaveinstalleda*recent*versionofthesyslinuxpackageinstalledandcanignorethismessageentirely.Filesinthisdirectory,shouldyouwanttosupportallarchitectures,shouldincludepxelinux.0,menu.c32,elilo.efi,andyaboot.The'cobblerget-loaders'commandistheeasiestwaytoresolvetheserequirements.

5:enableandstartrsyncd.servicewithsystemctl

6:debmirrorpackageisnotinstalled,itwillberequiredtomanagedebiandeploymentsandrepositories

7:Thedefaultpasswordusedbythesampletemplatesfornewlyinstalledmachines(default_password_cryptedin/etc/cobbler/settings)isstillsetto'cobbler'andshouldbechanged,try:"opensslpasswd-1-salt'random-phrase-here''your-password-here'"togeneratenewone

8:fencingtoolswerenotfound,andarerequiredtousethe(optional)powermanagementfeatures.installcmanorfence-agentstousethem

Restartcobblerdandthenrun'cobblersync'toapplychanges.

解决第1步和第2步:

[root@controller~]#vi/etc/cobbler/settings

server:192.168.153.11

next_server:192.168.153.11

manage_dhcp:1

解决第3步:

[root@controller~]#vi/etc/xinetd.d/tftp

disable=no

解决第4步:

[root@controller~]#cobblerget-loaders

taskstarted:2018-03-31_155437_get_loaders

taskstarted(id=DownloadBootloaderContent,time=SatMar3115:54:372018)

downloadinghttps://cobbler.github.io/loaders/READMEto/var/lib/cobbler/loaders/README

downloadinghttps://cobbler.github.io/loaders/COPYING.eliloto/var/lib/cobbler/loaders/COPYING.elilo

downloadinghttps://cobbler.github.io/loaders/COPYING.yabootto/var/lib/cobbler/loaders/COPYING.yaboot

downloadinghttps://cobbler.github.io/loaders/COPYING.syslinuxto/var/lib/cobbler/loaders/COPYING.syslinux

downloadinghttps://cobbler.github.io/loaders/elilo-3.8-ia64.efito/var/lib/cobbler/loaders/elilo-ia64.efi

downloadinghttps://cobbler.github.io/loaders/yaboot-1.3.17to/var/lib/cobbler/loaders/yaboot

downloadinghttps://cobbler.github.io/loaders/pxelinux.0-3.86to/var/lib/cobbler/loaders/pxelinux.0

downloadinghttps://cobbler.github.io/loaders/menu.c32-3.86to/var/lib/cobbler/loaders/menu.c32

downloadinghttps://cobbler.github.io/loaders/grub-0.97-x86.efito/var/lib/cobbler/loaders/grub-x86.efi

downloadinghttps://cobbler.github.io/loaders/grub-0.97-x86_64.efito/var/lib/cobbler/loaders/grub-x86_64.efi

***TASKCOMPLETE***

解决第5步:

[root@controller~]#systemctlstartrsyncd

[root@controller~]#systemctlenablersyncd

Createdsymlinkfrom/etc/systemd/system/multi-user.target.wants/rsyncd.serviceto/usr/lib/systemd/system/rsyncd.service.

解决第7步:

[root@controller~]#opensslpasswd-1-salt'suijizhi''gxm'

$1$suijizhi$7RpWQlgtVB8T8vrrCmV7v.

default_password_crypted:"$1$suijizhi$7RpWQlgtVB8T8vrrCmV7v."

[root@controller~]#systemctlrestartcobblerd

[root@controller~]#cobblercheck

Thefollowingarepotentialconfigurationitemsthatyoumaywanttofix:

1:debmirrorpackageisnotinstalled,itwillberequiredtomanagedebiandeploymentsandrepositories

2:fencingtoolswerenotfound,andarerequiredtousethe(optional)powermanagementfeatures.installcmanorfence-agentstousethem

Restartcobblerdandthenrun'cobblersync'toapplychanges.

这2个可以不解决,如果要解决用下面的命令安装,不过安装后再check又有其他提示。

[root@controller~]#yum-yinstalldebmirroryum-utilsfence-agents(我自己没安装)

备注:防止误重装系统的方法(网上方法,自己没有实验过)pxe安装只允许一次,防止误操作(在正式环境有用。实际测试来看,这个功能可以屏蔽掉)

[root@controller~]#sed-i's/pxe_just_once:0/pxe_just_once:1/g'/etc/cobbler/settings

[root@controller~]#grep'^pxe_just_once'/etc/cobbler/setting

2、修改dhcp模版文件,它会自动生产dhcp文件(网上也有cp一份模版重命名为/etc/dhcp/dhcpd.conf配置文件的方式)

[root@controller~]#vim/etc/cobbler/dhcp.template

subnet192.168.153.0netmask255.255.255.0{

optionrouters192.168.153.2;

optiondomain-name-servers192.168.153.2;

optionsubnet-mask255.255.255.0;

rangedynamic-bootp192.168.153.100192.168.153.254;

default-lease-time21600;

max-lease-time43200;

next-server$next_server;

class"pxeclients"{

matchifsubstring(optionvendor-class-identifier,0,9)="PXEClient";

ifoptionpxe-system-type=00:02{

filename"ia64/elilo.efi";

}elseifoptionpxe-system-type=00:06{

filename"grub/grub-x86.efi";

}elseifoptionpxe-system-type=00:07{

filename"grub/grub-x86_64.efi";

}elseifoptionpxe-system-type=00:09{

filename"grub/grub-x86_64.efi";

}else{

filename"pxelinux.0";

}

}}

3、复制pxelinux.0, menu.c32到/var/lib/cobbler/loaders/(不要做,我没做)

[root@controller~]#cd/usr/share/syslinux/

[root@controller~]#cp-r*/var/lib/cobbler/loaders/

4、重启服务器并同步配置:

[root@controller~]#systemctlrestartcobblerd

[root@controller~]#cobblersync

taskstarted:2018-03-31_173554_sync

taskstarted(id=Sync,time=SatMar3117:35:542018)

runningpre-synctriggers

cleaningtrees

removing:/var/lib/tftpboot/grub/images

copyingbootloaders

tryinghardlink/var/lib/cobbler/loaders/pxelinux.0->/var/lib/tftpboot/pxelinux.0

tryinghardlink/var/lib/cobbler/loaders/menu.c32->/var/lib/tftpboot/menu.c32

tryinghardlink/var/lib/cobbler/loaders/yaboot->/var/lib/tftpboot/yaboot

tryinghardlink/usr/share/syslinux/memdisk->/var/lib/tftpboot/memdisk

tryinghardlink/var/lib/cobbler/loaders/grub-x86.efi->/var/lib/tftpboot/grub/grub-x86.efi

tryinghardlink/var/lib/cobbler/loaders/grub-x86_64.efi->/var/lib/tftpboot/grub/grub-x86_64.efi

copyingdistrostotftpboot

copyingimages

generatingPXEconfigurationfiles

generatingPXEmenustructure

renderingDHCPfiles

generating/etc/dhcp/dhcpd.conf

renderingTFTPDfiles

generating/etc/xinetd.d/tftp

cleaninglinkcaches

runningpost-synctriggers

runningpythontriggersfrom/var/lib/cobbler/triggers/sync/post/*

runningpythontriggercobbler.modules.sync_post_restart_services

running:dhcpd-t-q

receivedonstdout:

receivedonstderr:

running:servicedhcpdrestart

receivedonstdout:

receivedonstderr:Redirectingto/bin/systemctlrestartdhcpd.service

runningshelltriggersfrom/var/lib/cobbler/triggers/sync/post/*

runningpythontriggersfrom/var/lib/cobbler/triggers/change/*

runningpythontriggercobbler.modules.scm_track

runningshelltriggersfrom/var/lib/cobbler/triggers/change/*

***TASKCOMPLETE***

5、检查dhcp是否正常

[root@controller~]#systemctlenabledhcpd.service

[root@controller~]#netstat-lnup|grepdhcp

udp000.0.0.0:670.0.0.0:*11738/dhcpd

udp000.0.0.0:11290.0.0.0:*11738/dhcpd

udp600:::31636:::*11738/dhcpd

6、记得启动下xinetd,要不客户端会报这个错误:PXE-E32:TFTP open timeout TFTP"Open"请求没有应答

[root@controller~]#systemctlrestartxinetd

[root@controller~]#netstat-anltup|grep:69

udp000.0.0.0:690.0.0.0:*12005/xinetd

7、加载centos7的光盘或ISO文件

[root@controller~]#mount/dev/cdrom/mnt/

mount:/dev/sr0写保护,将以只读方式挂载

[root@controller~]#cobblerimport--name=CentOS_7_x86_64--path=/mnt/

taskstarted:2018-03-31_164113_import

taskstarted(id=Mediaimport,time=SatMar3116:41:132018)

Foundacandidatesignature:breed=redhat,version=rhel6

Foundacandidatesignature:breed=redhat,version=rhel7

Foundamatchingsignature:breed=redhat,version=rhel7

Addingdistrosfrompath/var/www/cobbler/ks_mirror/CentOS_7_x86_64:

creatingnewdistro:CentOS_7-x86_64

tryingsymlink:/var/www/cobbler/ks_mirror/CentOS_7_x86_64->/var/www/cobbler/links/CentOS_7-x86_64

creatingnewprofile:CentOS_7-x86_64

associatingrepos

checkingforrsyncrepo(s)

checkingforrhnrepo(s)

checkingforyumrepo(s)

startingdescentinto/var/www/cobbler/ks_mirror/CentOS_7_x86_64forCentOS_7-x86_64

processingrepoat:/var/www/cobbler/ks_mirror/CentOS_7_x86_64

needtoprocessrepo/comps:/var/www/cobbler/ks_mirror/CentOS_7_x86_64

lookingfor/var/www/cobbler/ks_mirror/CentOS_7_x86_64/repodata/*comps*.xml

Keepingrepodataas-is:/var/www/cobbler/ks_mirror/CentOS_7_x86_64/repodata

***TASKCOMPLETE***

8、加载centos6.9的光盘或ISO文件

[root@controller~]#umount/mnt

加载centos6.9的光盘或ISO文件

[root@controller~]#mount/dev/cdrom/mnt/

[root@controller~]#cobblerimport--name=CentOS_6.9_x86_64--path=/mnt/

taskstarted:2018-03-31_174506_import

taskstarted(id=Mediaimport,time=SatMar3117:45:062018)

Foundacandidatesignature:breed=redhat,version=rhel6

Foundamatchingsignature:breed=redhat,version=rhel6

Addingdistrosfrompath/var/www/cobbler/ks_mirror/CentOS_6.9_x86_64:

creatingnewdistro:CentOS_6.9-x86_64

tryingsymlink:/var/www/cobbler/ks_mirror/CentOS_6.9_x86_64->/var/www/cobbler/links/CentOS_6.9-x86_64

creatingnewprofile:CentOS_6.9-x86_64

associatingrepos

checkingforrsyncrepo(s)

checkingforrhnrepo(s)

checkingforyumrepo(s)

startingdescentinto/var/www/cobbler/ks_mirror/CentOS_6.9_x86_64forCentOS_6.9-x86_64

processingrepoat:/var/www/cobbler/ks_mirror/CentOS_6.9_x86_64

needtoprocessrepo/comps:/var/www/cobbler/ks_mirror/CentOS_6.9_x86_64

lookingfor/var/www/cobbler/ks_mirror/CentOS_6.9_x86_64/repodata/*comps*.xml

Keepingrepodataas-is:/var/www/cobbler/ks_mirror/CentOS_6.9_x86_64/repodata

***TASKCOMPLETE***

[root@controller~]#ll/var/www/cobbler/ks_mirror/

总用量8

dr-xr-xr-x7rootroot40963月292017CentOS_6.9_x86_64

dr-xr-xr-x8rootroot409612月102015CentOS_7_x86_64

drwxr-xr-x2rootroot623月3117:48config

查看dirstro。

[root@controllersyslinux]#cobblerdistrolist

CentOS_6.9-x86_64

CentOS_7-x86_64

9、准备centos 7的ks文件(如果不定义ks文件,默认有一个,生产环境用自己定义一个)

[root@controller~]#vi/var/lib/cobbler/kickstarts/CentOS7_x86_64.ks.cfg

#version=DEVEL

#Systemauthorizationinformation

auth--enableshadow--passalgo=sha512

#InstallOSinsteadofupgrade

install

#Usenetworkinstallation

url--url=http://192.168.153.11/cobbler/ks_mirror/CentOS_7_x86_64

#Usegraphicalinstall

graphical

#RuntheSetupAgentonfirstboot

firstboot--enable

ignoredisk--only-use=sda

#Keyboardlayouts

keyboard--vckeymap=us--xlayouts='us'

#Systemlanguage

langen_US.UTF-8

#Networkinformation

network--bootproto=dhcp--device=eno16777736--onboot=yes--ipv6=auto

network--hostname=localhost.localdomain

#Rootpassword

rootpw--iscrypted$1$password$7ZK8mMeLGXxbNPeJEFJOU0

#Systemtimezone

timezoneAsia/Shanghai--isUtc

#Systembootloaderconfiguration

bootloader--append="crashkernel=auto"--location=mbr--boot-drive=sda

autopart--type=lvm

#Partitionclearinginformation

clearpart--none--initlabel

%packages

@^minimal

@core

kexec-tools

vim

wget

httpd

lrzsz

net-tools

%end

%addoncom_redhat_kdump--enable--reserve-mb='auto'

%end

selinux--disabled

reboot

10、准备centos 6.9的ks文件

[root@controller~]#vi/var/lib/cobbler/kickstarts/CentOS6.9_x86_64.ks.cfg

#version=DEVEL

#Firewallconfiguration

firewall--disabled

#InstallOSinsteadofupgrade

install

#Usenetworkinstallation

url--url=http://192.168.153.11/cobbler/ks_mirror/CentOS_6.9_x86_64

#Rootpassword

rootpw--iscrypted$1$password$7ZK8mMeLGXxbNPeJEFJOU0

#Systemauthorizationinformation

auth--useshadow--enablemd5

#Usegraphicalinstall

graphical

firstboot--disable

#Systemkeyboard

keyboardus

#Systemlanguage

langen_US

#SELinuxconfiguration

selinux--disabled

#Installationlogginglevel

logging--level=info

#Rebootafterinstallation

reboot

#Systemtimezone

timezone--isUtcAsia/Shanghai

#Networkinformation

network--bootproto=dhcp--device=eth0--onboot=on

#Systembootloaderconfiguration

key--skip

bootloader--append="rhgbquiet"--location=mbr--driveorder=sda

#CleartheMasterBootRecord

zerombr

#Partitionclearinginformation

clearpart--all--initlabel

#Diskpartitioninginformation

part/--fstype="ext4"--size=8192

partswap--fstype="swap"--size=1024

part/home--fstype="ext4"--size=2048

%packages

@base

kexec-tools

vim

wget

httpd

lrzsz

net-tools

%end

11、添加Cobbler Profile因为导入centos7和centos6.9后系统默认产生了2个,所以可以直接在上面修改,命令是cobbler profile edit --name=xxx --kickstart=xxx 。不过我这里是add新建,就是保留默认产生的2人,然后自己add新建两个。

[root@controllerkickstarts]#cobblerprofileadd

--name=CentOS7_X86_64-basic--distro=CentOS_7-x86_64

--kickstart=/var/lib/cobbler/kickstarts/CentOS7_x86_64.ks.cfg

[root@controller

kickstarts]#cobblerprofileedit--name=CentOS7_X86_64-basic

--kopts='net.ifnames=0biosdevname=0'

(这条是修改网卡名为eth0,但是我没做这个,生产环境会用到,7版本要用到,6版本不用)

[root@controller

kickstarts]#cobblerprofileadd--name=CentOS_6.9_X86_64-basic

--distro=CentOS_6.9-x86_64

--kickstart=/var/lib/cobbler/kickstarts/CentOS6.9_x86_64.ks.cfg

[root@controllerkickstarts]#cobblerprofilelist

CentOS7_X86_64-basic

CentOS_6.9-x86_64

CentOS_6.9_X86_64-basic

CentOS_7-x86_64

[root@controllerkickstarts]#cobblerprofilereport

Name:CentOS7_X86_64-basic

TFTPBootFiles:{}

Comment:

DHCPTag:default

Distribution:CentOS_7-x86_64

EnablegPXE:0

EnablePXEMenu:1

FetchableFiles:{}

KernelOptions:{}

KernelOptions(PostInstall):{}

Kickstart:/var/lib/cobbler/kickstarts/CentOS7_x86_64.ks.cfg

KickstartMetadata:{}

ManagementClasses:[]

ManagementParameters:<>

NameServers:[]

NameServersSearchPath:[]

Owners:['admin']

ParentProfile:

Internalproxy:

RedHatManagementKey:<>

RedHatManagementServer:<>

Repos:[]

ServerOverride:<>

TemplateFiles:{}

VirtAutoBoot:1

VirtBridge:xenbr0

VirtCPUs:1

VirtDiskDriverType:raw

VirtFileSize(GB):5

VirtPath:

VirtRAM(MB):512

VirtType:xenpv

Name:CentOS_7-x86_64

TFTPBootFiles:{}

Comment:

DHCPTag:default

Distribution:CentOS_7-x86_64

EnablegPXE:0

EnablePXEMenu:1

FetchableFiles:{}

KernelOptions:{}

KernelOptions(PostInstall):{}

Kickstart:/var/lib/cobbler/kickstarts/sample_end.ks

KickstartMetadata:{}

ManagementClasses:[]

ManagementParameters:<>

NameServers:[]

NameServersSearchPath:[]

Owners:['admin']

ParentProfile:

Internalproxy:

RedHatManagementKey:<>

RedHatManagementServer:<>

Repos:[]

ServerOverride:<>

TemplateFiles:{}

VirtAutoBoot:1

VirtBridge:xenbr0

VirtCPUs:1

VirtDiskDriverType:raw

VirtFileSize(GB):5

VirtPath:

VirtRAM(MB):512

VirtType:kvm

Name:CentOS_6.9_X86_64-basic

TFTPBootFiles:{}

Comment:

DHCPTag:default

Distribution:CentOS_6.9-x86_64

EnablegPXE:0

EnablePXEMenu:1

FetchableFiles:{}

KernelOptions:{}

KernelOptions(PostInstall):{}

Kickstart:/var/lib/cobbler/kickstarts/CentOS6.9_x86_64.ks.cfg

KickstartMetadata:{}

ManagementClasses:[]

ManagementParameters:<>

NameServers:[]

NameServersSearchPath:[]

Owners:['admin']

ParentProfile:

Internalproxy:

RedHatManagementKey:<>

RedHatManagementServer:<>

Repos:[]

ServerOverride:<>

TemplateFiles:{}

VirtAutoBoot:1

VirtBridge:xenbr0

VirtCPUs:1

VirtDiskDriverType:raw

VirtFileSize(GB):5

VirtPath:

VirtRAM(MB):512

VirtType:xenpv

Name:CentOS_6.9-x86_64

TFTPBootFiles:{}

Comment:

DHCPTag:default

Distribution:CentOS_6.9-x86_64

EnablegPXE:0

EnablePXEMenu:1

FetchableFiles:{}

KernelOptions:{}

KernelOptions(PostInstall):{}

Kickstart:/var/lib/cobbler/kickstarts/sample_end.ks

KickstartMetadata:{}

ManagementClasses:[]

ManagementParameters:<>

NameServers:[]

NameServersSearchPath:[]

Owners:['admin']

ParentProfile:

Internalproxy:

RedHatManagementKey:<>

RedHatManagementServer:<>

Repos:[]

ServerOverride:<>

TemplateFiles:{}

VirtAutoBoot:1

VirtBridge:xenbr0

VirtCPUs:1

VirtDiskDriverType:raw

VirtFileSize(GB):5

VirtPath:

VirtRAM(MB):512

VirtType:kvm

12、cobbler sync下(好像不执行这个也可以,以前那之前已经执行了)

[root@controller~]#cobblersync

13、客户端安装,网卡模式启动

 

Image

 

14、cobbler web界面配置

使用系统用户(pam)或者configfile定义用户登录管理cobblerweb[root@cobbler~]#vim/etc/cobbler/modules.conf

[authentication]

#module=authn_configfile(默认值)

module=authn_pam

[root@cobbler~]#useraddCadmin

[root@cobbler~]#echo"Cadmin"|passwd--stdinCadmin

ChangingpasswordforuserCadmin.

passwd:allauthenticationtokensupdatedsuccessfully.

[root@cobbler~]#vim/etc/cobbler/users.conf

[admins]

admin="Cadmin"

[root@controllerkickstarts]#systemctlrestartcobblerd

[root@controllerkickstarts]#systemctlrestarthttpd

访问地址

https://192.168.153.11/cobbler_web

-------------------------------------------------------------------------------------------------扩展1:客户端默认是从local启动的,需要手动选择启动项,如果要修改默认启动项,更改下面这个配置文件。LABEL CentOS_6.9-x86_64和LABEL CentOS_7-x86_64这个不是按照我的ks文件,默认密码是改settings配置文件那个。其它两个接basic是我自己的。

[root@controllerkickstarts]#vi/var/lib/tftpboot/pxelinux.cfg/default

DEFAULTmenu

PROMPT0

MENUTITLECobbler|http://www.gxm.com/

TIMEOUT200

TOTALTIMEOUT6000

ONTIMEOUTlocalLABELlocal

MENULABEL(local)

MENUDEFAULT

LOCALBOOT-1

LABELCentOS7_X86_64-basic

kernel/images/CentOS_7-x86_64/vmlinuz

MENULABELCentOS7_X86_64-basic

appendinitrd=/images/CentOS_7-x86_64/initrd.imgksdevice=bootiflang=kssendmactextks=http://192.168.153.11/cblr/svc/op/ks/profile/CentOS7_X86_64-basic

ipappend2

LABELCentOS_6.9-x86_64

kernel/images/CentOS_6.9-x86_64/vmlinuz

MENULABELCentOS_6.9-x86_64

appendinitrd=/images/CentOS_6.9-x86_64/initrd.imgksdevice=bootiflang=kssendmactextks=http://192.168.153.11/cblr/svc/op/ks/profile/CentOS_6.9-x86_64

ipappend2

LABELCentOS_6.9_X86_64-basic

kernel/images/CentOS_6.9-x86_64/vmlinuz

MENULABELCentOS_6.9_X86_64-basic

appendinitrd=/images/CentOS_6.9-x86_64/initrd.imgksdevice=bootiflang=kssendmactextks=http://192.168.153.11/cblr/svc/op/ks/profile/CentOS_6.9_X86_64-basic

ipappend2

LABELCentOS_7-x86_64

kernel/images/CentOS_7-x86_64/vmlinuz

MENULABELCentOS_7-x86_64

appendinitrd=/images/CentOS_7-x86_64/initrd.imgksdevice=bootiflang=kssendmactextks=http://192.168.153.11/cblr/svc/op/ks/profile/CentOS_7-x86_64

ipappend2

MENUend

或者修改[root@controllerkickstarts]#vi/etc/cobbler/pxe/pxedefault.template这个文件。

扩展2:通过MAC地址定制化安装(注意ks用默认产生的,因为你自建的ks一般可能你手动固定了主机名等,这样ks文件优先)我们可以根据不同的MAC地址来给安装 不同的操作系统、配置不同的静态iP、设置不同的主机名、应用指定的ks文件等等,vmware虚拟机查看MAC地址步骤如图:

 

Image

 

[root@localhostcobbler]#cobblersystemadd--name=gxm01

--mac=00:0C:29:88:17:13--profile=CentOS_7-x86_64

--ip-address=192.168.153.200--subnet=255.255.255.0

--gateway=192.168.153.2--interface=eth0--static=1--hostname=linux-gxm

--name-servers="114.114.114.1148.8.8.8"

--kickstart=/var/lib/cobbler/kickstarts/sample_end.ks

[root@localhostcobbler]#cobblersystemlist

gxm01

如果误操作了,可以删除重新add

[root@controller~]#cobblersystemremove--namegxm01

如果要修改,用下面的命令获取帮助

[root@controller~]#cobblersystemedit--help

接下来我们创建一个虚拟机,mac地址为00:0C:29:88:17:13,启动后会发现自动进入安装系统了,等安装完以后,所有的配置都和我们当初设置的一样。

扩展3:

备注1:网友的遇到的一个问题处理版本

期间因为导入CentOS7的镜像文件时我的电脑磁盘满了而虚拟机停止,触发了一个Cobbler的BUG,再次启动虚拟机后重新导入CentOS7的映像文件时显示如下。

#cobblerimport--name=CentOS_7_x86_64--path=/mnt/

Traceback(mostrecentcalllast):

File"/usr/bin/cobbler",line35,in

sys.exit(app.main())

File"/usr/lib/python2.6/site-packages/cobbler/cli.py",line644,inmain

rc=cli.run(sys.argv)

File"/usr/lib/python2.6/site-packages/cobbler/cli.py",line270,inrun

self.token=self.remote.login("",self.shared_secret)

File"/usr/lib64/python2.6/xmlrpclib.py",line1199,in__call__

returnself.__send(self.__name,args)

File"/usr/lib64/python2.6/xmlrpclib.py",line1489,in__request

verbose=self.__verbose

File"/usr/lib64/python2.6/xmlrpclib.py",line1253,inrequest

returnself._parse_response(h.getfile(),sock)

File"/usr/lib64/python2.6/xmlrpclib.py",line1392,in_parse_response

returnu.close()

File"/usr/lib64/python2.6/xmlrpclib.py",line838,inclose

raiseFault(**self._stack[0])

xmlrpclib.Fault::'loginfailed'">

解决方法。

#servicecobblerdrestart

Stoppingcobblerdaemon:[OK]

Startingcobblerdaemon:[OK]

#cobblerget-loaders

重新导入。

#cobblerimport--name=CentOS_7_x86_64--path=/mnt/

taskstarted:2014-10-08_173739_import

taskstarted(id=Mediaimport,time=WedOct817:37:392014)

Foundacandidatesignature:breed=redhat,version=rhel6

Foundacandidatesignature:breed=redhat,version=fedora16

Foundacandidatesignature:breed=redhat,version=fedora17

Foundacandidatesignature:breed=redhat,version=fedora18

Nosignaturematchedin/var/www/cobbler/ks_mirror/CentOS_7_x86_64

!!!TASKFAILED!!!

这个时候又一次的出错了:!!!TASKFAILED!!!,使用如下命令解决。

#cobblersignatureupdate

再次导入。

#cobblerimport--name=CentOS_7_x86_64--path=/mnt/

备注2:Cobbler子命令介绍

cobblercheck#检查cobbler配置

cobblersync#步配置到dhcppxe和数据目录

cobblerlist#列出所有的cobbler元素

cobblerimport#导入安装的系统光盘镜像

cobblerreport#列出各元素的详细信息

cobblerdistro#查看导入的发行版系统信息

cobblerprofile#查看配置信息

cobblersystem#查看添加的系统信息

cobblerreposync#同步yum仓库到本地

备注3:配置文件目录:

/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:模块的配置文件

备注4:数据目录:

/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仓库存储目录

备注5:日志目录:

/var/log/cobbler/installing:客户端安装日志

/var/log/cobbler/cobbler.log:cobbler日志

备注6:使用koan实现重新安装系统

在客户端安装koan(要配置好源)

[root@localhost~]#rpm-ivhhttp://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-10.noarch.rpm

[root@localhost~]#yuminstallkoan

查看cobbler上的配置文件

[root@localhost~]#koan--server=10.0.0.101--list=profiles

-lookingforCobblerathttp://10.0.0.101:80/cobbler_api

Centos-7.2-x86_64

重新安装客户端系统

[root@localhost~]#koan--replace-self--server=10.0.0.101--profile=webserver1

重启系统后会自动重装系统

上一篇:编译安装Centos7.2+Apache2.4.25+PHP7.2.10+Mysql5.6.16
下一篇:Linux的samba服务解析
相关文章
图文推荐
文章
推荐
热门新闻

关于我们 | 联系我们 | 广告服务 | 投资合作 | 版权申明 | 在线帮助 | 网站地图 | 作品发布 | Vip技术培训 | 举报中心

版权所有: 红黑联盟--致力于做实用的IT技术学习网站