搭建本地YUM源
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了搭建本地YUM源相关的知识,希望对你有一定的参考价值。
创建本地yum源
1,安装一个Apache环境,我这里就是采用yum安装,比较方便。
[[email protected] ]#yum -y install httpd
稍微改一下配置文件即可
[[email protected] ]# vim /etc/httpd/conf/httpd.conf
改一下ServerName
ServerName 10.93.58.70:80
重启一下服务
[[email protected] ]# /etc/init.d/httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
最后在浏览器上输入http://10.93.58.70/如果有http默认的页面就对了。
2,新建一个centos6文件夹
[[email protected] ]#mkdir -p /var/www/html/centos6
3,挂载一个ISO镜像文件,并将文件拷贝到/var/www/html/centos6路径下面
[[email protected] ]#mount /dev/dvd/ /mnt/
[[email protected] ]#cd /mnt
[[email protected] mnt ]# cp -rp ./* /var/www/html/centos6/
4,删除 /etc/yum.repods.d下面的文件只保留CentOS-Base.repo
[[email protected] yum.repos.d]#vim CentOS-Base.repo
[base]
name=CentOS-$releasever -Base
baseurl=http://10.93.58.70/centos6/
enabled=1
gpgcheck=0
gpgkey=http://10.93.58.70/centos6/RPM-GPG-KEY-CentOS-6
[extra]
name=CentOS-$releasever -extras
baseurl=http://10.93.58.70/centos6/extras/
enabled=0
gpgcheck=0
gpgkey=http://10.93.58.70/centos6/RPM-GPG-KEY-CentOS-6
[update]
name=CentOS-$releasever -updates
baseurl=http://10.93.58.70/centos6/updates/
enabled=0
gpgcheck=0
gpgkey=http://10.93.58.70/centos6/RPM-GPG-KEY-CentOS-6
5,最后测试一下镜像
[[email protected] ~]#yum repolist
Loaded plugins: aliases, changelog, fastestmirror, kabi, ovl, presto, refresh-packagekit,
: security, tmprepo, verify, versionlock
Loading support for CentOS kernel ABI
Loading mirror speeds from cached hostfile
repo id repo name status
base CentOS-6 -Base 6,713
repolist: 6,713
6,把这台设置好的CentOS-Base.repo拷贝一份直接导入到新安装的系统里面去这样就可以使用本地的yum源了。
[[email protected] ~]# scp -rp /etc/yum.repos.d/CentOS-Base.repo [email protected]: /etc/yum.repos.d/CentOS-Base.repo
[[email protected] ~]#yum repolist
以上是关于搭建本地YUM源的主要内容,如果未能解决你的问题,请参考以下文章
centos 搭建本地YUM源并使用apache共享YUM源