第十二周

1、配置chrony服务,实现服务器时间自动同步

1.开启chrony服务

systemctl start chronyd
systemctl enable chronyd

2.配置服务源

vi /etc/chrony.conf

server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst

3.查看状态源

chronyc sourcestats -v

2、实现cobbler+pxe自动化装机

准备:
两台主机
一台DHCP,cobbler服务器(一个网卡,仅主机),一台测试机(一个网卡,仅主机)
关闭仅主机的vmware中dhcp服务
1.配置epel源

yum -y install epel-release
yum clean all
yum repolist

2.配置cobbler

yum -y install cobbler dhcp
systemctl start cobblerd httpd tftp
cobbler check

输入cobbler check后会提示一下步骤,只需要修改1,2,5,7(debian系统需要改centos系统不需要改),9建议改

[root@localhost ~]# 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 : SELinux is enabled. Please review the following wiki page for details on ensuring cobbler works correctly in your SELinux environment:
    https://github.com/cobbler/cobbler/wiki/Selinux
4 : change 'disable' to 'no' in /etc/xinetd.d/tftp
5 : 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.
6 : enable and start rsyncd.service with systemctl
7 : debmirror package is not installed, it will be required to manage debian deployments and repositories
8 : ksvalidator was not found, install pykickstart
9 : 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
10 : 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.

依次修改

sed -i 's/server: 127.0.0.1/server: 192.168.175.10/g' /etc/cobbler/settings
cobbler get-loaders

dhcp没有提示需要自己改参数

sed -i 's/manage_dhcp: 0/manage_dhcp: 1/' /etc/cobbler/settings

修改dhcp配置文件

vi /etc/cobbler/dhcp.template
修改部分内容
###################################################
subnet 192.168.175.0 netmask 255.255.255.0 {
     option routers             192.168.175.2;
     option domain-name-servers 180.76.76.76;
     option subnet-mask         255.255.255.0;
     range dynamic-bootp        192.168.175.100 192.168.175.200;
###################################################
systemctl restart cobblerd
cobbler sync
systemctl start dhcpd

3.创建yum源

mount -r /dev/sr0 /mnt/cdrom/
cobbler import --name=centos7-x86_64 --path=/mnt/cdrom --arch=x86_64

[root@localhost ]# cobbler distro list
   centos7-x86_64

4.准备ks文件

vi /var/lib/cobbler/kickstarts/ks7_mini.cfg
#必须要改行 url --url=$tree
#################################################
#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Install OS instead of upgrade
install
# Keyboard layouts
keyboard 'us'
# Root password
rootpw --iscrypted $1$9teneOiS$.Dt6KoJ4Rt9R90YpSRcFn0
# System language
lang en_US
# System authorization information
auth  --useshadow  --passalgo=sha512
# Use text mode install
text
firstboot --disable
# SELinux configuration
selinux --disabled

# Firewall configuration
firewall --disabled
# Network information
network  --bootproto=dhcp --device=eth0
# Reboot after installation
reboot
# System timezone
timezone Asia/Shanghai
# Use network installation
url --url=$tree
# System bootloader configuration
bootloader --append="net.ifnames=0" --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part /boot --fstype="xfs" --size=200
part swap --fstype="swap" --size=2000
part / --fstype="xfs" --grow --size=1

%packages
@^minimal
%end
#############################################

[root@localhost kickstarts]# cobbler profile list
   centos7-x86_64

cobbler profile add --name=CentOS7-x86_64_mini --distro=centos7-x86_64 --kickstart=/var/lib/cobbler/kickstarts/ks7_mini.cfg

[root@localhost ]# cobbler profile list
   CentOS7-x86_64_mini
   centos7-x86_64

5.测试安装
内存至少需要1.5G

6. 实现web cobbler管理

yum install cobbler-web
systemctl restart httpd

https://192.168.175.10/cobbler_web

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值