生活随笔
收集整理的這篇文章主要介紹了
制作基于http的yum源2
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
yum源的創建腳本
#!/bin/bash
#?Title:?yumcreate.sh
#?Author:?cliang(gnome_dj@163.com)
#?Description:?This?is?a?script
#?Date:20140317?16:54
#?Version:?0.1#mount?the?Linux?disk?dvd1?&?dvd2.
#Web?directory?for?storage?rpm?file.?
DST="/var/www/html/yum/CentOS-6.3-x86_64"
SUR="/tmp/$(date?+%N%s)"
#The?repo?file?name.
REPO="CentOS-6.3-x86_64.repo"
#Iso?file?location.
DVDPATH1="/home/share/CentOS-6.3-x86_64-bin-DVD1.iso"
DVDPATH2="/home/share/CentOS-6.3-x86_64-bin-DVD2.iso"SIP=$(ifconfig?eth0|grep?"inet?addr"|awk?-F":"?'{print?$2}'|awk?'{print?$1}')
{
if?[?!?-d?$DST?];thenmkdir?$DST?-pchmod?+w?$DST?-R
fi
mkdir?
if?[?!?-d?$SUR?];thenmkdir?$SUR?-p
fi
}?2>?/dev/nullmount?-o?loop?$DVDPATH1?$SUR
#cp?-rf?$SUR/?$DST/
rsync?-a?$SUR/?$DST/
umount?$SURmount?-o?loop?$DVDPATH2?$SUR
#cp?-rf?$SUR/?$DST/
rsync?-a?$SUR/?$DST
umount?$SUR
rm?-rf?$SUR#Make?yum?group.
cd?$DST
createrepo?-g?$(find?$DST?|grep?comps.xml$)?.?>/dev/nullecho?"[CentOS6.4]"?>?$DST/$REPO
echo?"name=CentOS-\$releasever?-?Base"?>>?$DST/$REPO
echo?"baseurl=http://"$SIP"/yum/CentOS-6.3-x86_64"?>>?$DST/$REPO
echo?"gpgcheck=0"?>>?$DST/$REPO
echo?"enabled=1"?>>?$DST/$REPO
#Change?purview?only?read.
chmod?-w?-R?$DST#HTTP?configuration.
echo?'Alias?"/yum"?"/var/www/html/yum/"'?>>/etc/httpd/conf/httpd.conf
echo?'<Directory?"/var/www/html/yum/">'?>>/etc/httpd/conf/httpd.conf
echo?'?Order?allow,deny'??>>/etc/httpd/conf/httpd.conf
echo?'?Allow?from?all'?>>/etc/httpd/conf/httpd.conf
echo?'</Directory>'?>>/etc/httpd/conf/httpd.conf
#Reload?apache?service.
service?httpd?restart?1>/dev/null?2>/dev/null
客戶端使用的時候可以執行
#!/bin/sh
#Client?repos?configure
{
if?[?!?-d?/etc/yum.repos.d/bak?];thenmkdir?/etc/yum.repos.d/bak
fi
for?i?in?$(ls?/etc/yum.repos.d/|grep?-v?bak);domv?$i?/etc/yum.repos.d/bak
done
}?>/dev/nullwget?http://192.168.x.x/yum/CentOS-6.3-x86_64/CentOS-6.3-x86_64.repo?-O?/etc/yum.repos.d
yum?clean?all
yun?list
yun?grouplist
yum?search?"xxx"
轉載于:https://blog.51cto.com/51cliang/1431639
總結
以上是生活随笔為你收集整理的制作基于http的yum源2的全部內容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。