rockylinux8.5的系统的,下面写了本地仓的 如果没有就不写
[root@rocky opt]# cat yum.sh
!/bin/bash
mkdir /etc/yum.repos.d/backup
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/backup
cat > /etc/yum.repos.d/base.repo <<EOF
[BaseOS]
name=BaseOS
baseurl=file:///misc/cd/BaseOS
https://mirror.tuna.tsinghua.edu.cn/centos/8/BaseOS/x86_64/os/
https://mirrors.huaweicloud.com/centos/8/BaseOS/x86_64/os/
https://mirrors.cloud.tencent.com/centos/8/BaseOS/x86_64/os/
https://mirrors.aliyun.com/centos/8/BaseOS/x86_64/os/
gpgcheck=0
[AppStream]
name=AppStream
baseurl=file:///misc/cd/AppStream
https://mirror.tuna.tsinghua.edu.cn/centos/8/AppStream/x86_64/os/
https://mirrors.huaweicloud.com/centos/8/AppStream/x86_64/os/
https://mirrors.cloud.tencent.com/centos/8/AppStream/x86_64/os/
https://mirrors.aliyun.com/centos/8/AppStream/x86_64/os/
gpgcheck=0
[epel]
name=EPEL
baseurl=https://mirror.tuna.tsinghua.edu.cn/epel/basearch
https://mirrors.cloud.tencent.com/epel/basearch
https://mirrors.huaweicloud.com/epel/basearch
https://mirrors.aliyun.com/epel/basearch
gpgcheck=0
enabled=1
[extras]
name=extras
baseurl=https://mirror.tuna.tsinghua.edu.cn/centos/basearch/os
https://mirrors.cloud.tencent.com/centos/basearch/os
https://mirrors.huaweicloud.com/centos/basearch/os
https://mirrors.aliyun.com/centos/basearch/os
gpgcheck=0
enabled=1
[PowerTools]
name=CentOS- - PowerTools - mirrors.aliyun.com
EOF
只下载相关的依赖包,而不安装
/data/目录如果不存在 ,会自动创建
yum -y install --downloadonly --downloaddir=/data/httpd httpd
[root@rocky yum.repos.d]# ll /data/httpd/
total 2040
-rw-r--r-- 1 root root 125969 Dec 18 01:33 apr-1.7.0-11.el9.x86_64.rpm
-rw-r--r-- 1 root root 96676 Dec 18 01:33 apr-util-1.6.1-20.el9.x86_64.rpm
-rw-r--r-- 1 root root 12993 Dec 18 01:33 apr-util-bdb-1.6.1-20.el9.x86_64.rpm
-rw-r--r-- 1 root root 15529 Dec 18 01:33 apr-util-openssl-1.6.1-20.el9.x86_64.rpm
-rw-r--r-- 1 root root 48821 Dec 18 01:33 httpd-2.4.53-7.el9.x86_64.rpm
-rw-r--r-- 1 root root 1417527 Dec 18 01:33 httpd-core-2.4.53-7.el9.x86_64.rpm
-rw-r--r-- 1 root root 14879 Dec 18 01:33 httpd-filesystem-2.4.53-7.el9.noarch.rpm
-rw-r--r-- 1 root root 83870 Dec 18 01:33 httpd-tools-2.4.53-7.el9.x86_64.rpm
-rw-r--r-- 1 root root 32868 Dec 18 01:33 mailcap-2.1.49-5.el9.noarch.rpm
-rw-r--r-- 1 root root 152352 Dec 18 01:33 mod_http2-1.15.19-2.el9.x86_64.rpm
-rw-r--r-- 1 root root 63356 Dec 18 01:33 mod_lua-2.4.53-7.el9.x86_64.rpm
把文件拷贝到没网的机器安装
yum -y install /data/httpd/*.rpm
yum安装失败原因
1 yum 配置格式有错
2 yum metadata过旧,yum clean all
3 yum 源出问题,网络有问题
yum 常用指令
yum install
yum remove
yum list
yum info
yum provides 文件名路径
yum history
实现私用 yum 仓库
1.先配置外网的yum源
2.下载httpd并启动
yum install httpd -y
systemctl enable --now httpd
3.查看并下载epel源
[root@rocky opt]# yum repolist
repo id repo name
AppStream AppStream
BaseOS BaseOS
epel epel repo
extras extras
[root@rocky html]# dnf reposync --repoid=epel --download-metadata -p /var/www/html
访问
http://192.168.57.134/epel
在开一台机器,修改yum源
[root@repo-client ~]#cat /etc/yum.repos.d/test.repo
[epel]
name=epel
baseurl=http://192.168.57.134/epel
enabled=1
gpgcheck=0
查看
yum repolist
可以下载了