本人近日试图在阿里云的云服务器上安装certbot包,然而提示找不到,经过一系列摸索,终成功安装,遂总结流程于下,供新手参考,以便少走弯路。本文适用于CentOS和Alibaba Cloud Linux系统。
EPEL (Extra Packages for Enterprise Linux)是基于Fedora的一个项目,为“红帽系”的操作系统提供额外的软件包。阿里系统自带的EPEL似乎不太好用,首先我们需要将其删掉。命令为:
yum remove epel-aliyuncs-release-8-15.1.al8.noarch
其中的包名视实际而定。然后安装官方EPEL:
yum install epel-release
然后调整EPEL源,首先清除缓存:
yum clean all
然后运行以下命令,将EPEL设为清华源:
sed -e 's!^metalink=!#metalink=!g' \
-e 's!^#baseurl=!baseurl=!g' \
-e 's!https\?://download\.fedoraproject\.org/pub/epel!https://mirrors.tuna.tsinghua.edu.cn/epel!g' \
-e 's!https\?://download\.example/pub/epel!https://mirrors.tuna.tsinghua.edu.cn/epel!g' \
然后修改EPEL-modular源。首先打开/etc/yum.repos.d/epel-modular.repo文件,然后注释其中metalink所在行,并在下面添加阿里云镜像,效果如下:
[epel-modular]
name=Extra Packages for Enterprise Linux Modular $releasever - $basearch
# It is much more secure to use the metalink, but if you wish to use a local mirror
# place its address here.
# baseurl=https://download.example/pub/epel/$releasever/Modular/$basearch
# metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-modular-$releasever&arch=$basearch&infra=$infra&content=$contentdir
baseurl=http://mirrors.cloud.aliyuncs.com/epel/8/Everything/$basearch
enabled=1
gpgcheck=1
countme=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
最后更新缓存:
yum makecache
即可顺利安装你想要的包了。