RedHat8、9一键配置脚本(华为Rocky9+epel源):
#!/bin/bash
#仅兼容RedHat8、9
uname -a
cat /etc/redhat-release
yum remove -y subscription-manager subscription-manager-rhsm-certificates
cat > /etc/yum.repos.d/Rocky_epel.repo << 'EOF'
[baseos]
name=Rocky Linux $releasever - BaseOS
baseurl=https://mirrors.huaweicloud.com/rockylinux/$releasever/BaseOS/$basearch/os/
gpgcheck=1
enabled=1
countme=1
gpgkey=https://mirrors.huaweicloud.com/rockylinux/RPM-GPG-KEY-Rocky-9
[appstream]
name=Rocky Linux $releasever - AppStream
baseurl=https://mirrors.huaweicloud.com/rockylinux/$releasever/AppStream/$basearch/os/
gpgcheck=1
enabled=1
countme=1
gpgkey=https://mirrors.huaweicloud.com/rockylinux/RPM-GPG-KEY-Rocky-9
[extras]
name=Rocky Linux $releasever - Extras
baseurl=https://mirrors.huaweicloud.com/rockylinux/$releasever/extras/$basearch/os/
gpgcheck=1
enabled=1
countme=1
gpgkey=https://mirrors.huaweicloud.com/rockylinux/RPM-GPG-KEY-Rocky-9
[epel]
name=Extra Packages for Enterprise Linux $releasever - $basearch
baseurl=https://mirrors.huaweicloud.com/epel/$releasever/Everything/$basearch/
enabled=1
gpgcheck=1
countme=1
gpgkey=https://mirrors.huaweicloud.com/epel/RPM-GPG-KEY-EPEL-$releasever
EOF
yum clean all && yum makecache
yum -y install yum-utils
RedHat7一键配置脚本(阿里CentOS7+epel源):
#!/bin/bash
#仅兼容RedHat7
uname -a
cat /etc/redhat-release
rpm -qa|grep yum
rpm -aq | grep yum | xargs rpm -e --nodeps
whereis yum && rm -rf /etc/yum # 可提前打包备份目录
#下载安装CentOS7版YUM
mkdir ~/install-yum
wget https://www.itca.cc/file/install-yum.tar
tar -xvf install-yum.tar -C ~/install-yum
cd ~/install-yum
rpm -ivh python-urlgrabber*
rpm -ivh python-iniparse*
rpm -ivh yum*
#配置Repo源
wget -O /etc/yum.repos.d/CentOS-7.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel-7.repo http://mirrors.aliyun.com/repo/epel-7.repo
sed -i 's/$releasever/7/g' /etc/yum.repos.d/CentOS-7.repo
sed -i 's/$releasever/7/g' /etc/yum.repos.d/epel-7.repo
yum clean all && yum makecache
#安装必备YUM插件
yum -y install yum-utils yum-langpacks yum-rhn-plugin PackageKit-yum
此处评论已关闭