Skip to content
View in the app

A better way to browse. Learn more.

PHP论坛人

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Debian 13 更換套件來源 (APT源)

Featured Replies

----------------------------
更換套件來源 (APT源)
----------------------------

Debian的套件來源 (又稱APT源) 設定檔


舊格式 存放於 /etc/apt/sources.list


新格式 DEB822 存放於 /etc/apt/sources.list.d/debian.sources




-----------------------
確認目前來源設定
-----------------------

列出所有APT來源檔
cat /etc/apt/sources.list





-----------------
編輯來源設定檔
-----------------

vi /etc/apt/sources.list


例如以下內容,DD HK 的鏡像站,自動使用 HK 來源




deb http://ftp.hk.debian.org/debian/ bookworm main contrib non-free non-free-firmware

deb-src http://ftp.hk.debian.org/debian/ bookworm main contrib non-free non-free-firmware

deb http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
deb-src http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware

# bookworm-updates, to get updates before a point release is made;
# see https://www.debian.org/doc/manuals/debian-reference/ch02.en.html#_updates_and_backports
deb http://ftp.hk.debian.org/debian/ bookworm-updates main contrib non-free non-free-firmware
deb-src http://ftp.hk.debian.org/debian/ bookworm-updates main contrib non-free non-free-firmware




儲存檔案並離開vi編輯器
按 Esc,輸入 :wq,按 Enter




註:
以 # 開頭的行為註解,不會被執行

deb-src 為原始碼來源,一般使用者可保持註解以加快更新速度

若要改用其他鏡像站,只需將 https://deb.debian.org/debian/ 部分替換為對應的網址即可 


套件分類說明
分類	說明
main 符合自由軟體指導方針的官方支援軟體
contrib 依賴非自由軟體的自由軟體
non-free 非自由軟體
non-free-firmware 硬體驅動程式 (如Wi-Fi、顯示卡) 必備的非自由韌體




----------------------
更新與驗證
----------------------

修改完成後,請執行以下指令更新套件清單並升級已安裝套件:

更新套件清單
apt update -y


升級已安裝的套件
apt upgrade -y





清理舊檔,移除不需要的套件
apt autoclean


apt autoremove -y




驗證來源是否正常,此指令會顯示目前使用的套件來源優先順序
apt-cache policy



若有核心更新或重大變更,建議重新啟動
reboot





----------
疑難排解
----------

apt update 出現GPG簽署錯誤


解決方法

apt-get install debian-archive-keyring


apt update





sources.list 與 sources.d 衝突

若兩者都存在相同來源,可能造成:重複套件列表、優先權混亂

建議:只保留一種格式

Edited by Jack

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.