人妖在线一区,国产日韩欧美一区二区综合在线,国产啪精品视频网站免费,欧美内射深插日本少妇

新聞動態(tài)

Linux中的Zypper命令使用示例

發(fā)布日期:2022-02-14 10:25 | 文章來源:站長之家

Zypper是SUSE Linux中用于安裝,升級,卸載,管理倉庫、進行各種包查詢的命令行接口。本篇將會討論zypper的幾個不同命令的例子。
語法:


復(fù)制代碼
代碼如下:
# zypper [--global-opts] <command> [--command-opts] [command-arguments]

中括號中的部分可以不需要。執(zhí)行zypper最簡單的方法是輸入 zypper 及 。
例子1:列出可用的全局選項和命令

打開終端,輸入zypper并按回車,它會顯示所有可用的全局選項和命令。


復(fù)制代碼
代碼如下:
linux-xa3t:~ # zypper

例子2:獲得zypper的某個命令的幫助

語法: zypper help [command]


復(fù)制代碼
代碼如下:
linux-xa3t:~ # zypper help remove
remove (rm) [options] <capability> ...

Remove packages with specified capabilities.
A capability is NAME[.ARCH][OP<VERSION>], where OP is one of <, <=, =, >=, >.

Command options:
-r, --repo <alias|#|URI> Load only the specified repository.
-t, --type <type> Type of package (package, patch, pattern, product).

Default: package.
-n, --name Select packages by plain name, not by capability.
-C, --capability Select packages by capability.
--debug-solver Create solver test case for debugging.
-R, --no-force-resolution Do not force the solver to find solution,let it ask.
--force-resolution Force the solver to find a solution (even an aggressive one).
-u, --clean-deps Automatically remove unneeded dependencies.
-U, --no-clean-deps No automatic removal of unneeded dependencies.
-D, --dry-run Test the removal, do not actually remove.

例子3:打開zypper shell/會話


復(fù)制代碼
代碼如下:
linux-xa3t:~ # zypper sh
zypper>


復(fù)制代碼
代碼如下:
linux-xa3t:~ # zypper shell
zypper>

例子4:列出已定義的倉庫


復(fù)制代碼
代碼如下:
linux-xa3t:~ # zypper repos


復(fù)制代碼
代碼如下:
linux-xa3t:~ # zypper lr

4.1) 以表格的形式列出倉庫的URI

4.2) 以優(yōu)先級列出倉庫


復(fù)制代碼
代碼如下:
linux-xa3t:~ # zypper lr -p

例子5:刷新倉庫


復(fù)制代碼
代碼如下:
linux-xa3t:~ # zypper ref
Repository 'openSUSE-13.1-Non-Oss' is up to date.
Repository 'openSUSE-13.1-Oss' is up to date.
Repository 'openSUSE-13.1-Update' is up to date.
Repository 'openSUSE-13.1-Update-Non-Oss' is up to date.
All repositories have been refreshed.

例子6:修改zypper倉庫

zypper倉庫可以通過別名、數(shù)字或者URI或者通過‘–all、 –remote、 –local、 –medium-type’這些選項修改。

linux-xa3t:~ # zypper mr -d 6 #禁用6號倉庫 linux-xa3t:~ # zypper mr -rk -p 70 upd #啟用自動書信并為‘upd’倉庫設(shè)置rpm文件‘緩存’,且設(shè)置它的優(yōu)先級為70 linux-xa3t:~ # zypper mr -Ka #為所有的倉庫禁用rpm文件緩存 linux-xa3t:~ # zypper mr -kt #為遠程倉庫設(shè)置rpm文件緩存
例子7:添加倉庫

語法: zypper addrepo 或者 zypper ar <倉庫的URL或者別名>


復(fù)制代碼
代碼如下:
linux-xa3t:~ # zypper ar http://download.opensuse.org/update/13.1/ update
Adding repository 'update' .............................................[done]
Repository 'update' successfully added
Enabled: Yes
Autorefresh: No
GPG check: Yes
URI: http://download.opensuse.org/update/13.1/

例子8:移除倉庫

語法:

復(fù)制代碼
代碼如下:
zypper removerepo <倉庫名> <別名>

或者


復(fù)制代碼
代碼如下:
zypper rr <倉庫名> <別名></p> <p> [code]linux-xa3t:~ # zypper rr openSUSE-13.1-1.10 openSUSE-13.1-1.10
Removing repository 'openSUSE-13.1-1.10' ............................[done]
Repository 'openSUSE-13.1-1.10' has been removed.

例子9:安裝軟件包

語法: zypper install <包名> 或者 zypper in <包名>


復(fù)制代碼
代碼如下:
linux-xa3t:~ # zypper install vlc

例子10:卸載軟件包

語法: zypper remove <包名> 或者 zypper rm <包名>


復(fù)制代碼
代碼如下:
linux-xa3t:~ # zypper remove sqlite

例子11:導(dǎo)出和導(dǎo)入倉庫

導(dǎo)出倉庫的語法 : zypper repos –export 或者 zypper lr -e


復(fù)制代碼
代碼如下:
linux-xa3t:~ # zypper lr --export repo-backup/back.repo
Repositories have been successfully exported to repo-backup/back.repo.

導(dǎo)入倉庫的語法 :


復(fù)制代碼
代碼如下:
linux-xa3t:~ # zypper ar repo-backup/back.repo

例子12:更新一個軟件包

語法: zypper update <包名> 或者 zypper up <包名>


復(fù)制代碼
代碼如下:
linux-xa3t:~ # zypper update bash

例子13:安裝源碼包

語法: zypper source-install <源碼包> 或 zypper si <源碼包>


復(fù)制代碼
代碼如下:
linux-xa3t:~ # zypper source-install zypper

例子14:只安裝依賴包

例子13中的命令會安裝和構(gòu)建特定包的依賴。如果你想要安裝源碼包就用-D選項


復(fù)制代碼
代碼如下:
# zypper source-install -D package_name

只安裝依賴就使用-d


復(fù)制代碼
代碼如下:
# zypper source-install -d package_name

海外穩(wěn)定服務(wù)器

版權(quán)聲明:本站文章來源標注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請保持原文完整并注明來源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非www.sddonglingsh.com所屬的服務(wù)器上建立鏡像,否則將依法追究法律責任。本站部分內(nèi)容來源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來,僅供學習參考,不代表本站立場,如有內(nèi)容涉嫌侵權(quán),請聯(lián)系alex-e#qq.com處理。

實時開通

自選配置、實時開通

免備案

全球線路精選!

全天候客戶服務(wù)

7x24全年不間斷在線

專屬顧問服務(wù)

1對1客戶咨詢顧問

在線
客服

在線客服:7*24小時在線

客服
熱線

400-630-3752
7*24小時客服服務(wù)熱線

關(guān)注
微信

關(guān)注官方微信
頂部