CentOS7.9安装配置KickStart

Posted John08

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS7.9安装配置KickStart相关的知识,希望对你有一定的参考价值。

关闭防火墙,SeLinux。

[root@kickstart ~]# iptables –F;systemctl disable firewalld.service

[root@kickstart ~]# setenforce 0;sed -i \'s/SELINUX=enforcing/SELINUX=disabled/g\' /etc/selinux/config

安装DHCP服务


[root@kickstart ~]# yum install dhcpd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
No package dhcpd available.
Error: Nothing to do
[root@kickstart ~]# yum install dhcp
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package dhcp.x86_64 12:4.2.5-83.el7.centos.1 will be installed
--> Processing Dependency: dhcp-libs(x86-64) = 12:4.2.5-83.el7.centos.1 for package: 12:dhcp-4.2.5-83.el7.centos.1.x86_64
--> Processing Dependency: dhcp-common = 12:4.2.5-83.el7.centos.1 for package: 12:dhcp-4.2.5-83.el7.centos.1.x86_64
--> Running transaction check
---> Package dhcp-common.x86_64 12:4.2.5-82.el7.centos will be updated
--> Processing Dependency: dhcp-common = 12:4.2.5-82.el7.centos for package: 12:dhclient-4.2.5-82.el7.centos.x86_64
---> Package dhcp-common.x86_64 12:4.2.5-83.el7.centos.1 will be an update
---> Package dhcp-libs.x86_64 12:4.2.5-82.el7.centos will be updated
---> Package dhcp-libs.x86_64 12:4.2.5-83.el7.centos.1 will be an update
--> Running transaction check
---> Package dhclient.x86_64 12:4.2.5-82.el7.centos will be updated
---> Package dhclient.x86_64 12:4.2.5-83.el7.centos.1 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================================================
Package Arch Version Repository Size
===========================================================================================================================
Installing:
dhcp x86_64 12:4.2.5-83.el7.centos.1 updates 515 k
Updating for dependencies:
dhclient x86_64 12:4.2.5-83.el7.centos.1 updates 286 k
dhcp-common x86_64 12:4.2.5-83.el7.centos.1 updates 177 k
dhcp-libs x86_64 12:4.2.5-83.el7.centos.1 updates 133 k

Transaction Summary
===========================================================================================================================
Install 1 Package
Upgrade ( 3 Dependent packages)

Total download size: 1.1 M
Is this ok [y/d/N]: y
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/4): dhclient-4.2.5-83.el7.centos.1.x86_64.rpm | 286 kB 00:00:00
(2/4): dhcp-common-4.2.5-83.el7.centos.1.x86_64.rpm | 177 kB 00:00:00
(3/4): dhcp-4.2.5-83.el7.centos.1.x86_64.rpm | 515 kB 00:00:00
(4/4): dhcp-libs-4.2.5-83.el7.centos.1.x86_64.rpm | 133 kB 00:00:00
---------------------------------------------------------------------------------------------------------------------------
Total 4.4 MB/s | 1.1 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : 12:dhcp-libs-4.2.5-83.el7.centos.1.x86_64 1/7
Updating : 12:dhcp-common-4.2.5-83.el7.centos.1.x86_64 2/7
Installing : 12:dhcp-4.2.5-83.el7.centos.1.x86_64 3/7
Updating : 12:dhclient-4.2.5-83.el7.centos.1.x86_64 4/7
Cleanup : 12:dhclient-4.2.5-82.el7.centos.x86_64 5/7
Cleanup : 12:dhcp-common-4.2.5-82.el7.centos.x86_64 6/7
Cleanup : 12:dhcp-libs-4.2.5-82.el7.centos.x86_64 7/7
Verifying : 12:dhcp-common-4.2.5-83.el7.centos.1.x86_64 1/7
Verifying : 12:dhcp-4.2.5-83.el7.centos.1.x86_64 2/7
Verifying : 12:dhcp-libs-4.2.5-83.el7.centos.1.x86_64 3/7
Verifying : 12:dhclient-4.2.5-83.el7.centos.1.x86_64 4/7
Verifying : 12:dhcp-common-4.2.5-82.el7.centos.x86_64 5/7
Verifying : 12:dhclient-4.2.5-82.el7.centos.x86_64 6/7
Verifying : 12:dhcp-libs-4.2.5-82.el7.centos.x86_64 7/7

