May 19, 20242 yr ---------------------------- 更換套件來源 (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 June 2Jun 2 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.