升級 Ubuntu 18.04 server

備份

備份你的數據,備份你的數據,備份你的數據。重要的事情說三遍!!!

升級當前系統安裝的包1

在進行系統升級前,把所有安裝包升級到當前系統的最新版本。

// 更新包信息
sudo apt-get update

// 更新包
sudo apt-get upgrade

// 更新包依賴項
sudo apt-get dist-upgrade

上面的命令執行完,就是當前版本下的最新安裝了。之後開始系統升級。

升級系統平臺

sudo apt-get install update-manager-core

// -d 允許使用開發版本
sudo do-release-upgrade -d

Traditionally, Debian releases have been upgradeable by changing Apt’s /etc/apt/sources.list, which specifies package repositories, and using apt-get dist-upgrade to perform the upgrade itself. Ubuntu is still a Debian-derived distribution, so this process would likely still work. Instead, however, we’ll use do-release-upgrade, a tool provided by the Ubuntu project, which handles checking for a new release, updating sources.list, and a range of other tasks. This is the officially recommended upgrade path for server upgrades which must be performed over a remote connection.

其他方法

可以先改本地的soures.list文件,把源先設置成18.04的
16.04 xenial 改爲 18.04 bionic。
可以不用公司內部的源,設置成 us.archive.ubuntu.com 源。

在這裏插入圖片描述

do-release-upgrade 訪問出錯的話,把這個文件改一下,推測是因爲 do-release-upgrade 不走任何代理,所以下載不到描述文件。
手動給 wget 到本地,適合不想整體替換source.list到bionic的強迫症用戶。

問題2

在運行 sudo do-release-upgrade 後可以下載和解壓 bionic.tar.gz,但是提示下面的錯誤。這個問題提示信息可能有問題,實際上是 python 的版本有問題,而不是 python3在這裏插入圖片描述
採用下面的命令即可修復。

$ sudo update-alternatives --remove-all python
$ sudo ln -sf /usr/bin/python2.7 /usr/bin/python

  1. https://www.digitalocean.com/community/tutorials/how-to-upgrade-to-ubuntu-18-04 https://www.digitalocean.com/community/tutorials/how-to-upgrade-to-ubuntu-16-04-lts ↩︎

  2. https://askubuntu.com/questions/1104052/your-python3-install-is-corrupted ↩︎

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章