cobbler部署linux查看密码,cobbler自动安装系统(Centos7.X)

环境:

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

CentOS Linux release7.4.1708(Core)

[root@kickstart~]# uname -r3.10.0-693.el7.x86_64

[root@kickstart~]# getenforce

Disabled

[root@kickstart~]# systemctl status firewalld.service

● firewalld.service- firewalld -dynamic firewall daemon

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

Active: inactive (dead)

Docs:man:firewalld(1)

[root@kickstart~]# hostname -I10.0.0.201 172.16.1.201

前言

cobbler安装比较简单,主要是网页操作,点点点,相对于PXE+kickstart网络安装更简单。

如果大家不了解PXE+kickstart网络安装系统过程原理的话,建议大家去看看我写的    

cobbler安装

1、下载cobbler及相关软件

[root@Cobbler ~]# yum -y install cobbler cobbler-web dhcp tftp-server pykickstart httpd

2、检查更改配置

注意:CentOS7上需要启动httpd服务和cobbler服务才能检查

[root@Cobbler ~]# systemctl start cobblerd.service httpd.service

[root@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 forthe 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/tftp4 : 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 systemctl6: debmirror package is not installed, it will be required to manage debian deployments and repositories7 : 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 one8 : 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 andthen run 'cobbler sync' to apply changes.

根据这些检查条目,进行更改相关的检查项

sed -i 's/server: 127.0.0.1/server: 172.16.1.202/' /etc/cobbler/settingssed -i 's/next_server: 127.0.0.1/next_server: 172.16.1.202/' /etc/cobbler/settingssed -i 's/manage_dhcp: 0/manage_dhcp: 1/' /etc/cobbler/settingssed -i 's/pxe_just_once: 0/pxe_just_once: 1/' /etc/cobbler/settingssed -ri "/default_password_crypted/s#(.*: ).*#1"`openssl passwd -1 -salt 'oldboy' '123456'`"#" /etc/cobbler/settingssed -i 's#yes#no#' /etc/xinetd.d/tftp

systemctl start rsyncd

systemctl enable rsyncd

systemctl enable tftp.socket

systemctl start tftp.socket

systemctl restart cobblerd.service

修改dhcp模板配置文件

sed -i.ori 's#192.168.1#172.16.1#g;22d;23d' /etc/cobbler/dhcp.template

同步所有配置

注意:不同步会报错

8f900a89c6347c561fdf2122f13be562.png

961ddebeb323a10fe0623af514929fc1.png

[root@Cobbler ~]# cobbler synctask started:2017-11-15_101915_sync

task started (id=Sync, time=Wed Nov 15 10:19:15 2017)

running pre-synctriggers

cleaning trees

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

copying bootloaders

trying hardlink/var/lib/cobbler/loaders/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0trying hardlink/var/lib/cobbler/loaders/menu.c32 -> /var/lib/tftpboot/menu.c32

trying hardlink/var/lib/cobbler/loaders/yaboot -> /var/lib/tftpboot/yaboot

trying hardlink/usr/share/syslinux/memdisk -> /var/lib/tftpboot/memdisk

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

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

copying distros to tftpboot

copying images

generating PXE configuration files

generating PXE menu structure

rendering DHCP files

generating/etc/dhcp/dhcpd.conf

rendering TFTPD files

generating/etc/xinetd.d/tftp

cleaning link caches

running post-synctriggers

running python triggers from/var/lib/cobbler/triggers/sync/post/*running python trigger cobbler.modules.sync_post_restart_services

running: dhcpd -t -q

received on stdout:

received on stderr:

running: service dhcpd restart

received on stdout:

received on stderr: Redirecting to /bin/systemctl restart dhcpd.service

running shell triggers from /var/lib/cobbler/triggers/sync/post/*

running python triggers from /var/lib/cobbler/triggers/change/*

running python trigger cobbler.modules.scm_track

running shell triggers from /var/lib/cobbler/triggers/change/*

*** TASK COMPLETE ***

一坨

cobbler使用操作

博主使用虚拟机操作

https://10.0.0.202/cobbler_web 浏览器访问网址

账号密码默认均为cobbler

65185e2b0324434d0139d2b18a52313d.png

导入镜像(import DVD)

说明:首先虚拟机保证下列以操作

3b631494ae79cce06c23d46ecbf0eec9.png

根据镜像位置,进行挂载

a0a1c0cd2bf67f6bdc44efb12b614d2e.png

因为镜像位置写的mnt,所以要将镜像挂载到mnt下

[root@Cobbler pxelinux.cfg]#mount /dev/cdrom /mnt/[root@Cobbler pxelinux.cfg]#df -h

Filesystem Size Used Avail Use%Mounted on/dev/sda3 98G 5.8G 93G 6% /devtmpfs 902M0 902M 0% /dev

tmpfs 912M0 912M 0% /dev/shm

tmpfs 912M8.7M 903M 1% /run

tmpfs 912M0 912M 0% /sys/fs/cgroup/dev/sda1 1014M 135M 880M 14% /boot

tmpfs 183M0 183M 0% /run/user/0

/dev/sr0 4.3G 4.3G 0 100% /mnt

查看进程,看是否在导入

[root@Cobbler~]# ps -ef|greprsync

root15923 1 0 09:49 ? 00:00:00 /usr/bin/rsync --daemon --no-detach

root17237 15973 15 10:53 ? 00:00:03 rsync -a /mnt/ /var/www/cobbler/ks_mirror/CentOS7.4-x86_64 --progress

root17238 17237 0 10:53 ? 00:00:00 rsync -a /mnt/ /var/www/cobbler/ks_mirror/CentOS7.4-x86_64 --progress

root17239 17238 11 10:53 ? 00:00:02 rsync -a /mnt/ /var/www/cobbler/ks_mirror/CentOS7.4-x86_64 --progress

ks文件组成

命令段

install开头,到%pre

包组段

以%packages开头,以%end结束

脚本段

以%post开头,以%end结束,在安装完系统之后执行的相关Linux命令、脚本

以%pre开头,以%end结束,在安装完系统之前执行的相关Linux命令、脚本

kickstart文件语法检查

下载语法检查软件

yum install pykickstart -y

检查命令

[root@CentOS7 tftpboot]# ksvalidator /var/www/html/ks_config/CentOS-7-ks.cfg

说明:请记住这个验证工具有其局限性。Kickstart 文件可能会很复杂;ksvalidator 可保证其语法正确,且该文件不包含淘汰的选项,但它无法保证安装会成功。它也不会尝试验证 Kickstart 文件的%pre、%post 和 %packages 部分。

root加密密码生成

密码:123456

[root@CentOS7 ~]# python -c 'import crypt; print(crypt.crypt("123456"))'$6$02PfimLMqN53z6Io$ov2Xbjm7ZC36X2tFvqnI0HymvqMY0vI/UOCxze0L/zMX722PkDJOz/JTWwVHaksawGf/bfR0k3GCpubodKTdV0

CentOS7的ks文件添加

CentOS7 ks文件内容

8f900a89c6347c561fdf2122f13be562.png

961ddebeb323a10fe0623af514929fc1.png

# Cobbler for Kickstart Configurator for CentOS 7by yao zhanginstallurl--url=$tree

text

lang en_US.UTF-8keyboard us

zerombr

bootloader--location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"#Network information

$SNIPPET('network_config')

#network--bootproto=dhcp --device=eth0 --onboot=yes --noipv6 --hostname=CentOS7

timezone--utc Asia/Shanghai

authconfig--enableshadow --passalgo=sha512

rootpw--iscrypted $default_password_crypted

clearpart--all --initlabel

part/boot --fstype xfs --size 1024part swap--size 1024part/ --fstype xfs --size 1 --grow

firstboot--disable

selinux--disabled

firewall--disabled

logging--level=inforeboot%pre

$SNIPPET('log_ks_pre')

$SNIPPET('kickstart_start')

$SNIPPET('pre_install_network_config')

# Enable installation monitoring

$SNIPPET('pre_anamon')%end%packages

@^minimal

@compat-libraries

@core

@debugging

@development

bash-completion

chrony

dos2unix

kexec-tools

lrzsz

nmap

sysstat

telnet

tree

vimwget

%end%post

systemctl disable postfix.service%end

ks文件内容

572c273fc45cae69b15ded62fabce921.png

73e367ae1d86230351b75308c4a07a3b.png

修改镜像变量属性

ff3dd34398aaf6652a9385f2806e1dcf.png

54b3967195ffd36436aea352e50c0d70.png

自定义安装系统

a400403d5b6f7f53d0a3f42c046d34b9.png

6b637a2b2e1b714c8bf6dcce6d752cea.png

f0597beeb54a240ed278534c8605bfdf.png

ef9ebfa2b923cf0206f82e3e4c2202a9.png

26fc04d0fb035e9d3eb0af683e3c58c4.png

2d01261d80960c4ad41c865d86db0677.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值