ramos无盘操作系统配置

一、相关组件

  • tftp PXE配置引导 无版本要求
  • dhcpd PXE引导后分配机器IP地址
  • dnsmasq 域名服务器,设备安装系统的基础文件、脚本等下载 无版本要求
  • smbd(可选) 用于支持windows系统安装 无版本要求
  • nginx 静态文件服务器 无版本要求

二、服务端配置

本机IP:192.168.0.2/24

注:若需启动客户端与服务端不在一个局域网内【非192.168.0.0/24】,需网络设备开启dhcp中继代理服务

2.1.Tftp服务

#yum安装tftp服务器
yum -y install tftp-server
#创建default文件
cat << "EOF" >/var/lib/tftpboot/pxelinux.cfg/default
default menu.c32
prompt 0
timeout 30
MENU TITLE CentOS 7 PXE Menu
LABEL bootos
  MENU LABEL ^BootOS
  MENU DEFAULT
  KERNEL http://www.example.com.cn/www/os/bootos/vmlinuz_7.4
  APPEND initrd=http://www.example.com.cn/www/os/bootos/initrd_7.4.img console=tty0 selinux=0 biosdevname=0
  IPAPPEND 2
EOF

systemctl enable tftp
systemctl start tftp

2.2.ramos

#从iso镜像获取initrd.img
mount -o loop CentOS-7-x86_64-DVD-1708.iso /mnt
mkdir -p /data/www/os/bootos/initrd_7.4
#拷贝vmlinuz和initrd
cp /mnt/images/pxeboot/vmlinuz /data/www/os/bootos/vmlinuz_7.4
#解压initrd.img
cd /data/initrd_7.4/
xz -dc /mnt/images/pxeboot/initrd.img |cpio -id
yum -y install systemd dracut-network NetworkManager net-tools dmidecode --installroot=/data/nwa/initrd_7.4 --releasever=7                  
#安装intel万兆光卡驱动
rpm -ivh  http://www.example.cn/www/packages/network/ixgbe-5.6.3-1.x86_64.rpm
cp -rp /lib/modules/3.10.0-957.27.2.el7.x86_64/updates/drivers/net/ethernet/intel/ixgbe/ixgbe.ko lib/modules/3.10.0-693.el7.x86_64/kernel/drivers/net/
echo "options ixgbe allow_unsupported_sfp=1" > etc/modprobe.d/ixgbe.conf
#
echo "RamOS" >> etc/hostname
cat << "EOF" >> etc/profile
export LANG=en_US.UTF8
export PS1="[\[\e[32;1m\]\u@\[\e[33;1m\]$ip\h \[\e[32;0m\]\w]\\$ "
export HISTTIMEFORMAT='[%F %T]# '
export HISTFILESIZE=5000
EOF
vim etc/shadow
root::18181:0:99999:7:::
#补充其他配置
...
#重新打包initrd_7.4.img
find . | cpio -c -o|xz -9 --format=lzma>../initrd_7.4.img

2.3.Dhcp服务

#安装Dhcp服务
yum -y install dhcp
#配置局域网Dhcp
cat <<"EOF">/etc/dhcp/dhcpd.conf
allow booting;
allow bootp;
ddns-update-style none;
ping-check true;
ping-timeout 3;
default-lease-time 120;
max-lease-time 600;
authoritative;
next-server www.example.com.cn;
filename "undionly.kkpxe";
option domain-name "example.com";
option domain-name-servers 192.168.0.2;
option root-path "www.example.com.cn:/";
 
subnet 192.168.0.0 netmask 255.255.255.0 {
    range 192.168.0.100 192,168.0.250;
    option domain-name-servers 192.168.0.2;
    option routers 192.168.0.1;
}
EOF
#启动Dhcp服务
systemct start dhcpd
systemctl enable dhcpd

2.4.Dns服务

#安装Dnsmasq服务
yum -y install dnsmasq
#配置局域网Dhcp
cat <<"EOF">/etc/dnsmasq.d/hosts.conf
address=/www/192.168.0.2
address=/www.example/192.168.0.2
address=/www.example.com.cn/192.168.0.2
EOF
#启动dns服务
systemct start dnsmasq
systemctl enable dnsmasq

2.5.Nginx配置

#下载安装包
wget http://nginx.org/download/nginx-1.17.1.tar.gz
#解压
tar -zxvf nginx-1.17.1.tar.gz
cd nginx-1.17.1
#无特殊需求,直接编译
./configure --prefix=/usr/local/nginx-1.17.1 --without-http_rewrite_module --without-http_gzip_module
make
安装
make install
#链接
ln -sf /usr/local/nginx-1.17.1 /usr/local/nginx
#nginx添加配置
        location /www {
            root   /data/;
            index  index.html;
        }
#启动nginx
/usr/local/nginx/sbin/nginx
  • 13
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值