# 源管理
## 1. 列出所有源(包括可用的和不可用的)
``` linux
yum repolist all
```
``` linux
源标识 源名称 状态
C7.0.1406-base/x86_64 CentOS-7.0.1406 - Base 禁用
C7.0.1406-centosplus/x86_64 CentOS-7.0.1406 - CentOSPlus 禁用
C7.0.1406-extras/x86_64 CentOS-7.0.1406 - Extras 禁用
C7.4.1708-extras/x86_64 CentOS-7.4.1708 - Extras 禁用
C7.4.1708-fasttrack/x86_64 CentOS-7.4.1708 - CentOSPlus 禁用
C7.4.1708-updates/x86_64 CentOS-7.4.1708 - Updates 禁用
base/7/x86_64 CentOS-7 - Base 启用: 10,070
base-debuginfo/x86_64 CentOS-7 - Debuginfo 禁用
base-source/7 CentOS-7 - Base Sources 禁用
docker-ce-stable-source Docker CE Stable - Sources 禁用
docker-ce-test/x86_64 Docker CE Test - x86_64 禁用
docker-ce-test-debuginfo/x86_64 Docker CE Test - Debuginfo x86_64 禁用
docker-ce-test-source Docker CE Test - Sources 禁用
epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 启用: 13,259
epel-debuginfo/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 - Debug 禁用
epel-source/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 - Source 禁用
epel-testing/x86_64 Extra Packages for Enterprise Linux 7 - Testing - x86_64 禁用
epel-testing-debuginfo/x86_64 Extra Packages for Enterprise Linux 7 - Testing - x86_64 - Debug 禁用
epel-testing-source/x86_64 Extra Packages for Enterprise Linux 7 - Testing - x86_64 - Source 禁用
extras/7/x86_64 CentOS-7 - Extras 启用: 392
extras-source/7 CentOS-7 - Extras Sources 禁用
fasttrack/7/x86_64 CentOS-7 - fasttrack 禁用
percona-release-noarch/7 Percona Original release/noarch YUM repository 启用: 55
percona-release-sources/7 Percona Original release/sources YUM repository 禁用
percona-release-x86_64/7 Percona Original release/x86_64 YUM repository 启用: 2,024
updates/7/x86_64 CentOS-7 - Updates 启用: 245
updates-source/7 CentOS-7 - Updates Sources 禁用
zabbix/x86_64 Zabbix Official Repository - x86_64 启用: 132
zabbix-non-supported/x86_64 Zabbix Official Repository non-supported - x86_64 启用: 4
```
## 2. 查看启用源
``` linux
yum repolist enabled
```
``` linux
源标识 源名称 状态
base/7/x86_64 CentOS-7 - Base 10,070
epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 13,259
extras/7/x86_64 CentOS-7 - Extras 392
percona-release-noarch/7 Percona Original release/noarch YUM repository 55
percona-release-x86_64/7 Percona Original release/x86_64 YUM repository 2,024
updates/7/x86_64 CentOS-7 - Updates 245
zabbix/x86_64 Zabbix Official Repository - x86_64 132
zabbix-non-supported/x86_64 Zabbix Official Repository non-supported - x86_64 4
repolist: 26,181
```
## 3. 查看禁用源
``` linux
yum repolist disabled
```
``` linux
源标识 源名称
C7.0.1406-base/x86_64 CentOS-7.0.1406 - Base
C7.0.1406-centosplus/x86_64 CentOS-7.0.1406 - CentOSPlus
C7.0.1406-extras/x86_64 CentOS-7.0.1406 - Extras
C7.0.1406-fasttrack/x86_64 CentOS-7.0.1406 - CentOSPlus
C7.0.1406-updates/x86_64 CentOS-7.0.1406 - Updates
C7.1.1503-base/x86_64 CentOS-7.1.1503 - Base
C7.1.1503-centosplus/x86_64 CentOS-7.1.1503 - CentOSPlus
C7.1.1503-extras/x86_64 CentOS-7.1.1503 - Extras
C7.1.1503-fasttrack/x86_64 CentOS-7.1.1503 - CentOSPlus
C7.1.1503-updates/x86_64 CentOS-7.1.1503 - Updates
C7.2.1511-base/x86_64 CentOS-7.2.1511 - Base
C7.2.1511-centosplus/x86_64 CentOS-7.2.1511 - CentOSPlus
```
## 4. 启用或禁用源
``` linux
yum-config-manager --disable mysql-connectors-community
yum-config-manager --enable mysql57-community-dmr
# 不需要后面的 /x86-64
```
## 5. 添加源
``` linux
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
```