yum源在vsftp网络提供的安装步骤
1)安装yum源服务器
//首先安装存放yum源的服务器
#rpm -ivh vsftpd-2.0.5-12.el5
#service vaftpd restart
#cd /var/ftp/pub
//创建挂载点 并把镜像盘挂载
#mkdir /mnt/cdrom
#mount /dev/cdrom /mnt/cdrom
#cp -a /mnt/cdrom pub
2)安装createrepo工具
//创建yum源通用数据库(生成RPM数据库)
#cd /var/ftp/pub/cdrom/Server
#createrepo -g ./repodata/comps-rhel5-server-core.xml ./
#cd /var/ftp/pub/cdrom/Cluster
#createrepo -g ./repodata/comps-rhel5-cluster.xml ./
[root@fly Server]# cd /var/ftp/pub/cdrom/VT
[root@fly VT]# createrepo -g ./repodata/comps-rhel5-vt.xml ./
[root@fly VT]# cd /var/ftp/pub/cdrom/ClusterStorage
[root@fly ClusterStorage]# createrepo -g ./repodata/comps-rhel5-cluster-st.xml ./
3)
编写yum源配置文件
#vim /etc/yum.repos.d/myyum.repo
[root@fly ~]# vim /etc/yum.repos.d/myyum.repo
//[ ]内的是仓库的名字
//命名最好是[rhel-xxx],否则yum的某些功能可能会不能实现,比如kickstart工具安装系统是软件组件选择没法读取。
//name是仓库的描述也可以说是名字
//baseurl 仓库的位置
//enabled 是否启用这个仓库,1为起用,0为禁用
//gpgcheck 是否检查GPG签名(用来验证要安装的包是不是REDHAT官方的)
[rhel-server]
name=server
baseurl=ftp://192.168.100.88/pub/cdrom/Server
enabled=1
//签名校验最好为1允许,有些软件签名校验后才能安装
//签名要导入# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
gpgcheck=1
gpgkey=ftp://192.168.100.88/pub/cdrom/RPM-GPG-KEY-redhat-release
[rhel-vt]
name=vt
baseurl=ftp://192.168.100.88/pub/cdrom/VT
enabled=1
gpgcheck=1
gpgkey=ftp://192.168.100.88/pub/cdrom/RPM-GPG-KEY-redhat-release
[rhel-cluster]
name=cluster
baseurl=ftp://192.168.100.88/pub/cdrom/Cluster
enabled=1
gpgcheck=1
gpgkey=ftp://192.168.100.88/pub/cdrom/RPM-GPG-KEY-redhat-release
[rhel-clusterstorage]
name=clusterstorage
baseurl=ftp://192.168.100.88/pub/cdrom/ClusterStorage
enabled=1
gpgcheck=1
gpgkey=ftp://192.168.100.88/pub/cdrom/RPM-GPG-KEY-redhat-release
------------
本地yum源安装
1)如果安装改为本地yum源需要事先 yum clean all
#yum clean all
//创建挂载点 并把镜像盘挂载
#mkdir /mnt/cdrom
#mount /dev/cdrom /mnt/cdrom
//linux 有的版本不一样 挂载是只读时候可能会出现创建源时出现不可用
//可以把光盘拷贝到某个文件夹,以上面服务器的文件夹为例
#cp -a /mnt/cdrom pub
2)安装createrepo工具
#cd /var/ftp/pub/cdrom/Server
#createrepo -g ./repodata/comps-rhel5-server-core.xml ./
#cd /var/ftp/pub/cdrom/Cluster
#createrepo -9 ./repodata/comps-rhel5-cluster.xml ./
[root@fly Server]# cd /var/ftp/pub/cdrom/VT
[root@fly VT]# createrepo -g ./repodata/comps-rhel5-vt.xml ./
[root@fly VT]# cd /var/ftp/pub/cdrom/ClusterStorage
[root@fly ClusterStorage]# createrepo -g ./repodata/comps-rhel5-cluster-st.xml ./
3)vim /etc/yum.repos.d/myyum.repo
[root@fly ~]# vim /etc/yum.repos.d/myyum.repo
[rhel-server]
name=server
baseurl=file:///var/ftp/pub/cdrom/Server
enabled=1
gpgcheck=1
gpgkey=file:///var/ftp/pub/cdrom/RPM-GPG-KEY-redhat-release
[rhel-vt]
name=vt
baseurl=file:///var/ftp/pub/cdrom/VT
enabled=1
gpgcheck=1
gpgkey=file:///var/ftp/pub/cdrom/RPM-GPG-KEY-redhat-release
[rhel-cluster]
name=cluster
baseurl=file:///var/ftp/pub/cdrom/Cluster
enabled=1
gpgcheck=1
gpgkey=file:///var/ftp/pub/cdrom/RPM-GPG-KEY-redhat-release
[rhel-clusterstorage]
name=clusterstorage
baseurl=file:///var/ftp/pub/cdrom/ClusterStorage
enabled=1
gpgcheck=1
gpgkey=file:///var/ftp/pub/cdrom/RPM-GPG-KEY-redhat-release
----------
注:可以不拷贝rpm软件包,直接挂载光盘创建本地yum源,
其他同理
#mount --bind /mnt/yum/repodata/ /mnt/cdrom/Server/repodata /
1)如果安装改为本地yum源需要事先 yum clean all
#yum clean all
//创建挂载点 并把镜像盘挂载
#mkdir /mnt/yum
#mkdir /mnt/cdrom
#mount /dev/cdrom/ /mnt/cdrom/
2)安装createrepo工具
#createrepo -o /mnt/yum/ -g /mnt/cdrom/repodata/comps-rhel5-server-core.xml /mnt/cdrom/Server/
#createrepo -o /mnt/yum/ -g /mnt/cdrom/repodata/comps-rhel5-cluster.xml /mnt/cdrom/
#createrepo -o /mnt/yum/ -g /mnt/cdrom/repodata/comps-rhel5-vt.xml /mnt/cdrom/
#createrepo -o /mnt/yum/ -g /mnt/cdrom/repodata/comps-rhel5-cluster-st.xml /mnt/cdrom/
3)vim /etc/yum.repos.d/myyum.repo
[root@fly ~]# vim /etc/yum.repos.d/myyum.repo
[rhel-server]
name=server
baseurl=file:///mnt/cdrom/Server
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[rhel-vt]
name=vt
baseurl=file:///mnt/cdrom/VT
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[rhel-cluster]
name=cluster
baseurl=file:///mnt/cdrom/Cluster
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[rhel-clusterstorage]
name=clusterstorage
baseurl=file:///mnt/cdrom/ClusterStorage
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
---------
#yum list all
//测试是否安装成功
转自
http://lulu1101.blog.51cto.com/4455468/796047