SUSE Linux – Zypper 命令示例

简介: 來源:http://www.linuxidc.com/Linux/2014-11/109214.htm   Zypper是SUSE Linux中用于安装,升级,卸载,管理仓库、进行各种包查询的命令行接口。

來源:http://www.linuxidc.com/Linux/2014-11/109214.htm

 

Zypper是SUSE Linux中用于安装,升级,卸载,管理仓库、进行各种包查询的命令行接口。本篇将会讨论zypper的几个不同命令的例子。

语法:

  1. # zypper [--global-opts] <command> [--command-opts] [command-arguments]

中括号中的部分可以不需要。执行zypper最简单的方法是输入 zypper 及 。

例子1:列出可用的全局选项和命令

打开终端,输入zypper并按回车,它会显示所有可用的全局选项和命令。

  1. linux-xa3t:~# zypper

例子2:获得zypper的某个命令的帮助

语法: zypper help [command]

  1. linux-xa3t:~# zypper help remove
  2. remove (rm)[options]<capability>...
  3.  
  4. Remove packages with specified capabilities.
  5. A capability is NAME[.ARCH][OP<VERSION>],where OP is one of <,<=,=,>=,>.
  6.  
  7. Command options:
  8. -r,--repo <alias|#|URI>Load only the specified repository.
  9. -t,--type <type>Type of package(package, patch, pattern, product).
  10.  
  11. Default:package.
  12. -n,--name Select packages by plain name,notby capability.
  13. -C,--capability Select packages by capability.
  14. --debug-solver Create solver test casefor debugging.
  15. -R,--no-force-resolution Donot force the solver to find solution,let it ask.
  16. --force-resolution Force the solver to find a solution (even an aggressive one).
  17. -u,--clean-deps Automatically remove unneeded dependencies.
  18. -U,--no-clean-deps No automatic removal of unneeded dependencies.
  19. -D,--dry-run Test the removal,donot actually remove.

例子3:打开zypper shell/会话

  1. linux-xa3t:~# zypper sh
  2. zypper>

  1. linux-xa3t:~# zypper shell
  2. zypper>

例子4:列出已定义的仓库

  1. linux-xa3t:~# zypper repos

  1. linux-xa3t:~# zypper lr

4.1) 以表格的形式列出仓库的URI

4.2) 以优先级列出仓库

  1. linux-xa3t:~# zypper lr -p

例子5:刷新仓库

  1. linux-xa3t:~# zypper ref
  2. Repository'openSUSE-13.1-Non-Oss'is up to date.
  3. Repository'openSUSE-13.1-Oss'is up to date.
  4. Repository'openSUSE-13.1-Update'is up to date.
  5. Repository'openSUSE-13.1-Update-Non-Oss'is up to date.
  6. All repositories have been refreshed.

例子6:修改zypper仓库

zypper仓库可以通过别名、数字或者URI或者通过‘–all、 –remote、 –local、 –medium-type’这些选项修改。

linux-xa3t:~ # zypper mr -d 6 #禁用6号仓库 linux-xa3t:~ # zypper mr -rk -p 70 upd #启用自动书信并为‘upd’仓库设置rpm文件‘缓存’,且设置它的优先级为70 linux-xa3t:~ # zypper mr -Ka #为所有的仓库禁用rpm文件缓存 linux-xa3t:~ # zypper mr -kt #为远程仓库设置rpm文件缓存

例子7:添加仓库

语法: zypper addrepo 或者 zypper ar <仓库的URL或者别名>

  1. linux-xa3t:~# zypper ar http://download.opensuse.org/update/13.1/ update
  2. Adding repository 'update'.............................................[done]
  3. Repository'update' successfully added
  4. Enabled:Yes
  5. Autorefresh:No
  6. GPG check:Yes
  7. URI: http://download.opensuse.org/update/13.1/

例子8:移除仓库

语法: zypper removerepo <仓库名> <别名>

或者

zypper rr <仓库名> <别名>

  1. linux-xa3t:~# zypper rr openSUSE-13.1-1.10 openSUSE-13.1-1.10
  2. Removing repository 'openSUSE-13.1-1.10'............................[done]
  3. Repository'openSUSE-13.1-1.10' has been removed.

 

更多详情见请继续阅读下一页的精彩内容: http://www.linuxidc.com/Linux/2014-11/109214p2.htm

目录
相关文章
|
18天前
|
Linux
Linux系统之whereis命令的基本使用
Linux系统之whereis命令的基本使用
54 23
Linux系统之whereis命令的基本使用
|
5天前
|
缓存 Ubuntu Linux
Linux中yum、rpm、apt-get、wget的区别,yum、rpm、apt-get常用命令,CentOS、Ubuntu中安装wget
通过本文,我们详细了解了 `yum`、`rpm`、`apt-get`和 `wget`的区别、常用命令以及在CentOS和Ubuntu中安装 `wget`的方法。`yum`和 `apt-get`是高层次的包管理器,分别用于RPM系和Debian系发行版,能够自动解决依赖问题;而 `rpm`是低层次的包管理工具,适合处理单个包;`wget`则是一个功能强大的下载工具,适用于各种下载任务。在实际使用中,根据系统类型和任务需求选择合适的工具,可以大大提高工作效率和系统管理的便利性。
54 25
|
3天前
|
缓存 Linux
Linux查看内存命令
1. free free命令是最常用的查看内存使用情况的命令。它显示系统的总内存、已使用内存、空闲内存和交换内存的总量。 free -h • -h 选项:以易读的格式(如GB、MB)显示内存大小。 输出示例: total used free shared buff/cache available Mem: 15Gi 4.7Gi 4.1Gi 288Mi 6.6Gi 9.9Gi Swap: 2.0Gi 0B 2.0Gi • to
14 2
|
1月前
|
网络协议 Unix Linux
深入解析:Linux网络配置工具ifconfig与ip命令的全面对比
虽然 `ifconfig`作为一个经典的网络配置工具,简单易用,但其功能已经不能满足现代网络配置的需求。相比之下,`ip`命令不仅功能全面,而且提供了一致且简洁的语法,适用于各种网络配置场景。因此,在实际使用中,推荐逐步过渡到 `ip`命令,以更好地适应现代网络管理需求。
42 11
|
2月前
|
Linux Shell
Linux 10 个“who”命令示例
Linux 10 个“who”命令示例
118 14
Linux 10 个“who”命令示例
|
2月前
|
Ubuntu Linux
Linux 各发行版安装 ping 命令指南
如何在不同 Linux 发行版(Ubuntu/Debian、CentOS/RHEL/Fedora、Arch Linux、openSUSE、Alpine Linux)上安装 `ping` 命令,详细列出各发行版的安装步骤和验证方法,帮助系统管理员和网络工程师快速排查网络问题。
244 20
|
2月前
|
Linux
linux查看目录下的文件夹命令,find查找某个目录,但是不包括这个目录本身?
通过本文的介绍,您应该对如何在 Linux 系统中查看目录下的文件夹以及使用 `find` 命令查找特定目录内容并排除该目录本身有了清晰的理解。掌握这些命令和技巧,可以大大提高日常文件管理和查找操作的效率。 在实际应用中,灵活使用这些命令和参数,可以帮助您快速定位和管理文件和目录,满足各种复杂的文件系统操作需求。
160 8
|
2月前
|
网络协议 Linux 应用服务中间件
kali的常用命令汇总Linux
kali的常用命令汇总linux
167 7
|
3月前
|
Linux 数据库
Linux中第一次使用locate命令报错?????
在Linux CentOS7系统中,使用`locate`命令时出现“command not found”错误,原因是缺少`mlocate`包。解决方法是通过`yum install mlocate -y`或`apt-get install mlocate`安装该包,并执行`updatedb`更新数据库以解决后续的“can not stat”错误。
69 9
|
3月前
|
监控 网络协议 Linux
Linux netstat 命令详解
Linux netstat 命令详解