本地yum源搭建
上传镜像到本地
mount ****.iso /mnt/ ##挂载镜像到到/mnt/
df ##查看挂载情况
cd /etc/yum.repos.d/ ##切换到yum仓库这个的配置文件下
vim echo.repo ##建立新的repo文件
cat echo.repo
[rhel7]
name=rhel7
baseurl=file:///mnt/
enabled=1
gpgcheck=0
yum clean all //清除缓存
yum repolist //列出软件包有哪些
yum install lftp -y //安装这个服务
本地yum源通过http共享
(1)服务端
yum install httpd -y
systemctl stop firewalld
systemctl disable firewalld
systemctl start httpd
systemctl enable httpd
建立共享目录,并挂在镜像文件到共享目录上
mkdir -p /var/www/html/rhel7
mount /dev/sr0 /var/www/html/rhel7.1
df ##参看设备挂载情况
可以通过在浏览器中输入:http://服务端ip/rhel7
可以看到镜像中的内容,代表挂载没有问题
**修改本机yum源指向
[server]
name=rhel7.1
baseurl=file:///var/www/html/rhel7
gpgcheck=0**
(2)客户端
vim haha.repo ##建立新的repo文件
cat haha.repo
[rhel7]
name=rhel7
baseurl=http://服务端ip/rhel7
enabled=1
gpgcheck=0
yum clean all //清除缓存
yum repolist //列出软件包有哪些
建立共享目录,并挂在镜像文件到共享目录上
mkdir -p /var/www/html/rhel7
mount /dev/sr0 /var/www/html/rhel7
vim haha.repo ##建立新的repo文件
yum clean all 清除缓存
在浏览器中输入http://172.25.254.88/rhel7 看看是否搭建成功:
成功!
建第三方软件仓库
mkdir /software ##建立第三方软件存放目录
cd /software/
createrepo /software/ ##扫描第三方软件目录
vim /etc/yum.repos.d/ano.repo
[software]
name=software
baseurl=file:///software/
enabled=1
gpgcheck=0
yum clean all //清除缓存
yum repolist //列出仓库包