linux-PXE-12
以DHCP+DNS模式管理服务器IP地址和主机名。服务器上架前,以其MAC地址为依据,在DHCP中配置主机保留并分配主机名。DHCP结合TFTP提供的PXE服务,提供PXE引导Linux内核和启动镜像,通过自动应答文件来实现操作系统的自动安装和配置。 基本过程 ①??PXE?客户端发送UDP广播请求 1) cat /etc/xinetd.d/tftp service tftp ? 引导文件 - pxelinux.0 从光盘镜像( isolinux )中拷贝 到tftp根目录中 创建pxelinux.cfg目录并拷贝 isolinux.cfg 为default 修改 可以创建多个label 以便有多个选择 [[email?protected] /var/lib/tftpboot] # cat pxelinux.cfg/default default vesamenu.c32 timeout 600 menu title #### PXE Boot Menu #### label 1 menu label ^Install CentOS 7 x64 menu default kernel vmlinuz append initrd=initrd.img ip=dhcp inst.ks=ftp://192.168.36.1/pub/ks.cfg defualt文件 指定 系统自动安装的ks路径 DEFAULT menu PROMPT 0 MENU TITLE Cobbler | auto os installtion TIMEOUT 200 TOTALTIMEOUT 6000 ONTIMEOUT local LABEL local MENU LABEL (local) MENU DEFAULT LOCALBOOT -1 LABEL Centos7.2-x86_64 kernel /images/Centos7.2-x86_64/vmlinuz MENU LABEL Centos7.2-x86_64 append initrd=/images/Centos7.2-x86_64/initrd.img ksdevice=bootif lang= kssendmac text ks=http://127.0.0.1/cblr/svc/op/ks/profile/Centos7.2-x86_64 ipappend 2 MENU end 2)dhcp 配置 dhcp subnet 192.168.36.0 netmask 255.255.255.0 { 在多网卡的情况下绑定网卡启动DHCP服务cat /usr/lib/systemd/system/dhcpd.service 3)安装vsftpd 为了将光盘系统拷贝进去 拷贝ks.cfg 到ftp根目录中,由 system-config-kickstart 生成 url --url=" " 指定了系统所在目录 [[email?protected] /var/ftp/pub] # cat ks.cfg #platform=x86,AMD64,or Intel EM64T #version=DEVEL # Install OS instead of upgrade install # Keyboard layouts keyboard 'us' # Root password rootpw --iscrypted $1$Xn4pvDTh$GfSGHsPCHomsp88ZRR6/H/ # Use network installation url --url="ftp://192.168.36.1/pub" # System language lang en_US # Firewall configuration firewall --disabled # System authorization information auth --useshadow --passalgo=sha512 # Use text mode install text # SELinux configuration selinux --disabled # Do not configure the X Window System skipx # Network information network --bootproto=dhcp --device=eth0 # Reboot after installation reboot # System timezone timezone Africa/Abidjan # System bootloader configuration bootloader --location=mbr # Partition clearing information clearpart --all --initlabel # Disk partitioning information part /boot --fstype="xfs" --size=2048 part / --fstype="xfs" --grow --size=1 (anaconda-ks.cfg) 通过光盘自动安装 https://www.cnblogs.com/liwei0526vip/p/6416225.html pxe https://www.cnblogs.com/liwei0526vip/p/6386718.html cobblerCobbler/Cobblerd add extend repowget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo 需要epel 及yum 源 yum install cobbler cobbler-web dhcp tftp-server pykickstart httpd xinetd -y systemctl start httpd 执行cobbler check 生成加密密码 需要修改的配置 sed -i ‘s%^server: 127.0.0.1%server: 192.168.0.238%g‘ /etc/cobbler/settings # 本机ip 修改dhcp.templates子网信息 cobbler check cobbler get-loaders cobbler sync 同步 挂载光盘,导入镜像 导入ks.cfg文件到/var/lib/cobbler/kickstarts 写完 ks 文件之后,先通过 validateks 测试一下有没有语法错误cobbler validateks通过下面这个命令查看 ks 文件,发现一些逻辑上的问题cobbler system getks --name=testcobbler profile edit --name Centos-7.2-x86_64 --kickstart=/var/lib/cobbler/kickstarts/ks.cfg # 编辑profile,ks.cfg 添加系统参数 定制选择安装系统时显示的网址 根据MAC安装系统 system add? #? 添加定制系统 ¥¥¥¥¥¥¥¥¥¥ 对象类型 Distros(发行版):表示一个操作系统,它承载了内核和initrd的信息,以及内核生成参数等其他数据 重要目录及对象关系 配置cobbler 还有需求: 启动后优化脚本 创建本地yum 源 配置文件目录: 常用命令 一 default_password_crypted: "$1$gEc7ilpP$pg5iSOj/mlxTxEslhRvyp/" 配置cobbler--DHCP1,vim /etc/cobbler/settings # 修改settings中参数,由cobbler控制dhcp 修改配置文件后须重启服务且sync同步配置 环境检查报错解决 可访问互联网时,执行cobbler get-loaders否则复制 执行“openssl passwd -1 生成密码,并用其替换/etc/cobbler/settings文件中 openssl passwd -1 ################################## 下载启动菜单 管理profile 查看profiles 同步cobbler配置 ######################## 二 cobbler import --path=/mnt --name=Centos-7.2 --arch=x86_64 # cobbler导入镜像 --path 镜像路径--name 为安装源定义一个名字--arch 指定安装源是32位、64位、ia64,目前支持的选项有: x86│x86_64│ia64安装源的唯一标示就是根据name参数来定义,本例导入成功后,安装源的唯一标示就是:CentOS-7.1-x86_64,如果重复,系统会提示导入失败查看 cobbler list 三 导入 kickstarts 查看信息 cobbler report 使用cobbler validataks 验证 cobbler profile list 指定ks文件 cobbler profile edit --name Centos-7.2-x86_64 --kickstart=/var/lib/cobbler/kickstarts/Centos7.2-x86_64.cfg # 编辑profile,修改ks文件为我们刚刚上传的Centos7.2-x86_64.cfg cobbler profile edit --name Centos-7.2-x86_64 --kopts=‘net.ifnames=0 biosdevname=0‘ 同步cobbler 开启服务 httpd koan实现重新安装系统 在客户端安装koan(要配置好源) epel 源配置 查看cobbler上的配置文件 koan --server=serverIP --list=profiles 重新安装系统 ks.cfg 配置模板 Centos-7.3-x86_64.cfg Kickstart Configurator by BrandynXplatform=x86,or Intel EM64TSystem languagelang en_US System keyboardkeyboard us Install OS instead of upgradeinstall Use text mode installtext Sytem timezonetimezone Asia/Shanghai Use NFS installation Mediaurl --url=$tree Root passwordrootpw --iscrypted $default_password_crypted Network information$SNIPPET(‘network_config‘) network --bootproto=dhcp --device=eth0 --onboot=onSystem authorization infomationauth --useshadow --enablemd5 Firewall configurationfirewall --disabled SELinux configurationselinux --disabled Reboot after installationreboot System bootloader configurationbootloader --location=mbr Clear the Master Boot Recordzerombr Partition clearing informationclearpart --all --initlabel Disk partitioning informationpart /boot --fstype xfs --size 1024 --ondisk sda Oracle:part swap --size 16384 --ondisk sdapart swap --size 2048 --ondisk sda Do not configure XWindowsskipx %pre Enable installation monitoring$SNIPPET(‘pre_anamon‘) Package install information%packages %post [[email?protected] ~]# cat anaconda-ks.cfg #platform=86,or Intel EM64T #version=DEVEL # System authorization information auth --useshadow --passalgo=sha512 # Install OS instead of upgrade install # Use network installation url --url="http://192.168.36.73/cobbler/ks_mirror/Centos-7.3-x86_64/" # Use graphical install graphical # Firewall configuration firewall --enabled firstboot --disable ignoredisk --only-use=sda # Keyboard layouts # old format: keyboard us # new format: keyboard --vckeymap=us --xlayouts='us' # System language lang en_US.UTF-8 # Network information network --bootproto=dhcp --device=eth0 --activate network --hostname=localhost.localdomain # Halt after installation halt # Root password rootpw --iscrypted $1$J7vTcYGq$uQYp8XPJVDuside2VcR9W. # SELinux configuration selinux --disabled # System services services --enabled="chronyd" # Do not configure the X Window System skipx # System timezone timezone Asia/Shanghai # System bootloader configuration bootloader --append="net.ifnames=0 biosdevname=0 crashkernel=auto" --location=mbr --boot-drive=sda # Partition clearing information clearpart --none --initlabel # Disk partitioning information part /boot --fstype="xfs" --ondisk=sda --size=953 part pv.352 --fstype="lvmpv" --ondisk=sda --size=19526 volgroup centos --pesize=4096 pv.352 logvol / --fstype="xfs" --size=9536 --name=root --vgname=centos logvol swap --fstype="swap" --size=953 --name=swap --vgname=centos logvol /data --fstype="xfs" --size=9022 --name=data --vgname=centos %packages @^minimal @core chrony kexec-tools %end %addon com_redhat_kdump --enable --reserve-mb='auto' %end [[email?protected] ~]# cat original-ks.cfg #platform=x86,or Intel EM64T #version=DEVEL # Install OS instead of upgrade install # Keyboard layouts keyboard 'us' # Root password rootpw --iscrypted $1$J7vTcYGq$uQYp8XPJVDuside2VcR9W. # Use network installation url --url="http://192.168.36.73/cobbler/ks_mirror/Centos-7.3-x86_64/" # System language lang en_US # System authorization information auth --useshadow --passalgo=sha512 # Use graphical install graphical # SELinux configuration selinux --disabled # Do not configure the X Window System skipx # Firewall configuration firewall --enabled # Network information network --bootproto=dhcp --device=eth0 # Halt after installation halt # System timezone timezone Asia/Shanghai # System bootloader configuration bootloader --append="net.ifnames=0 biosdevname=0" --location=mbr # Partition clearing information clearpart --all --initlabel # Disk partitioning information part /boot --fstype="xfs" --size=1024 part / --fstype="xfs" --size=20480 part swap --fstype="swap" --size=1024 part /data --fstype="xfs" --grow --size=1 https://www.cnblogs.com/lynk/p/10480685.html https://www.cnblogs.com/linuxliu/p/7668048.html https://blog.51cto.com/bigboss/2060414 https://blog.csdn.net/liuyanwuyu/article/details/80630275 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |