YUM安装(下)
1、YUM更换国内源
1)进入仓库目录
|
1
2
3
|
[root@server01 ~]
# cd /etc/yum.repos.d
[root@server01 yum.repos.d]
# ls
dvd.repo
|
2)删除仓库源
|
1
|
[root@server01 yum.repos.d]
# rm -f dvd.repo
|
3)下载仓库源
|
1
2
3
4
5
6
|
[root@server01 yum.repos.d]
# curl -O http://mirrors.163.com/.help/CentOS7-Base-163.repo
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1572 100 1572 0 0 7343 0 --:--:-- --:--:-- --:--:-- 7380
[root@server01 yum.repos.d]
# ls
CentOS7-Base-163.repo
|
也可以使用wget下载。
4)查看软件列表
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
[root@server01 yum.repos.d]
# yum list
......
net-tools.x86_64 2.0-0.17.20131004git.el7 @base
perl.x86_64 4:5.16.3-291.el7 @base
perl-Carp.noarch 1.26-244.el7 @base
perl-Encode.x86_64 2.51-7.el7 @base
perl-Exporter.noarch 5.68-3.el7 @base
perl-File-Path.noarch 2.09-2.el7 @base
perl-File-Temp.noarch 0.23.01-3.el7 @base
perl-Filter.x86_64 1.49-3.el7 @base
perl-Getopt-Long.noarch 2.40-2.el7 @base
perl-HTTP-Tiny.noarch 0.033-3.el7 @base
perl-PathTools.x86_64 3.40-5.el7 @base
perl-Pod-Escapes.noarch 1:1.04-291.el7 @base
perl-Pod-Perldoc.noarch 3.20-4.el7 @base
......
|
2、安装扩展源epel
1)安装epel
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
[root@server01 ~]
# yum install -y epel-release
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 epel-release.noarch.0.7-9 将被 安装
--> 解决依赖关系完成
依赖关系解决
================================================================================
Package 架构 版本 源 大小
================================================================================
正在安装:
epel-release noarch 7-9 extras 14 k
事务概要
================================================================================
安装 1 软件包
总下载量:14 k
安装大小:24 k
Downloading packages:
epel-release-7-9.noarch.rpm | 14 kB 00:00
Running transaction check
Running transaction
test
Transaction
test
succeeded
Running transaction
正在安装 : epel-release-7-9.noarch 1
/1
验证中 : epel-release-7-9.noarch 1
/1
已安装:
epel-release.noarch 0:7-9
完毕!
|
2)查看epel可安装的包
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
[root@server01 ~]
# yum list | grep epel
* epel: mirrors.tuna.tsinghua.edu.cn
epel-release.noarch 7-9 @extras
0ad.x86_64 0.0.21-1.el7 epel
0ad-data.noarch 0.0.21-1.el7 epel
0install.x86_64 2.11-1.el7 epel
2048-cli.x86_64 0.9.1-1.el7 epel
2048-cli-nocurses.x86_64 0.9.1-1.el7 epel
2ping.noarch 3.2.1-2.el7 epel
389-admin.x86_64 1.1.46-1.el7 epel
389-admin-console.noarch 1.1.12-1.el7 epel
389-admin-console-doc.noarch 1.1.12-1.el7 epel
389-adminutil.x86_64 1.1.21-2.el7 epel
389-adminutil-devel.x86_64 1.1.21-2.el7 epel
389-console.noarch 1.1.18-1.el7 epel
389-ds.noarch 1.2.2-6.el7 epel
389-ds-console.noarch 1.2.16-1.el7 epel
389-ds-console-doc.noarch 1.2.16-1.el7 epel
389-dsgw.x86_64 1.1.11-5.el7 epel
3proxy.x86_64 0.7-1.el7 epel
3proxy-sysvinit.x86_64 0.7-1.el7 epel
Agda.x86_64 2.3.2.2-5.el7 epel
......
|
3、YUM下载rpm包
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
[root@server01 ~]
# yum install -y vim-enhanced --downloadonly
##“--downloadonly”指明只下载不安装
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* epel: mirrors.tuna.tsinghua.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 vim-enhanced.x86_64.2.7.4.160-1.el7_3.1 将被 安装
--> 解决依赖关系完成
依赖关系解决
================================================================================
Package 架构 版本 源 大小
================================================================================
正在安装:
vim-enhanced x86_64 2:7.4.160-1.el7_3.1 updates 1.0 M
事务概要
================================================================================
安装 1 软件包
总下载量:1.0 M
安装大小:2.2 M
Background downloading packages,
then
exiting:
vim-enhanced-7.4.160-1.el7_3.1.x86_64.rpm | 1.0 MB 00:00
[root@server01 ~]
# ls /var/cache/yum/x86_64/7/
base dvd epel extras timedhosts timedhosts.txt updates
[root@server01 ~]
# yum install -y vim-enhanced --downloadonly --downloaddir=/usr/local/
##“--downloaddir”指定路径
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* epel: mirrors.ustc.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 vim-enhanced.x86_64.2.7.4.160-1.el7_3.1 将被 安装
--> 解决依赖关系完成
依赖关系解决
========================================================================================================================================================================
Package 架构 版本 源 大小
========================================================================================================================================================================
正在安装:
vim-enhanced x86_64 2:7.4.160-1.el7_3.1 updates 1.0 M
事务概要
========================================================================================================================================================================
安装 1 软件包
总计:1.0 M
安装大小:2.2 M
Background downloading packages,
then
exiting:
exiting because
"Download Only"
specified
|
如果一个安装包已经被安装,可以使用yum reinstall的方式去下载或重装。
本文转自Grodd51CTO博客,原文链接:http://blog.51cto.com/juispan/1942506,如需转载请自行联系原作者