1,174 瀏覽數

apt-get update , upgrade , dist-upgrade , do-release-upgrade

APT-GET 與套件升級的參數如下幾種.
update , upgrade , dist-upgrade , do-release-upgrade

  • #apt-get update
    (同 #apt update) 更新 /etc/apt/sources.list 套件清單內容.

    root@ubuntu:~# apt-get update
    Hit:1 http://us.archive.ubuntu.com/ubuntu xenial InRelease                     
    Get:2 http://security.ubuntu.com/ubuntu xenial-security InRelease [94.5 kB]
    Get:3 http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease [95.7 kB]   
    Hit:4 http://us.archive.ubuntu.com/ubuntu xenial-backports InRelease  
    Fetched 190 kB in 2s (69.3 kB/s)
    Reading package lists... Done
    
  • #apt-get upgrade
    (同 #apt upgrade) 系統會依據 /etc/apt/sources.list 內容 (需要透過 #apt-get update 來更新清單內容) ,但不執行套件移除 或是 更新沒有安裝過的套件.如果會影響到其它套件的相依性該套件也不會更新.

    root@ubuntu:~# apt-get upgrade
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Calculating upgrade... Done
    The following packages have been kept back:
      linux-generic linux-headers-generic linux-image-generic
    The following packages will be upgraded:
      linux-generic-lts-utopic linux-libc-dev
    2 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
    Need to get 841 kB of archives.
    After this operation, 8,192 B of additional disk space will be used.
    Do you want to continue? [Y/n] y
    Get:1 http://us.archive.ubuntu.com/ubuntu xenial-updates/main i386 linux-generic-lts-utopic i386 4.4.0.38.40 [1,806 B]
    Get:2 http://us.archive.ubuntu.com/ubuntu xenial-updates/main i386 linux-libc-dev i386 4.4.0-38.57 [839 kB]
    Fetched 841 kB in 8s (103 kB/s)                                                
    (Reading database ... 193762 files and directories currently installed.)
    Preparing to unpack .../linux-generic-lts-utopic_4.4.0.38.40_i386.deb ...
    Unpacking linux-generic-lts-utopic (4.4.0.38.40) over (4.4.0.36.38) ...
    Preparing to unpack .../linux-libc-dev_4.4.0-38.57_i386.deb ...
    Unpacking linux-libc-dev:i386 (4.4.0-38.57) over (4.4.0-36.55) ...
    Setting up linux-generic-lts-utopic (4.4.0.38.40) ...
    Setting up linux-libc-dev:i386 (4.4.0-38.57) ...
    
  • #apt-get dist-upgrade
    (同 #apt full-upgrade ) 系統會依據 /etc/apt/sources.list 內容是更新套件 (需要透過 #apt-get update 來更新清單內容) ,與 upgrade 不同的是 他會處理套件相依性的問題,系統如果有重要更新套件 (未安裝過的) 也會一併安裝,也有可能會移除一些套件.
  • root@ubuntu:~# apt-get dist-upgrade
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Calculating upgrade... Done
    The following NEW packages will be installed:
      linux-headers-4.4.0-38 linux-headers-4.4.0-38-generic
      linux-image-4.4.0-38-generic linux-image-extra-4.4.0-38-generic
    The following packages will be upgraded:
      linux-generic linux-headers-generic linux-image-generic
    3 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
    Need to get 66.8 MB of archives.
    After this operation, 238 MB of additional disk space will be used.
    Do you want to continue? [Y/n] y
    
  • #do-release-upgrade
    如果是要讓系統升級 (14.04 到 16.04) 就需要這個指令來做升級的動作.

    root@ubuntu:~# do-release-upgrade
    

網友的想法

  1. 自動參照通知: APT 指令 – Benjr.tw

發表迴響