dnsmasq做为dhcp, dns, ntp, tftp服务器
yum -y install dnsmasq
systemctl enable dnsmasq.service
systemctl start dnsmasq.service
/etc/dnsmasq.d/my.conf
# resolve-file指定dnsmasq从哪个文件中读取上行DNS Server, 默认是从/etc/resolv.conf获取
# addn-hosts 指定dnsmasq从哪个文件中读取'地址 域名'记录, 默认是系统文件/etc/hosts
interface=em1,lo
listen-address=127.0.0.1,192.168.48.116
bind-interfaces
log-queries
log-dhcp
log-async=20
log-facility=/var/log/dnsmasq.log
# dhcp
dhcp-range=em1,192.168.48.131,192.168.48.140,255.255.255.0,1h
dhcp-option=option:router,192.168.48.1
dhcp-boot=pxelinux.0,pxeserver,192.168.48.116
# dns
dhcp-option=option:dns-server,192.168.48.116
#no-resolv
server=114.114.114.114
no-hosts
address=/install.local/192.168.48.116
address=/yum.local/192.168.48.116
# ntp
dhcp-option=option:ntp-server,192.168.48.116
# tftp
enable-tftp
tftp-root=/var/lib/tftpboot
#pxe-prompt="Press F8 for menu.", 10
#pxe-service=x86PC, "Install CentOS", pxelinux
建立本地安装源
mkdir /mnt/{centos-7,centos-atomic-host-7}
mount -o loop /opt/CentOS-7-x86_64-Minimal-1503-01.iso /mnt/centos-7
mount -o loop /opt/CentOS-Atomic-Host-7.20151001-Installer.iso /mnt/centos-atomic-host-7
ln -s /mnt/centos-atomic-host-7 /opt/opmgmt/install/centos-atomic-host-7
ln -s /mnt/centos-7 /opt/opmgmt/install/centos-7
mkdir -p /opt/opmgmt/install/{kickstart,pxelinux.cfg}
ln -s /mnt/centos-atomic-host-7/images/pxeboot /var/lib/tftpboot/centos-atomic-host-7
ln -s /mnt/centos-7/images/pxeboot /var/lib/tftpboot/centos-7
ln -s /opt/opmgmt/install/pxelinux.cfg /var/lib/tftpboot/pxelinux.cfg
yum
/opt/opmgmt/yum/rsync_centos.sh
#!/bin/bash
repo_root='/opt/opmgmt/yum/centos/'
sync_cmd='rsync -arv --delete-after --delete-excluded'
sync_srv='rsync://mirrors.yun-idc.com/centos/'
exclude='--exclude [23456]/ --exclude [23456]\.*/ --exclude i386/ --exclude drpms/ --exclude SCL/ --exclude centosplus/ --exclude cloud/ --exclude contrib/ --exclude cr/ --exclude fasttrack/ --exclude isos/ --exclude xen4/'
[ -d $repo_root ] && mkdir -p $repo_root
$sync_cmd $exclude $sync_srv $repo_root &
/opt/opmgmt/yum/rsync_epel.sh
#!/bin/bash
repo_root='/opt/opmgmt/yum/epel/'
sync_cmd='rsync -arv --delete-after --delete-excluded'
sync_srv='rsync://mirrors.yun-idc.com/epel/'
exclude='--exclude [456]*/ --exclude=ppc64le/ --exclude testing/ --exclude SRPMS/ --exclude i386/ --exclude ppc64/ --exclude debug/ --exclude=repoview'
[ -d $repo_root ] && mkdir -p $repo_root
$sync_cmd $exclude $sync_srv $repo_root &
/opt/opmgmt/yum/centos.repo
[base]
name=CentOS-$releasever - Base
baseurl=http://yum.localhost/centos/$releasever/os/$basearch
enabled=1
gpgcheck=0
[updates]
name=CentOS-$releasever - Updates
baseurl=http://yum.localhost/centos/$releasever/updates/$basearch
enabled=1
gpgcheck=0
[extras]
name=CentOS-$releasever - Extras
baseurl=http://yum.localhost/centos/$releasever/extras/$basearch
enabled=1
gpgcheck=0
/opt/opmgmt/yum/epel.repo
[epel]
name=Extra Packages for Enterprise Linux $releasever - $basearch
baseurl=http://yum.localhost/epel/$releasever/$basearch
enabled=1
gpgcheck=0
/etc/cron.d/yum-repo.cron
0 2 * * 0 root /bin/sh /opt/opmgmt/yum/rsync_centos.sh
0 4 * * 0 root /bin/sh /opt/opmgmt/yum/rsync_epel.sh
nginx
yum -y install nginx
systemctl enable nginx.service
systemctl start nginx.service
/etc/nginx/conf.d/opmgmt.conf
server {
listen 80;
server_name install.local;
root /opt/opmgmt/install;
allow 192.168.48.0/24;
deny all;
autoindex on;
autoindex_exact_size off;
location / {
}
}
server {
listen 80;
server_name yum.local;
root /opt/opmgmt/yum;
allow 192.168.48.0/24;
deny all;
autoindex on;
autoindex_exact_size off;
location / {
}
}
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· AI与.NET技术实操系列(六):基于图像分类模型对图像进行分类
2014-10-23 服务器bios&raid管理