CentOS 7
Ads

PXE Boot : Diskless Client
2015/06/26
 
Boot your client computer which has no local hard drive from PXE server.
[1]
[2] Install required packages.
[root@dlp ~]#
yum -y install dracut-network nfs-utils
[3] Build a system for diskless clients on PXE server.
[root@dlp ~]#
mkdir -p /var/lib/tftpboot/centos7/root

[root@dlp ~]#
yum groups -y install "Server with GUI" --releasever=7 --installroot=/var/lib/tftpboot/centos7/root/
# generate encrypted root password (remeber it)

[root@dlp ~]#
python -c 'import crypt,getpass; \
print(crypt.crypt(getpass.getpass(), \
crypt.mksalt(crypt.METHOD_SHA512)))'
Password:
$6$EC1T.oKN5f3seb20$y1WlMQ7Ih424OwOn.....
[root@dlp ~]#
vi /var/lib/tftpboot/centos7/root/etc/shadow
# set root password generated above

root:
$6$EC1T.oKN5f3seb20$y1WlMQ7Ih424OwOn.....
:16372:0:99999:7:::
[root@dlp ~]#
vi /var/lib/tftpboot/centos7/root/etc/fstab
none    /tmp        tmpfs   defaults   0 0
tmpfs   /dev/shm    tmpfs   defaults   0 0
sysfs   /sys        sysfs   defaults   0 0
proc    /proc       proc    defaults   0 0

[root@dlp ~]#
wget -P /var/lib/tftpboot/centos7/ \
http://mirror.centos.org/centos/7/os/x86_64/images/pxeboot/vmlinuz \
http://mirror.centos.org/centos/7/os/x86_64/images/pxeboot/initrd.img
[root@dlp ~]#
vi /var/lib/tftpboot/pxelinux.cfg/default
# create new

default centos7

label centos7
    kernel centos7/vmlinuz
    append initrd=centos7/initrd.img root=nfs:10.0.0.30:/var/lib/tftpboot/centos7/root rw selinux=0 
[4] Configure NFS server to share system files with clients
[root@dlp ~]#
vi /etc/exports
/var/lib/tftpboot/centos7/root 10.0.0.0/24(rw,no_root_squash)
[root@dlp ~]#
systemctl start rpcbind nfs-server

[root@dlp ~]#
systemctl enable rpcbind nfs-server

[5] It's OK to configure.
Start a diskless computer which is enabled network booting on BIOS settings, then, system will boot like follows.
 
Tweet