显示存储库:zypper repos

linux-pd5y:~ # zypper repos
# | Alias                              | Name                               | Enabled | Refresh
--+------------------------------------+------------------------------------+---------+--------
1 | Updates-for-openSUSE-12.1-12.1-1.4 | Updates for openSUSE 12.1 12.1-1.4 | Yes     | Yes    
2 | openSUSE-12.1-12.1-1.4             | openSUSE-12.1-12.1-1.4             | Yes     | No     
3 | repo-debug                         | openSUSE-12.1-Debug                | No      | Yes    
4 | repo-debug-update                  | openSUSE-12.1-Update-Debug         | No      | Yes    

更新包:zypper update

linux-pd5y:~ # zypper update
Loading repository data...
Reading installed packages...

The following NEW package is going to be installed:
  gconf2-lang 
Continue? [y/n/?] (y): y

如果我们重新运行zypper list-updates命令,我们应该看到所有软件包都是最新的:

linux-pd5y:~ # zypper list-updates
Loading repository data...
Reading installed packages...
No updates found.

删除软件包:zypper remove packagename

linux-pd5y:~ # zypper remove htop
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following package is going to be REMOVED:
  htop 

1 package to remove.
After the operation, 141.0 KiB will be freed.
Continue? [y/n/?] (y): y
Removing htop-0.9-16.1.3 [done]

上面的删除选项将删除指定的程序包。同样,该命令可以缩短为zypper rm htop

列出可用更新:zypper list-updates

linux-pd5y:~ # zypper list-updates
Loading repository data...
Reading installed packages...
S | Repository                         | Name                                 | Current Version           | Available Version         | Arch  
--+------------------------------------+--------------------------------------+---------------------------+---------------------------+-------
v | Updates for openSUSE 12.1 12.1-1.4 | MozillaFirefox                       | 17.0-2.54.1               | 19.0-2.62.1               | i586  
v | Updates for openSUSE 12.1 12.1-1.4 | MozillaFirefox-translations-common   | 17.0-2.54.1               | 19.0-2.62.1               | i586  
v | Updates for openSUSE 12.1 12.1-1.4 | ca-certificates-mozilla              | 1.85-3.7.1                | 1.85-3.11.1               | noarch

上面显示了当前安装的软件及其版本号,以及该软件的最新可用版本。由于完整列表的大小相当大,因此上述示例的输出已缩短。

安装软件包:zypper install packagename

linux-pd5y:~ # zypper install htop
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following NEW package is going to be installed:
  htop 

1 new package to install.
Overall download size: 63.0 KiB. After the operation, additional 141.0 KiB will be used.
Continue? [y/n/?] (y): y
Retrieving package htop-0.9-16.1.3.i586 (1/1), 63.0 KiB (141.0 KiB unpacked)
Retrieving: htop-0.9-16.1.3.i586.rpm [done]
Installing: htop-0.9-16.1.3 [done]

检查安装的软件包

linux-pd5y:~ # zypper search
S | Name              | Summary                                          | Type      
--+-------------------+--------------------------------------------------+-----
i | 81                | parallel-printer-support: initial release for 12.1    | patch     
  | 844-ksc-pcf       | Korean 8x4x4 Johab Fonts                           

在上面的示例中,我们执行了zypper search命令。这将列出所有包装信息。输出以表格格式显示。第一列列出状态S。如果存在i,则表示该软件包已安装。v表示已安装另一个版本,空白表示尚未安装该软件包

查询某个包

linux-pd5y:~ # zypper search samba
Loading repository data...
Reading installed packages...

S | Name                             | Summary                                                           | Type      
--+----------------------------------+-------------------------------------------------------------------+-----------
  | kdebase3-samba                   | KDE Base package: Windows Connection Module                       | package   
i | samba                            | A SMB/CIFS File, Print, and Authentication Server                 | package   
  | samba                            | A SMB/CIFS File, Print, and Authentication Server                 | srcpackage

Zypper-命令行界面

zypper是本机ZYpp软件包管理器的命令行界面。zypper主要在SLES(SUSE Linux Enterprise Server)和openSUSE发行版中找到。zypper用于安装,删除,更新和查询软件包。

Zypper软件包管理

Zypper是在SLES和openSUSE Linux系统上使用的软件包管理工具。

日期:2019-04-29 03:17:30 来源:oir作者:oir