Job: yum and dhcp

Yum install dhcp build scripts

[root @ localhost ~] # vim yum.repo.d
[root @ localhost ~] # bash yum.repo.d
"CD-ROM mount"
"Profile"
"Creating a cache yum"
"yum create success."
[root @ localhost ~] # vim dhcp.sh
[root @ localhost ~] # bash dhcp.sh
"Creating yum cache"
loaded plugins: fastestmirror, the Langpacks
loading cached hostfile Mirror SPEEDS from
being resolved dependencies
-> checking affairs
---> dhcp.x86_64.12.4.2.5-68.el7.centos.1 package will be installed
-> complete dependency resolution

Resolve dependencies

================================================== ===============================
Package Penalty for architecture version of the source size
============== ================================================== =================
installing:
dhcp x86_64 12: 4.2.5-68.el7.centos.1 xxx 513 k

Transaction Summary
================================================ =================================
installation packages 1

Total downloads: 513 k
mounted Size: 1.4 M
Downloading Packages:
Running Transaction Check
Running Transaction Test
the Transaction Test succeeded.
Running Transaction
Installing: 12: dhcp-4.2.5-68.el7.centos.1.x86_64 1/1
Verification : 12: dhcp-4.2.5-68.el7.centos.1.x86_64 1/1

Has been installed:
dhcp.x86_64 12: 4.2.5-68.el7.centos.1

完毕!
Job for dhcpd.service failed because the control process exited with error code. See "systemctl status dhcpd.service" and "journalctl -xe" for details.
Created symlink from /etc/systemd/system/multi-user.target.wants/dhcpd.service to /usr/lib/systemd/system/dhcpd.service.
[root@localhost ~]# cat dhcp.sh
#!/bin/bash
#创建yum仓库和安装dhcp

CD # mount
[-d / media / cdrom] || mkdir / media / cdrom

mount |grep -q “/dev/sr0” && umount /dev/sr0
mount /dev/sr0 /media/cdrom &> /dev/null

# Profiles

cd /etc/yum.repos.d/
[-d behind] || mkdir behind
mv * .repo behind

cat << EOF > local.repo
[xxx]
name=xxx
baseurl=file:///media/cdrom/
enabled=1
gpgcheck=0

EOF

echo “创建yum缓存”
yum clean all &> /dev/null && yum makecache &> /dev/null

# Dhcp install software
yum -y install dhcp

#修改配置文件
cat << EOF > /etc/dhcp/dhcpd.conf
option domain-name “crushlinux.com”;
option domain-name-servers 202.106.0.20 8.8.8.8;
default-lease-time 2400;
max-lease-time 7200;

subnet 192.168.200.0 netmask 255.255.255.0 {
range 192.168.200.10 192.168.200.200;
option routers 192.168.200.1;
}
EOF

# Start Service
systemctl Start dhcpd
systemctl enable dhcpd

Guess you like

Origin www.cnblogs.com/the-package/p/11404433.html
yum