一.创建yum库
1. echo "/dev/cdrom /root/repo/pkgs iso9660 defaults 0 0" >> /etc/fstab
2. cd /root/repo/pkgs
3. rpm -ivh Packages/createrepo-0.9.8-4.el6.noarch.rpm
4. ll /etc/yum.repos.d
total 4
-rw-r--r--. 1vi root root 65 Feb 8 14:54 rhel.repo
5. vi /etc/yum.repos.d/rhel.repo
[rhel]
name=RHEL6
baseurl=file:///root/repo
enabled=1
gpgcheck=0
6. createrepo /root/repo
yum install samba
二.自动使用yum安装rpm包
# rpmbuild -ba SPEC/libvirt.spec
再使用cut -d' ' -f2命令获取rpm名字,保存到file中。
脚本:
while read LINE
do
yum install $LINE << EOF
y
EOF
done < file