[内容] Linux 官方软件源链接列表 (CentOS Linux 版)

内容一:CentOS 7 基础软件源列表

1.1 CentOS 7 基础软件源官方推荐链接列表

1.1.1 CentOS-7 – Base

http://mirror.centos.org/centos/7/os/x86_64/

1.1.2 CentOS-7 – Updates

http://mirror.centos.org/centos/7/updates/x86_64/

1.1.3 CentOS-7 – Extras

http://mirror.centos.org/centos/7/extras/x86_64/

1.1.4 CentOS-7 – Plus

http://mirror.centos.org/centos/7/centosplus/x86_64/

1.2 CentOS 7 基础软件源官方推荐链接列表

1.2.1 CentOS-7 – Base

http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=$infra

1.2.2 CentOS-7 – Updates

http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=updates&infra=$infra

1.2.3 CentOS-7 – Extras

http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=extras&infra=$infra

1.2.4 CentOS-7 – Plus

http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=centosplus&infra=$infra

内容二:CentOS 8 基础软件源列表

2.1 CentOS 8 基础软件源官方链接列表

2.1.1 CentOS Linux 8 – BaseOS

http://mirror.centos.org/centos/8/BaseOS/x86_64/os/

2.1.2 CentOS-8 – Updates

http://mirror.centos.org/centos/8/AppStream/x86_64/os/

2.2 CentOS 8 基础软件源官方推荐链接列表

2.2.1 CentOS Linux 8 – BaseOS

http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=BaseOS&infra=$infra

2.2.2 CentOS Linux 8 – AppStream

http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=$infra

[工具] Shell 批量设置官方软件源 (openSUSE Leap 15.2 版)

介绍

基本信息

作者:朱明宇
名称:批量设置官方软件源(openSUSE 版)
作用:批量设置官方软件源(openSUSE 版)

使用方法

1. 服务器清单 $add_repo_servers_list.txt 每个服务器名占用 1 行,并和此脚本放在同一目录下
2. 在此脚本的分割线内写入相应的内容
3. 给此脚本添加执行权限
4. 执行此脚本

脚本分割线里的变量

add_repo_servers_list.txt #指定存放要设置官方软件源的文件

注意

1. 此脚本执行前必须要先保证执行此脚本的用户能无密码 ssh 远程这些远程服务器
2. 服务器的系统需要是 openSUSE 15.2 版本
3. 服务器系统要配置好可用的软件源(最好是软件数量最多的官方版本)
4. 这些远程服务器要能够连接外网

脚本

#!/bin/bash

####################### Separator ########################

add_repo_servers_list.txt

####################### Separator ########################

cat add_repo_servers_list.txt
read -p "will add opensuse_leap_15.2 repo please input y " a
echo $a

if [ "$a" != "y" ];then
        echo "you don't agree so exit now"
        exit
fi

for i in `awk '{print $1}' add_repo_servers_list.txt`
do
        ssh $i '
        sudo -u root su - root -c "zypper mr -da"
        sudo -u root su - root -c "zypper ar -fcg http://download.opensuse.org/distribution/leap/15.2/repo/oss/ OpenSUSE_Leap_152_x64_update-oss"
        sudo -u root su - root -c "zypper ar -fcg http://download.opensuse.org/distribution/leap/15.2/repo/non-oss/ OpenSUSE_Leap_152_x64_update-non-oss"
        sudo -u root su - root -c "zypper ar -fcg http://download.opensuse.org/update/leap/15.2/oss/ OpenSUSE_Leap_152_x64_oss"
        sudo -u root su - root -c "zypper ar -fcg http://download.opensuse.org/update/leap/15.2/non-oss/ OpenSUSE_Leap_152_x64_non-oss"
        sudo -u root su - root -c "zypper ref"
done

[步骤] 软件源的设置 (openSUSE 版) (本地镜像版)

步骤一:加载本地镜像到系统光驱

(步骤略)

步骤二:挂载本地镜像

# mount /dev/cdrom /mnt

(补充:这里以挂载 /dev/sr1 到 /mnt 目录为例)

步骤三:添加本地镜像里的软件源

# zypper ar file:///mnt/Module-Basesystem openSUSE15-Base

或者:

# zypper ar -f /mnt/Module-Basesystem openSUSE15-Base

(补充:这里以将 /mnt/Module-Basesystem 添加到软件源并命名为 openSUSE15-Base 为例)

[步骤] CentOS Linux DNF 的使用 (通过阿里源实现)

内容一:DNF 简介

1.1 DNF 软件简介

1) 从 CentOS8&RHEL8 开始默认使用 dnf 管理软件和补丁安装
2) dnf 也是 yum v4
3) dnf 的命令参数和 yum 一样
4) dnf 软件源的配置方法和 yum 一样

1.2 DNF 软件源简介

1) BaseOS 系统和基础的软件包
2) AppStream 其余所有官方的软件包

内容二:DNF 软件源的配置案例

2.1 删除原有的软件源配置文件

# rm /etc/yum.repos.d/*.repo

2.2 配置 AppStream 库

# vim /etc/yum.repos.d/CentOS-AppStream.repo

创建以下内容:

[AppStream]
name=CentOS-$releasever - AppStream
baseurl=http://mirrors.aliyun.com/centos/$releasever/AppStream/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

2.3 配置 Base 库

# vim /etc/yum.repos.d/CentOS-Base.repo

创建以下内容:

[BaseOS]
name=CentOS-$releasever - Base
baseurl=http://mirrors.aliyun.com/centos/$releasever/BaseOS/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

2.4 配置 Epel 库

# vim /etc/yum.repos.d/CentOS-Epel.repo

创建以下内容:

[epel]
name=CentOS-$releasever - Epel
baseurl=http://mirrors.aliyun.com/epel/8/Everything/$basearch
enabled=1
gpgcheck=0

2.5 配置 Media 库

# vim /etc/yum.repos.d/CentOS-Media.repo

创建以下内容:

[c8-media-BaseOS]
name=CentOS-BaseOS-$releasever - Media
baseurl=file:///media/CentOS/BaseOS/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
[c8-media-AppStream]
name=CentOS-AppStream-$releasever - Media
baseurl=file:///media/CentOS/AppStream/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

2.6 清除 DNF 缓存

# dnf clean all

2.7 刷新并列出 DNF 软件源列表

# dnf repolist