Installed:
dhcp.x86_64 12:4.2.5-83.el7.centos.1

Dependency Updated:
dhclient.x86_64 12:4.2.5-83.el7.centos.1 dhcp-common.x86_64 12:4.2.5-83.el7.centos.1
dhcp-libs.x86_64 12:4.2.5-83.el7.centos.1

Complete!

配置DHCP服务


[root@kickstart ~]# cd /etc/dhcp/
[root@kickstart dhcp]# ls
dhclient.d dhclient-exit-hooks.d dhcpd6.conf dhcpd.conf scripts
[root@kickstart dhcp]# cat dhcpd.conf
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.example
# see dhcpd.conf(5) man page
#
[root@kickstart dhcp]# mv dhcpd.conf dhcpd.conf0622
[root@kickstart dhcp]# cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example dhcpd.conf
[root@kickstart dhcp]# ll
total 12
drwxr-xr-x. 2 root root 6 Jun 10 00:09 dhclient.d
drwxr-xr-x. 2 root root 28 Jun 22 10:51 dhclient-exit-hooks.d
-rw-r--r-- 1 root root 120 Jun 10 00:09 dhcpd6.conf
-rw-r--r-- 1 root root 3262 Jun 22 10:59 dhcpd.conf
-rw-r--r-- 1 root root 117 Jun 10 00:09 dhcpd.conf0622
drwxr-x--- 2 root dhcpd 28 Jun 22 10:51 scripts

在dhcpd.conf增加如下配置

subnet 192.168.20.0 netmask 255.255.255.0 {
range 192.168.20.101 192.168.20.200;
option domain-name-servers ns1.internal.example.org;
option domain-name "internal.example.org";
option routers 192.168.20.254;
option broadcast-address 192.168.20.255;
default-lease-time 600;
max-lease-time 7200;
next-server 192.168.20.100;
filename "pxelinux.0";
}

开启服务,并设为开机自动启动;


[root@kickstart ~]# cd /etc/dhcp/
[root@kickstart dhcp]# ls
dhclient.d dhclient-exit-hooks.d dhcpd6.conf dhcpd.conf scripts
[root@kickstart dhcp]# cat dhcpd.conf
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.example
# see dhcpd.conf(5) man page
#
[root@kickstart dhcp]# mv dhcpd.conf dhcpd.conf0622
[root@kickstart dhcp]# cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example dhcpd.conf
[root@kickstart dhcp]# ll
total 12
drwxr-xr-x. 2 root root 6 Jun 10 00:09 dhclient.d
drwxr-xr-x. 2 root root 28 Jun 22 10:51 dhclient-exit-hooks.d
-rw-r--r-- 1 root root 120 Jun 10 00:09 dhcpd6.conf
-rw-r--r-- 1 root root 3262 Jun 22 10:59 dhcpd.conf
-rw-r--r-- 1 root root 117 Jun 10 00:09 dhcpd.conf0622
drwxr-x--- 2 root dhcpd 28 Jun 22 10:51 scripts

在dhcpd.conf增加如下配置

subnet 192.168.20.0 netmask 255.255.255.0 {
range 192.168.20.101 192.168.20.200;
option domain-name-servers ns1.internal.example.org;
option domain-name "internal.example.org";
option routers 192.168.20.254;
option broadcast-address 192.168.20.255;
default-lease-time 600;
max-lease-time 7200;
next-server 192.168.20.100;
filename "pxelinux.0";
}

DHCP配置完成;

安装tftp-server服务;


[root@kickstart ~]# yum install tftp-server xinetd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package tftp-server.x86_64 0:5.2-22.el7 will be installed
---> Package xinetd.x86_64 2:2.3.15-14.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================================================
Package Arch Version Repository Size
==============================================kickstart安装

KickStart安装CentOS,同时安装和配置hadoop

Kickstart的配置

Kickstart无人值守安装

CentOS7.x安装kickstart

Centos-7.3配置PXE+kickstart无人值守安装