운영체제/UBUNTU

[Ubuntu 16.04] 18.04로 업그레이드

louky 2022. 10. 28. 15:50
반응형
※ 주의 
OS 업그레이드는 신중해야 합니다.
기존에 설치되어있는 S/W 및 PKG에도 영향을 줄수 있으므로 다방면으로 확인 후 업그레이드를 진행하시길 권장 드립니다. 

 

현재 우분투의 EOL(End of Life)는 아래와 같다. 

 

<출처> : https://ubuntu.com/about/release-cycle

 

ubuntu 16.04 Xenial 버전의 EOL은 2026년 4월로 예정되어 있다.

아직 EOL이 안되었지만....16.04에서 18.04로 업그레이드 하는 방법에 대해 기술하고자 한다. 

 

16.04 LTS to 18.04 Upgrade

 

환경 : Virtual Machine
OS : Ubuntu Xenial (16.04)
IMG : xenial-server-cloudimg-amd64-disk1.img 
CPU : 4core
MEM: 4096MB
DISK: 30GB

 

작업 전 sudo 권한이 있는 계정에서 하거나 root 계정에서 작업을 진행하면 된다. 

필자는 root계정에서 진행을 하였다.

 

 

현재 OS상태는 아래와 같다. 

root@ubuntu16-04:~# cat /etc/*lease
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.7 LTS"
NAME="Ubuntu"
VERSION="16.04.7 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.7 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial

OS 변경 후 기존에 설치되어 있던 PKG 들이 변경되는지 확인하기 위해 vim pkg 버전을 확인 하였고 비교는 본 페이지 하단에서 확인이 가능하다. 

 

 

먼저 OS의 PKG들은 모두 최신 버전으로 업데이트를 한다. 

root@ubuntu16-04:~# apt update
Hit:1 http://security.ubuntu.com/ubuntu xenial-security InRelease
Hit:2 http://nova.clouds.archive.ubuntu.com/ubuntu xenial InRelease
Hit:3 http://nova.clouds.archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:4 http://nova.clouds.archive.ubuntu.com/ubuntu xenial-backports InRelease
Hit:5 https://esm.ubuntu.com/infra/ubuntu xenial-infra-security InRelease
Hit:6 https://esm.ubuntu.com/infra/ubuntu xenial-infra-updates InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
1 package can be upgraded. Run 'apt list --upgradable' to see it.

 

업데이트가 필요한 PKG리스트를 아래와 같이 확인 할수 있다. 

root@ubuntu16-04:~# apt list --upgradable -a
Listing... Done
ubuntu-advantage-tools/xenial-updates 27.11.2~16.04.1 amd64 [upgradable from: 27.2.2~16.04.1]
ubuntu-advantage-tools/now 27.2.2~16.04.1 amd64 [installed,upgradable to: 27.11.2~16.04.1]

 

위의 PKG 리스트를 업그레이드를 한다. (OS업그레이드가 아닌 PKG 업그레이드이다....)

root@ubuntu16-04:~# apt upgrade 
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  ubuntu-advantage-tools
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 160 kB of archives.
After this operation, 2,034 kB disk space will be freed.
Do you want to continue? [Y/n] y         ### y누르고 진행한다.

Get:1 http://nova.clouds.archive.ubuntu.com/ubuntu xenial-updates/main amd64 ubuntu-advantage-tools amd64 27.11.2~16.04.1 [160 kB]
Fetched 160 kB in 1s (115 kB/s)
Preconfiguring packages ...
(Reading database ... 54411 files and directories currently installed.)
Preparing to unpack .../ubuntu-advantage-tools_27.11.2~16.04.1_amd64.deb ...
Unpacking ubuntu-advantage-tools (27.11.2~16.04.1) over (27.2.2~16.04.1) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up ubuntu-advantage-tools (27.11.2~16.04.1) ...
Installing new version of config file /etc/logrotate.d/ubuntu-advantage-tools ...
Installing new version of config file /etc/ubuntu-advantage/help_data.yaml ...
Installing new version of config file /etc/ubuntu-advantage/uaclient.conf ...
Created symlink /run/cloud-init/cloud-id -> /run/cloud-init/cloud-id-configdrive.

 

설치된 PKG의 주요 버전 업그레이드 진행 및 불필요한 PKG 제거  

root@ubuntu16-04:~# apt dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

 

"do-release-upgrade"  command가 없을 경우 ubuntu 시스템에서는 친절하게 아래와 같이 설치 하라고 알려 준다.

root@ubuntu16-04:~# do-release-upgrade
The program 'do-release-upgrade' is currently not installed. You can install it by typing:
apt install ubuntu-release-upgrader-core

알려준대로 "update-manager-core"와 추가로 "update-manager-core"를  설치하도록 한다.

root@ubuntu16-04:~# apt install ubuntu-release-upgrader-core update-manager-core
Reading package lists... Done
Building dependency tree
Reading state information... Done
ubuntu-release-upgrader-core is already the newest version (1:16.04.32).
The following NEW packages will be installed:
  update-manager-core
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 5,488 B of archives.
After this operation, 164 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://nova.clouds.archive.ubuntu.com/ubuntu xenial-updates/main amd64 update-manager-core all 1:16.04.17 [5,488 B]
Fetched 5,488 B in 0s (11.9 kB/s)
Selecting previously unselected package update-manager-core.
(Reading database ... 54291 files and directories currently installed.)
Preparing to unpack .../update-manager-core_1%3a16.04.17_all.deb ...
Unpacking update-manager-core (1:16.04.17) ...
Setting up update-manager-core (1:16.04.17) ...

 

"do-release-upgrade" 명령어를 실행하여 진짜 OS업그레이드를 진행한다. 

 

root@ubuntu16-04:~# do-release-upgrade
Checking for a new Ubuntu release

....
Reading cache

Checking package manager

Continue running under SSH?

This session appears to be running under ssh. It is not recommended
to perform a upgrade over ssh currently because in case of failure it
is harder to recover.

If you continue, an additional ssh daemon will be started at port
'1022'.
Do you want to continue?

Continue [yN] y

Starting additional sshd

To make recovery in case of failure easier, an additional sshd will
be started on port '1022'. If anything goes wrong with the running
ssh you can still connect to the additional one.
If you run a firewall, you may need to temporarily open this port. As
this is potentially dangerous it's not done automatically. You can
open the port with e.g.:
'iptables -I INPUT -p tcp --dport 1022 -j ACCEPT'

To continue please press [ENTER]


