Huawei TaiShan PXE server operating system

1, configure yum source
when installing the operating system we chose the package will not necessarily contain DHCP, TFTP, NFS service, so we need to build yum install the software source

====================
挂载光驱
====================
[root@localhost ~]# mount /dev/sr0 /mnt/
mount: /dev/sr0 is write-protected, mounting read-only
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# mkdir bak
[root@localhost yum.repos.d]# mv *.repo ./bak/
[root@localhost yum.repos.d]# vim base.repo

=========================
编辑base.repo文件,如下:
=========================
[base]
name=base
baseurl=file:///mnt/  #iso文件挂载在那个目录下这里写哪个目录,如挂载在/mnt/目录下,这里就是baseurl=file:///mnt/
enabled=1
gpgcheck=0

[root@localhost yum.repos.d]# yum makecache 
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
...
Metadata Cache Created

2, the installation software
[root @ localhost yum.repos.d] # yum install dhcp tftp xinetd tftp-server nfs-utils rpcbind -y

3, create the relevant folder and copy the appropriate files
[root @ localhost dhcp] # mkdir -p / CentOS / centos76
[root @ localhost dhcp] # cp / mnt / * / CentOS / centos76 /
[root @ localhost ~] # mkdir / var / lib / tftpboot / UEFI
=============
extracted shim.ufi
=============
[the root @ localhost ~] # CP / CentOS / centos76 /Packages/shim-aa64-12-1.el7.aarch64.rpm / tm
[root @ localhost ~] # cd / tmp
[root @ localhost ~] # rpm2cpio Shim-aa64-12-1.el7.aarch64.rpm | -idmv the cpio
[the root @ localhost ~] # CP /tmp/boot/efi/EFI/redhat/shim.efi / var / lib / tftpboot / UEFI /
[the root @ localhost ~] # CP / CentOS / centos76 / the EFI / the BOOT /grubaa64.efi / var / lib / tftpboot / UEFI /
[the root @ localhost ~] # CP / CentOS / centos76 / Images / pxeboot / vmlinuz / var / lib / tftpboot / UEFI /
[the root @ localhost ~] # CP /centos/centos76/images/pxeboot/initrd.img / var / lib / tftpboot / UEFI /
[the root @ localhost ~] # Vim /var/lib/tftpboot/uefi/grub.cfg
SET 60 = timeout
menuentry 'the CentOS. 7' {
Linux UEFI / vmlinuz DHCP IP = inst.repo = NFS: 9.43.3.1: / CentOS / = 1024x768 centos76 inst.resolution
the initrd UEFI / the initrd.img
}
# inst.repo source path for the installation , inst.resolution set the resolution, ip = dhcp dhcp dynamic set the IP
=================================== ====
file check / var / lib / tftpboot / uefi / under
================================= ======
[the root @ localhost ~] # LS / var / lib / tftpboot / UEFI /
the grub.cfg grubaa64.efi shim.efi the initrd.img vmlinuz
[the root @ localhost ~] # the chmod 777 *

创建ks.cfg文件,将ks.cfg文件cp到/centos目录下并修改权限为777

4, the configuration file
==================
configuration file DHCPD service
==================
[root @ localhost yum. repos.d] # Vim /etc/dhcp/dhcpd.conf
DDNS-Update-style none;
the ignore Client-Updates;
default-Lease Time-359 200;
max-Lease Time-800000;
Next-Server 9.43.3.1; #pxe source server IP address
subnet 9.43.0.0 netmask 255.255.0.0 {#subnet pxe dhcp assigned netmaskpxe dhcp assigned address segment address field mask
range dynamic-bootp 9.43.3.100 9.43.200.250; #pxe dhcp address allocation
filename "uefi /shim.efi ";
}
[the root @ localhost ~] # systenctl the restart dhcpd
[the root @ localhost ~] # systenctl enable dhcpd

=============
配置tftp服务
=============
[root@localhost ~]# vim /etc/xinetd.d/tftp
service tftp
{
    socket_type             = dgram
    protocol                = udp
    wait                    = yes
    user                    = root
    server                  = /usr/sbin/in.tftpd
    server_args             = -s /var/lib/tftpboot/ -u nobody
    disable                 = no                       #将yes改为no
    per_source             =11
    cps                    =100 2
    flags                   = IPv4
}
[root@localhost ~]# systenctl restart tftp
[root@localhost ~]# systenctl enable tftp

===========
配置NFS服务
===========
[root@localhost ~]# vim /etc/exports
/centos/  *(root_squash,crossmnt)          
[root@localhost ~]# systenctl restart nfs
[root@localhost ~]# systenctl enable nfs
[root@localhost ~]# showmount -e localhost    #验证nfs配置
Export list for localhost:
/centos *

5, turn off the firewall and the SELINUX
[the root @ localhost ~] # systenctl STOP firewalld
[the root @ localhost ~] # systenctl disable firewalld
[the root @ localhost ~] # Vim / etc / sysconfig / SELinux
the SELINUX = enforcing modified to be disabled disabled #

Guess you like

Origin www.cnblogs.com/mrpangpang/p/12181528.html