文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>利用shell脚本创建yum服务器

利用shell脚本创建yum服务器

时间:2011-01-03  来源:《一剑》飘香

#!/bin/bash
# Description:
# Date && Time:2010-12-19  16:10:50
# Author:AIDA_ZYF
# Version:2.6.18-164.el5
echo "This programe will create a yum_server."
if ! ls -d /var/yum &>/dev/null;then
  mkdir /var/yum
  if ! ls -d /media/cdrom &>/dev/null;then
    mkdir /media/cdrom
    mount /dev/cdrom /media/cdrom
  else
    mount /dev/cdrom /media/cdrom
  fi
  else
  echo "The directory is exit."
  mount /dev/cdrom /media/cdrom fi rpm -ivh /media/cdrom/Server/createrepo-0.4.11-3.el5.noarch.rpm
cpdir() {
cp -r /media/cdrom/Cluster /var/yum/
cd /var/yum/Cluster/
createrepo -g repodata/comps-rhel5-cluster.xml ./
cp -r /media/cdrom/ClusterStorage /var/yum/
cd /var/yum/ClusterStorage/
createrepo -g repodata/comps-rhel5-cluster-st.xml ./
cp -r /media/cdrom/Server /var/yum/
  cd /var/yum/Server/
createrepo -g repodata/comps-rhel5-server-core.xml ./
cp -r /media/cdrom/VT /var/yum/
cd /var/yum/VT/
createrepo -g repodata/comps-rhel5-vt.xml ./
umount /dev/cdrom
rm -rf /var/yum/*/.olddata/
}
cpdir
localrepo() {
echo "Please input a file XX.repo:"
read FILE
touch /etc/yum.repos.d/$FILE
cat >> /etc/yum.repos.d/$FILE << EOF
[Cluster]
name=Cluster Dir
baseurl=file:///var/yum/Cluster
enabled=1
pgpcheck=0
  [ClusterStorage]
name=ClusterStorage Dir
baseurl=file:///var/yum/ClusterStorage
enabled=1
gpgcheck=0
  [Server]
name=Server Dir
baseurl=file:///var/yum/Server
enabled=1
gpgcheck=0
  [VT]
name=VT Dir
baseurl=file:///var/yum/VT
enabled=1
gpgcheck=0
EOF

}
localrepo
echo "Success."
                             
相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载