為openSUSE添加源


問題

openSUSE默認的源,在安裝或是更新的時候,有時候會非常慢,卡在下面這個步驟

Retrieving repository 'Main Update Repository' metadata -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------[/]

解決方案

更換成國內的源

國內源的地址

源的話,可以到網上去找,一般都是幾所大學和一些公司提供的,這里用的是網易的源,因為Debian當時用的網易的,就沒有再換

源地址 http://mirrors.163.com/

可以在這里面找到各種開源軟件系統對應的源,我們需要的是openSUSE的。

查看當前的源信息

$ sudo zypper repos -d
#  | Alias                     | Name                               | Enabled | GPG Check | Refresh | Priority | Type   | URI                                                                                | Service
---+---------------------------+------------------------------------+---------+-----------+---------+----------+--------+------------------------------------------------------------------------------------+--------
 1 | openSUSE-Leap-15.1-1      | openSUSE-Leap-15.1-1               | No      | ----      | ----    |   99     | rpm-md | hd:/?device=/dev/disk/by-id/usb-ADATA_USB_Flash_Drive_000000000000000143-0:0-part1 |        
 2 | repo-debug                | Debug Repository                   | No      | ----      | ----    |   99     | NONE   | http://download.opensuse.org/debug/distribution/leap/15.1/repo/oss/                |        
 3 | repo-debug-non-oss        | Debug Repository (Non-OSS)         | No      | ----      | ----    |   99     | NONE   | http://download.opensuse.org/debug/distribution/leap/15.1/repo/non-oss/            |        
 4 | repo-debug-update         | Update Repository (Debug)          | No      | ----      | ----    |   99     | NONE   | http://download.opensuse.org/debug/update/leap/15.1/oss/                           |        
 5 | repo-debug-update-non-oss | Update Repository (Debug, Non-OSS) | No      | ----      | ----    |   99     | NONE   | http://download.opensuse.org/debug/update/leap/15.1/non-oss/                       |        
 6 | repo-non-oss              | Non-OSS Repository                 | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/distribution/leap/15.1/repo/non-oss/                  |        
 7 | repo-oss                  | Main Repository                    | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/distribution/leap/15.1/repo/oss/                      |        
 8 | repo-source               | Source Repository                  | No      | ----      | ----    |   99     | NONE   | http://download.opensuse.org/source/distribution/leap/15.1/repo/oss/               |        
 9 | repo-source-non-oss       | Source Repository (Non-OSS)        | No      | ----      | ----    |   99     | NONE   | http://download.opensuse.org/source/distribution/leap/15.1/repo/non-oss/           |        
10 | repo-update               | Main Update Repository             | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/update/leap/15.1/oss                                  |        
11 | repo-update-non-oss       | Update Repository (Non-Oss)        | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/update/leap/15.1/non-oss/                             |        

我們看到當前使用了4個源,openSUSE一般使用4個源,兩個update,兩個distribution,每個都有oss和non-oss

禁用原來的源

sudo zypper mr -da

添加網易的源

$ sudo zypper addrepo -f http://mirrors.163.com/openSUSE/update/leap/15.1/non-oss update-repo-no-oss163
[sudo] password for root:
Adding repository 'update-repo-no-oss163' .................................................................................................................................................................[done]
Repository 'update-repo-no-oss163' successfully added

URI         : http://mirrors.163.com/openSUSE/update/leap/15.1/non-oss
Enabled     : Yes
GPG Check   : Yes
Autorefresh : Yes
Priority    : 99 (default priority)

Repository priorities are without effect. All enabled repositories share the same priority.
$ sudo zypper addrepo -f http://mirrors.163.com/openSUSE/update/leap/15.1/oss update-repo-oss163
Adding repository 'update-repo-oss163' ....................................................................................................................................................................[done]
Repository 'update-repo-oss163' successfully added

URI         : http://mirrors.163.com/openSUSE/update/leap/15.1/oss
Enabled     : Yes
GPG Check   : Yes
Autorefresh : Yes
Priority    : 99 (default priority)

Repository priorities are without effect. All enabled repositories share the same priority.
$ sudo zypper addrepo -f http://mirrors.163.com/openSUSE/distribution/leap/15.1/repo/oss dis-repo-oss163
Adding repository 'dis-repo-oss163' .......................................................................................................................................................................[done]
Repository 'dis-repo-oss163' successfully added

URI         : http://mirrors.163.com/openSUSE/distribution/leap/15.1/repo/oss
Enabled     : Yes
GPG Check   : Yes
Autorefresh : Yes
Priority    : 99 (default priority)

Repository priorities are without effect. All enabled repositories share the same priority.
$ sudo zypper addrepo -f http://mirrors.163.com/openSUSE/distribution/leap/15.1/repo/non-oss dis-repo-non-oss163
Adding repository 'dis-repo-non-oss163' ...................................................................................................................................................................[done]
Repository 'dis-repo-non-oss163' successfully added

URI         : http://mirrors.163.com/openSUSE/distribution/leap/15.1/repo/non-oss
Enabled     : Yes
GPG Check   : Yes
Autorefresh : Yes
Priority    : 99 (default priority)

Repository priorities are without effect. All enabled repositories share the same priority.

添加的時候,找到自己系統對應的版本,添加的命令,就是前面是url,后面是昵稱,昵稱隨便定義

更新一下系統

$ sudo zypper refresh
Retrieving repository 'dis-repo-non-oss163' metadata ....................................................................................................................................................................................................................[done]
Building repository 'dis-repo-non-oss163' cache .........................................................................................................................................................................................................................[done]
Retrieving repository 'dis-repo-oss163' metadata ........................................................................................................................................................................................................................[done]
Building repository 'dis-repo-oss163' cache .............................................................................................................................................................................................................................[done]
Retrieving repository 'update-repo-no-oss163' metadata ..................................................................................................................................................................................................................[done]
Building repository 'update-repo-no-oss163' cache .......................................................................................................................................................................................................................[done]
Retrieving repository 'update-repo-oss163' metadata .....................................................................................................................................................................................................................[done]
Building repository 'update-repo-oss163' cache ..........................................................................................................................................................................................................................[done]
All repositories have been refreshed.

添加完成后,更新一下,就可以使用了


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM