작업 전 데이터 백업 필수, 업그레이드 중 실패 시 롤백이 어려움.
사전작업
1. 버전 확인
# lsb_release -d
2. 시스템 업데이트 (Ubuntu 20.04 LTS 최신 버전으로 업데이트 필요)
# apt update && apt upgrade
필요한 경우 다음 명령어를 통해 그레이드를 수행할 수 있으며,
apt upgrade 명령과 달리 의존성을 체크하여 일부 패키지를 추가로 설치하거나, 불필요한 패키지의 경우 제거를 진행함.
# apt dist-upgrade
3. 사용하지 않는 종속성 제거
# apt autoremove
4. 업데이트 매니저 설치
기본적으로 설치가 되나 가끔 설치가 안되어 있는 경우가 있음
# apt install update-manager-core
OS 업그레이드
do-release-upgrade 명령을 시작으로 업그레이드가 진행 됨
# do-release-upgrade
SSH를 통한 업그레이드를 진행할 건지 확인 -> y진행
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]
SSH 1022 포트에 대한 방화벽 설정 가이드 -> Enter
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]
패키지 체크 후 업그레이드 진행 여부 확인 -> y진행
No candidate ver: linux-modules-extra-5.4.0-166-generic
No candidate ver: linux-modules-extra-5.4.0-167-generic
Do you want to start the upgrade?
4 packages are going to be removed. 92 new packages are going to be
installed. 607 packages are going to be upgraded.
You have to download a total of 676 M. This download will take about
2 minutes with your connection.
Installing the upgrade can take several hours. Once the download has
finished, the process cannot be canceled.
Continue [yN] Details [d]
설치 진행
설치되어 있는 패키지에 따라 추가 확인 메시지가 발생할 수 있음.
Progress: [ 42%]
Unpacking libnsl2:amd64 (1.3.0-2build2) ...
Selecting previously unselected package libnss-nis:amd64.
Preparing to unpack .../libnss-nis_3.1-0ubuntu6_amd64.deb ...
Unpacking libnss-nis:amd64 (3.1-0ubuntu6) ...
sudoers 파일은 기존 설정 유지 -> N진행
Configuration file '/etc/sudoers'
==> 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.
*** sudoers (Y/I/N/O/D/Z) [default=N] ?
업그레이드 완료 후 기존 패키지 삭제 여부 확인 -> y진행
done
Reading package lists... Done
Building dependency tree
Reading state information... Done
Processing snap replacements
refreshing snap lxd
Searching for obsolete software
Reading state information... Done
Remove obsolete packages?
78 packages are going to be removed.
Continue [yN] Details [d]
업그레이드 완료, 리부팅 -> 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]
리부팅 후 확인
# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.3 LTS
Release: 22.04
Codename: jammy