首页 > 系统相关 >Linux之pxe

Linux之pxe

时间:2023-08-09 09:01:34浏览次数:37  
标签:dhcp tftpboot usr Linux pxe tftp root localhost

二、操作

[root@localhost ~]#systemctl stop firewalld
[root@localhost ~]#setenforce 0


[root@localhost ~]#yum install dhcp -y

[root@localhost ~]#cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example  /etc/dhcp/dhcpd.conf
cp:是否覆盖"/etc/dhcp/dhcpd.conf"? y

[root@localhost ~]#cd /etc/dhcp/
[root@localhost dhcp]#ls
dhclient.d  dhclient-exit-hooks.d  dhcpd6.conf  dhcpd.conf  scripts
[root@localhost dhcp]#vim dhcpd.conf 
 32 subnet 192.168.174.0 netmask 255.255.255.0 {
 33   range 192.168.174.10 192.168.174.50;
 34   option routers 192.168.174.2;
 35   next-server 192.168.174.100;
 36   filename "pxelinux.0";
 37 }



[root@localhost dhcp]#systemctl start dhcpd


[root@localhost dhcp]#yum install tftp-server.x86_64 -y

[root@localhost dhcp]#rpm -ql tftp-server
/etc/xinetd.d/tftp
/usr/lib/systemd/system/tftp.service
/usr/lib/systemd/system/tftp.socket
/usr/sbin/in.tftpd
/usr/share/doc/tftp-server-5.2
/usr/share/doc/tftp-server-5.2/CHANGES
/usr/share/doc/tftp-server-5.2/README
/usr/share/doc/tftp-server-5.2/README.security
/usr/share/man/man8/in.tftpd.8.gz
/usr/share/man/man8/tftpd.8.gz
/var/lib/tftpboot


[root@localhost dhcp]#vim /etc/xinetd.d/tftp
# default: off
# description: The tftp server serves files using the trivial file transfer \
#       protocol.  The tftp protocol is often used to boot diskless \
#       workstations, download configuration files to network-aware printers, \
#       and to start the installation process for some operating systems.
service tftp
{
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = -s /var/lib/tftpboot
        disable                 = no
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}


[root@localhost dhcp]#systemctl start tftp


[root@localhost dhcp]#cd /var/lib/tftpboot

[root@localhost tftpboot]#pwd
/var/lib/tftpboot


[root@localhost tftpboot]#mount /dev/sr0 /mnt
mount: /dev/sr0 写保护,将以只读方式挂载
[root@localhost tftpboot]#ls /mnt
CentOS_BuildTag  EFI  EULA  GPL  images  isolinux  LiveOS  Packages  repodata  RPM-GPG-KEY-CentOS-7  RPM-GPG-KEY-CentOS-Testing-7  TRANS.TBL
[root@localhost tftpboot]#cd /mnt/isolinux
[root@localhost isolinux]#ls
boot.cat  boot.msg  grub.conf  initrd.img  isolinux.bin  isolinux.cfg  memtest  splash.png  TRANS.TBL  vesamenu.c32  vmlinuz

[root@localhost /]#cd /var/lib/tftpboot

[root@localhost tftpboot]#cp /mnt/isolinux/vmlinuz  /var/lib/tftpboot
[root@localhost tftpboot]#cp /mnt/isolinux/initrd.img  /var/lib/tftpboot
[root@localhost tftpboot]#ls
initrd.img  vmlinuz



[root@localhost tftpboot]#yum install syslinux -y

[root@localhost tftpboot]#rpm -ql syslinux | grep pxelinux
/usr/share/doc/syslinux-4.05/pxelinux.txt
/usr/share/syslinux/gpxelinux.0
/usr/share/syslinux/gpxelinuxk.0
/usr/share/syslinux/pxelinux.0

[root@localhost tftpboot]#cp /usr/share/syslinux/pxelinux.0  .
[root@localhost tftpboot]#ls
initrd.img  pxelinux.0  vmlinuz


[root@localhost tftpboot]#yum install vsftpd -y


[root@localhost tftpboot]#cd /var/ftp
[root@localhost ftp]#ls
pub
[root@localhost ftp]#mkdir centos7
[root@localhost ftp]#ls
centos7  pub


[root@localhost ftp]#mount /dev/sr0  centos7/
mount: /dev/sr0 写保护,将以只读方式挂载


[root@localhost ftp]#ls centos7/
CentOS_BuildTag  EFI  EULA  GPL  images  isolinux  LiveOS  Packages  repodata  RPM-GPG-KEY-CentOS-7  RPM-GPG-KEY-CentOS-Testing-7  TRANS.TBL

[root@localhost ftp]#cd -
/var/lib/tftpboot


