dnsmasq做为dhcp, dns, ntp, tftp服务器
yum -y install dnsmasqsystemctl enable dnsmasq.servicesystemctl start dnsmasq.service
/etc/dnsmasq.d/my.conf
# resolve-file指定dnsmasq从哪个文件中读取上行DNS Server, 默认是从/etc/resolv.conf获取# addn-hosts 指定dnsmasq从哪个文件中读取'地址 域名'记录, 默认是系统文件/etc/hostsinterface=em1,lolisten-address=127.0.0.1,192.168.48.116bind-interfaceslog-querieslog-dhcplog-async=20log-facility=/var/log/dnsmasq.log# dhcpdhcp-range=em1,192.168.48.131,192.168.48.140,255.255.255.0,1hdhcp-option=option:router,192.168.48.1dhcp-boot=pxelinux.0,pxeserver,192.168.48.116# dnsdhcp-option=option:dns-server,192.168.48.116#no-resolvserver=114.114.114.114no-hostsaddress=/install.local/192.168.48.116address=/yum.local/192.168.48.116# ntpdhcp-option=option:ntp-server,192.168.48.116# tftpenable-tftptftp-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-7mount -o loop /opt/CentOS-Atomic-Host-7.20151001-Installer.iso /mnt/centos-atomic-host-7ln -s /mnt/centos-atomic-host-7 /opt/opmgmt/install/centos-atomic-host-7ln -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-7ln -s /mnt/centos-7/images/pxeboot /var/lib/tftpboot/centos-7ln -s /opt/opmgmt/install/pxelinux.cfg /var/lib/tftpboot/pxelinux.cfg
yum
/opt/opmgmt/yum/rsync_centos.sh
#!/bin/bashrepo_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/bashrepo_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 - Basebaseurl=http://yum.localhost/centos/$releasever/os/$basearchenabled=1gpgcheck=0[updates]name=CentOS-$releasever - Updatesbaseurl=http://yum.localhost/centos/$releasever/updates/$basearchenabled=1gpgcheck=0[extras]name=CentOS-$releasever - Extrasbaseurl=http://yum.localhost/centos/$releasever/extras/$basearchenabled=1gpgcheck=0
/opt/opmgmt/yum/epel.repo
[epel]name=Extra Packages for Enterprise Linux $releasever - $basearchbaseurl=http://yum.localhost/epel/$releasever/$basearchenabled=1gpgcheck=0
/etc/cron.d/yum-repo.cron
0 2 * * 0 root /bin/sh /opt/opmgmt/yum/rsync_centos.sh0 4 * * 0 root /bin/sh /opt/opmgmt/yum/rsync_epel.sh
nginx
yum -y install nginxsystemctl enable nginx.servicesystemctl 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 / { }}
posted on 2015-10-23 17:35 阅读( ...) 评论( ...)