一、zypper源的配置
SUSE的zypper本地源配置起来跟yum的配置很相似,它们的配置文件有很多相似之处。不过,个人觉得zypper这个工具稍微强大些。在SUSE下,可以通过一条zypper的命令,即可完成zypper源的配置。
以下包是SUSE的Bash最新升级包,接下来的操作是把下面的升级包作为一个本地仓库,供以后zypper update来使用,
1
2
3
4
5
6
7
8
9
10
|
funny:~
# unzip CVE-2014-6271.zip
Archive: CVE-2014-6271.zip
creating: CVE-2014-6271/
inflating: CVE-2014-6271
/bash
9740.htm
inflating: CVE-2014-6271
/bash-3
.2-147.20.1.x86_64.rpm
inflating: CVE-2014-6271
/bash-doc-3
.2-147.20.1.x86_64.rpm
inflating: CVE-2014-6271
/libreadline5-32bit-5
.2-147.20.1.x86_64.rpm
inflating: CVE-2014-6271
/libreadline5-5
.2-147.20.1.x86_64.rpm
inflating: CVE-2014-6271
/license_agreement
.txt
inflating: CVE-2014-6271
/readline-doc-5
.2-147.20.1.x86_64.rpm
|
接下来的操作是把这些包放到一个目录里,然后把该目录做成系统的一个更新源。比如,把解压后的目录放到/opt目录下,然后使用zypper ar添加该zypper源。
1
2
3
4
5
6
7
8
|
funny:~
# mv CVE-2014-6271 /opt/update
funny:~
# zypper ar file:///opt/update update
Adding repository
'update'
[
done
]
Repository
'update'
successfully added
Enabled: Yes
Autorefresh: No
GPG check: Yes
URI:
file
:
/opt/update
|
接下来,使用zypper lr验证下,
1
2
3
4
5
|
funny:~
# zypper lr
# | Alias | Name | Enabled | Refresh
--+--------+--------+---------+--------
1 |
local
|
local
| Yes | Yes
2 | update | update | Yes | No
|
说明我们已成功添加update的源。另外,执行”zypper ar URI alias“后,会在/etc/zypp/repo.d/目录下生成alias.repo配置文件。接下来,我们试试zypper update命令,看是不是可以真的可以升级?
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
|
funny:~
# zypper update
Building repository
'update'
cache [
done
]
Loading repository data...
Reading installed packages...
The following packages are going to be upgraded:
bash
bash
-doc libreadline5 readline-doc
The following packages are not supported by their vendor:
bash
bash
-doc libreadline5 readline-doc
4 packages to upgrade.
Overall download size: 923.0 KiB. ...
Continue? [y
/n/
?] (y): y
Retrieving package libreadline5-5.2-147.20.1.x86_64 (1
/4
), ...
Retrieving package
bash
-3.2-147.20.1.x86_64 (2
/4
), ...
Retrieving package readline-doc-5.2-147.20.1.x86_64 (3
/4
), ...
Retrieving package
bash
-doc-3.2-147.20.1.x86_64 (4
/4
), ...
Retrieving package libreadline5-5.2-147.20.1.x86_64 (1
/4
), ...
Installing: libreadline5-5.2-147.20.1 [
done
]
Retrieving package
bash
-3.2-147.20.1.x86_64 (2
/4
), ...
Installing:
bash
-3.2-147.20.1 [
done
]
Retrieving package readline-doc-5.2-147.20.1.x86_64 (3
/4
), ...
Installing: readline-doc-5.2-147.20.1 [
done
]
Retrieving package
bash
-doc-3.2-147.20.1.x86_64 (4
/4
), ...
Installing:
bash
-doc-3.2-147.20.1 [
done
]
|
以上说明可以进行升级的。接下来,我们使用zypper ps命令,可以查看有哪些终端还在使用之前没有升级过的bash,
1
2
3
4
5
6
7
8
9
10
11
|
funny:
/etc/zypp/repos
.d
# zypper ps
The following running processes use deleted files:
PID | PPID | UID | Login | Command | Files
------+-------+-----+-------+---------+--------------------------
2663 | 2542 | 0 | root |
bash
|
/lib64/libreadline
.so.5.2
| | | | |
/bin/bash
(deleted)
22426 | 22423 | 0 | root |
bash
|
/lib64/libreadline
.so.5.2
| | | | |
/bin/bash
(deleted)
You may wish to restart these processes.
|
二、zypper命令选项介绍
1. zypper的几个重要选项:
选项 |
说明 |
repos, lr |
列出库 |
sl |
列出库(目的是与rug兼容) |
addrepo, ar | 添加库 |
sa | 添加库(目的是与rug兼容) |
renamerepo, nr | 重命名指定的安装源 |
modifyrepo, mr | 修改指定的安装源 |
refresh, ref | 刷新所有安装源 |
clean | 清除本地缓存 |
2. zypper软件管理:
选项 | 说明 |
install, in |
安装软件包 |
remove, rm | 删除软件包 |
verify, ve | 检验软件包依赖关系的完整性 |
update, up | 更新已安装的软件包到新的版本 |
dist-upgrade, dup |
整个系统的升级 |
source-install, si | 安装源代码软件包和它们的编译依赖 |
3. zypper的查询选项:
选项 |
说明 |
search, se | 安装软件包 |
packages, pa |
列出所有可用的软件包 |
patterns, pt | 列出所有可用的模式 |
products, pd | 列出所有可用的产品 |
what-provides, wp | 列出能够提供指定功能的软件包 |
本文转自 bigstone2012 51CTO博客,原文链接:http://blog.51cto.com/lavenliu/1562991