[root@localhost tftpboot]#mkdir pxelinux.cfg
[root@localhost tftpboot]#ls
initrd.img  pxelinux.0  pxelinux.cfg  vmlinuz
[root@localhost tftpboot]#cd pxelinux.cfg
[root@localhost pxelinux.cfg]#ls
[root@localhost pxelinux.cfg]#vim default
default   linux
timeout   600

label linux
  kernel vmlinuz
  append initrd=initrd.img    method=ftp://192.168.174.100/centos7 ks=ftp://192.168.174.100/ks.cfg

label rescue
  kernel vmlinuz
  append text  initrd=initrd.img    method=ftp://192.168.174.100/centos7  ks=ftp://192.168.174.100/ks.cfg

label test
  kernel vmlinuz
  append text  initrd=initrd.img    method=ftp://192.168.174.100/centos7  ks=ftp://192.168.174.100/ks.cfg





[root@localhost pxelinux.cfg]#systemctl start vsftpd


[root@localhost pxelinux.cfg]#yum install system-config-kickstart -y




  1. 首先关闭服务器的防火墙和selinux

dhcp

标签:dhcp,tftpboot,usr,Linux,pxe,tftp,root,localhost
From: https://www.cnblogs.com/mtwm/p/17614653.html

相关文章

  • 嵌入式linux笔试
    讲讲l2c和SPI协议。l2c(Inter-IntegratedCircuit)和SPI(SerialPeripheralInterface)总线都是用在不同的芯片、模块或者设备之间传输数据的通信协议。l2c(Inter-IntegratedCircuit):l2c是一种串行通信协议,通常用于连接微控制器、传感器、存储器等设备。在l2c中,有两根线:SCL(时钟线)和SDA(数......
  • Linux网络、shell
    目录一网络DHCP二shellShell基础语法shell补全shell命令快捷键命令History命令别名Shell获取帮助内部命令,什么是外部命令外置命令内存缓存一网络###网络#网络配置 -子网掩码 -dhcp-网关-dns#mac网络配置#https://blog.csdn.net/hadues/article/detai......
  • linux 文件权限和访问控制
    文件权限和访问控制是Linux系统中保护文件和目录安全性的重要部分。以下是一些关于文件权限和访问控制的方法和示例说明:1.**文件权限**:-在Linux中,每个文件和目录都有权限,这些权限决定了谁可以执行哪些操作(读取、写入、执行)。2.**文件权限表示**:-权限通常用三个字母表示,分......
  • linux如何查找nginx使用的配置文件
    1、查找nginx进程ps-aef|grepnginx2、通过进程pid查找程序路径pwdx<pid>3、在上面得到的路径下执行xxx/nginx-t示例如下:......
  • linux Sudo 权限管理
    Sudo是一种在Linux系统中管理用户访问权限的强大工具。它允许系统管理员授予普通用户以超级用户(root)权限执行特定的命令,从而在需要时获得临时的管理员权限,提高了系统的安全性和管理灵活性。以下是一些关于Sudo权限管理的方法和示例说明:1.**编辑sudoers文件**:-使用visudo......
  • linux 用户账号和组管理
    useradd:创建新的用户账号。示例:创建一个名为"john"的用户账号。sudouseraddjohnpasswd:设置用户密码或修改密码。示例:为用户"john"设置密码。sudopasswdjohnuserdel:删除用户账号。示例:删除用户"john"的账号。sudouserdeljohnroupadd:创建新的用户组。示......
  • linux相关命令经录
    pingwww.baidu.com下载方式1wgethttps://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png下载方式2curl-Ohttps://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png-------------------------------yum-yinstallnmap查看当前ip,对外暴露端口n......
  • linux特殊权限rws和rwt
    Linux文件,除了rwx这些权限外,还有一些特殊的权限,如rws、rwt。1、s权限(setuid)1.1设置方法:chmodu+s该位可以让普通用户以root用户的角色运行只有root帐号才能运行的程序或命令。s:文件属主和组设置SUID和GUID,文件在被设置了s权限后将以root身份执行。在设置s权限时文件属主、属......
  • RISC-V云测平台:Compiling The Fedora Linux Kernel Natively on RISC-V
      注释:编译Fedora,HS-264核RISC-V服务器比Ryzen5700x快两倍!---以下是blog正文---#CompilingTheFedoraLinuxKernelNativelyonRISC-V##FedoraRISC-VSupportThereisongoingworktoFedoratosupportRISC-Vhardware.AsofrightnowtheFedoradocume......
  • Linux 安装软件的几种方式
    哈喽大家好,我是咸鱼相信小伙伴们都知道在Linux中,安装软件一般有三种方式yum安装rpm安装源码编译安装咸鱼平时三种安装方式都会用,但是具体原理和区别却没有去深入了解过结果上周部门刚来的新人问我这几种安装方式的时候,一下子把我问懵了那么今天咸鱼将会向小伙伴们介......