Reading package lists... Done
Building dependency tree
Reading state information... Done
Hit http://nova.clouds.archive.ubuntu.com/ubuntu xenial InRelease
Hit http://security.ubuntu.com/ubuntu xenial-security InRelease
Hit http://nova.clouds.archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit http://nova.clouds.archive.ubuntu.com/ubuntu xenial-backports InRelease
Hit https://esm.ubuntu.com/infra/ubuntu xenial-infra-security InRelease
Hit https://esm.ubuntu.com/infra/ubuntu xenial-infra-updates InRelease
Fetched 0 B in 0s (0 B/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
No snaps are installed yet. Try 'snap install hello-world'.

Checking for installed snaps

Calculating snap size requirements

No candidate ver:  dnsmasq-base-lua
No candidate ver:  linux-aws-cloud-tools-4.4.0-1129
No candidate ver:  linux-aws-cloud-tools-4.4.0-1130
No candidate ver:  linux-aws-cloud-tools-4.4.0-1131
No candidate ver:  linux-aws-cloud-tools-4.4.0-1132
No candidate ver:  linux-aws-cloud-tools-4.4.0-1133
No candidate ver:  linux-aws-cloud-tools-4.4.0-1134
No candidate ver:  linux-aws-cloud-tools-4.4.0-1135
No candidate ver:  linux-aws-cloud-tools-4.4.0-1137

......(Skip)

Get:27 http://nova.clouds.archive.ubuntu.com/ubuntu bionic-updates/restricted amd64 Packages [980 kB]
Get:28 http://nova.clouds.archive.ubuntu.com/ubuntu bionic-updates/restricted Translation-en [136 kB]
Get:29 http://nova.clouds.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [1,853 kB]
Get:30 http://nova.clouds.archive.ubuntu.com/ubuntu bionic-updates/universe Translation-en [401 kB]
Get:31 http://nova.clouds.archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 Packages [30.0 kB]
Get:32 http://nova.clouds.archive.ubuntu.com/ubuntu bionic-updates/multiverse Translation-en [7,532 B]
Get:33 http://nova.clouds.archive.ubuntu.com/ubuntu bionic-backports/main amd64 Packages [53.2 kB]
Get:34 http://nova.clouds.archive.ubuntu.com/ubuntu bionic-backports/main Translation-en [14.5 kB]
Get:35 http://nova.clouds.archive.ubuntu.com/ubuntu bionic-backports/universe amd64 Packages [18.1 kB]
Get:36 http://nova.clouds.archive.ubuntu.com/ubuntu bionic-backports/universe Translation-en [8,668 B]
Fetched 28.1 MB in 6s (4,555 kB/s)

Checking package manager
Reading package lists... Done
Building dependency tree
Reading state information... Done

Calculating the changes

Calculating the changes
  MarkInstall libpam-cap [ amd64 ] < none -> 1:2.25-1.2 > ( libs ) FU=1

Do you want to start the upgrade?


3 installed packages are no longer supported by Canonical. You can
still get support from the community.

3 packages are going to be removed. 105 new packages are going to be
installed. 408 packages are going to be upgraded.

You have to download a total of 312 M. This download will take about
1 minute with your connection.

Installing the upgrade can take several hours. Once the download has
finished, the process cannot be canceled.

 Continue [yN]  Details [d]   y

 

"Keep the local version currently installed" 방향키로 선택하고 엔터를 누른다.

 

Cloud IMAGE이기에  cloud 관련 PKG도 업데이트를 할건지 물어 보는데 필자는 같이 업데이트를 진행하였다.

사용하는 시스템에 따하 아래 물어 보는 내용이 달라질수 있다.

Configuration file '/etc/cloud/cloud.cfg'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** cloud.cfg (Y/I/N/O/D/Z) [default=N] ? y

 

사용하지 않는 PKG 삭제 여부를 물어 보는데... 필자의 경우 설치한 것이 없기 때문에 전부 필요 없다고 판단하에 삭제 하는것으로 진행 하였다. 

Building dependency tree
Reading state information... Done

Processing snap replacements

Searching for obsolete software
Reading state information... Done

Remove obsolete packages?


30 packages are going to be removed.

 Continue [yN]  Details [d] y

 

  불필요 PKG삭제후 OS  upgrade가 성공적으로 되었고 반영을 위해 시스템을 재시작할 것인지 물어 보는데 그냥  "y"를 선택하면 된다. 

 

System upgrade is complete.

Restart required

To finish the upgrade, a restart is required.
If you select 'y' the system will be restarted.

Continue [yN] y

 

필자는 "N"를 선택하였더니...  아래와 같은 내용이 나왔고 "V"로  report를 봤는데 별거 없었다.

*** Send problem report to the developers?

After the problem report has been sent, please fill out the form in the
automatically opened web browser.

What would you like to do? Your options are:
  S: Send report (98.6 KB)
  V: View report
  K: Keep report file for sending later or copying to somewhere else
  I: Cancel and ignore future crashes of this program version
  C: Cancel
Please choose (S/V/K/I/C): V

 

재시작을 안했지만 OS버전은 변경이 되었다.

root@ubuntu16-04:~# cat /etc/*lease
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.6 LTS"
NAME="Ubuntu"
VERSION="18.04.6 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.6 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic

 

하지만 안정적인 반영을 위해 재부팅을 진행하였다.

sync ; sync; reboot

 

재부팅 후 아래와 같이 확인 할수도 있다. 

## 아직 hostname을 변경하지 않아 ubuntu16-04로 표시되고 있디만 OS는 18.04로 변경되었다.
root@ubuntu16-04:~# lsb_release -a     
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.6 LTS
Release:	18.04
Codename:	bionic

또는 

root@ubuntu16-04:~# cat /etc/issue
Ubuntu 18.04.6 LTS \n \l

또는  

root@ubuntu16-04:~# uname -o -r -v
4.15.0-194-generic #205-Ubuntu SMP Fri Sep 16 19:49:27 UTC 2022 GNU/Linux
# Kernel => "4.15.0-194-generic"는 ubuntu 18.04 kernel version이다.

 

OS 업그레이드 전 vim PKG 버전을 확인 하였는데.. 업그레이드 이후에는 아래와 같이 vim pkg 버전도 같이 업그레이드가 되었다. 

 

< 업그레이드 전 >

root@ubuntu16-04:~# dpkg -l  | grep vim
ii  vim             2:7.4.1689-3ubuntu1.5      amd64   Vi IMproved - enhanced vi editor
ii  vim-common      2:7.4.1689-3ubuntu1.5      amd64   Vi IMproved - Common files
ii  vim-runtime     2:7.4.1689-3ubuntu1.5      all     Vi IMproved - Runtime files
ii  vim-tiny        2:7.4.1689-3ubuntu1.5      amd64   Vi IMproved - enhanced vi editor - compact version

 

<업그레이드 이후>

root@ubuntu:~# dpkg -l | grep vim
ii  vim          2:8.0.1453-1ubuntu1.9     amd64        Vi IMproved - enhanced vi editor
ii  vim-common   2:8.0.1453-1ubuntu1.9     all          Vi IMproved - Common files
ii  vim-runtime  2:8.0.1453-1ubuntu1.9     all          Vi IMproved - Runtime files
ii  vim-tiny     2:8.0.1453-1ubuntu1.9     amd64        Vi IMproved - enhanced vi editor - compact version

 

 

중간 중간 작성을 위해 시간이 더디 걸렸지만 대략 20분정도 소요 되었다.

시스템의 성능 및 설치된 PKG에 따라 다소 OS upgrade는 소요 시간이 늘어 날수 있다.  

 

 

 

※ 잘못된 부분이 있을 경우 댓글 부탁 드립니다. 

반응형