소프트웨어 소스 및 업데이트 전략
26.10: rc 상태의 OpenSSH 패키지를 대량 제거하지 마세요. 교체 패키지는 여전히 이전 구성을 사용할 수 있으며 제거하면 SSH가 손상될 수 있습니다. 26.10 알려진 문제을 확인하고 원격 유지 관리 전에 복구 액세스를 유지하세요.
소프트웨어 소스를 올바르게 구성하고 건전한 업데이트 전략을 수립하는 것은 시스템 보안과 안정성에 매우 중요합니다. 이 문서에서는 Ubuntu 26.04에서 소프트웨어 소스를 구성하는 방법과 다양한 업데이트 전략을 설명합니다.
소프트웨어 소스 기본
Ubuntu 26.04 소스 형식
Ubuntu 24.04부터 APT 소스 구성은 /etc/apt/sources.list.d/ubuntu.sources에 있는 구성 파일과 함께 새로운 DEB822 형식을 사용합니다.
cat /etc/apt/sources.list.d/ubuntu.sources일반적인 내용:
Types: deb deb-src
URIs: http://archive.ubuntu.com/ubuntu
Suites: resolute resolute-updates resolute-backports
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg소스 구성 요소 설명
| 요소 | 설명 |
|---|---|
main | Canonical에서 공식적으로 지원되는 오픈 소스 소프트웨어 |
restricted | 공식적으로 지원되는 독점 드라이버 |
universe | 커뮤니티가 관리하는 오픈 소스 소프트웨어 |
multiverse | 저작권 또는 법적 제한으로 인해 제한된 소프트웨어 |
스위트 설명
| 모음곡 | 설명 |
|---|---|
resolute | 기본 릴리스 저장소 |
resolute-updates | 권장 업데이트 |
resolute-backports | 백포트된 최신 소프트웨어 버전 |
resolute-security | 보안 업데이트 |
미러로 전환
# Back up the original configuration
sudo cp /etc/apt/sources.list.d/ubuntu.sources /etc/apt/sources.list.d/ubuntu.sources.bak
# Edit the source configuration
sudo nano /etc/apt/sources.list.d/ubuntu.sourcesURIs을 미러로 교체합니다.
Types: deb deb-src
URIs: https://mirrors.aliyun.com/ubuntu
Suites: resolute resolute-updates resolute-backports resolute-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg미러를 선택할 때 지리적으로나 네트워크에 가까운 미러를 선호하십시오. 학술 네트워크 사용자는 Tsinghua 또는 USTC 미러를 선호할 수 있으며, 클라우드 서버 사용자는 최고의 속도를 위해 공급자의 내부 미러를 사용해야 합니다.
일반적인 거울:
| 거울 | URL |
|---|---|
| 알리바바 클라우드 | https://mirrors.aliyun.com/ubuntu |
| 칭화대학교 | https://mirrors.tuna.tsinghua.edu.cn/ubuntu |
| USTC | https://mirrors.ustc.edu.cn/ubuntu |
| 화웨이 클라우드 | https://mirrors.huaweicloud.com/ubuntu |
| 텐센트 클라우드 | https://mirrors.cloud.tencent.com/ubuntu |
전환 후 인덱스를 새로 고칩니다.
sudo apt updatePPA는 Canonical에서 패키지를 검토하지 않은 타사 개인적으로 유지 관리되는 소프트웨어 소스입니다. 신뢰할 수 없는 PPA를 추가하면 보안 위험이 발생하거나 종속성 충돌이 발생할 수 있습니다. 잘 알려진 프로젝트의 PPA만 추가하고 시스템 버전을 업그레이드하기 전에 모든 PPA를 비활성화하세요.
PPA 관리
PPA(Personal Package Archives)를 사용하면 타사 개발자가 소프트웨어 패키지를 배포할 수 있습니다.
PPA 추가
# Add a PPA
sudo add-apt-repository ppa:graphics-drivers/ppa
# Update the index after adding
sudo apt update
# Install software from the PPA; choose the version reported by ubuntu-drivers devices
sudo apt install nvidia-driver-XXXPPA 제거
# Remove a PPA
sudo add-apt-repository --remove ppa:graphics-drivers/ppa
# Update the index
sudo apt update타사 소스를 수동으로 추가
Docker 공식 소스를 예로 사용하면 다음과 같습니다.
# Download the GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
# Add the repository (DEB822 format)
# Note: Docker's official repository may not yet publish the resolute suite.
# If apt update reports a missing Release file, temporarily fall back to noble.
sudo tee /etc/apt/sources.list.d/docker.sources << 'EOF'
Types: deb
URIs: https://download.docker.com/linux/ubuntu
Suites: resolute
Components: stable
Signed-By: /usr/share/keyrings/docker-archive-keyring.gpg
EOF
# Update and install
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io구성된 소스 나열
# View all source files
ls /etc/apt/sources.list.d/
# View all sources used by APT
apt policy
# Check which source a package comes from
apt policy nginxAPT 업데이트 관리
기본 업데이트 명령
# Update the package index
sudo apt update
# Upgrade installed packages
sudo apt upgrade
# Smart upgrade (may install or remove dependencies)
sudo apt full-upgrade
# View upgradable packages without actually upgrading
apt list --upgradable
# Upgrade a specific package
sudo apt install --only-upgrade nginx업데이트 기록 보기
# View APT operation history
cat /var/log/apt/history.log
# View compressed history logs
zless /var/log/apt/history.log.1.gz
# View dpkg operation log
cat /var/log/dpkg.log패키지 고정
특정 패키지가 업데이트되는 것을 방지하려면 다음을 수행하세요.
# Hold a package version
sudo apt-mark hold package-name
# Unhold a package
sudo apt-mark unhold package-name
# View all held packages
apt-mark showhold무인 업그레이드 자동 업데이트
설치 및 활성화
# Install (usually pre-installed on Ubuntu 26.04)
sudo apt install unattended-upgrades
# Enable automatic updates
sudo dpkg-reconfigure -plow unattended-upgrades자동 업데이트 구성
기본 구성 파일을 편집합니다.
sudo nano /etc/apt/apt.conf.d/50unattended-upgrades주요 구성 옵션:
Unattended-Upgrade::Allowed-Origins {
"${distro_id}:${distro_codename}";
"${distro_id}:${distro_codename}-security";
"${distro_id}:${distro_codename}-updates";
// "${distro_id}:${distro_codename}-proposed";
// "${distro_id}:${distro_codename}-backports";
};
// Blacklist packages from auto-updating
Unattended-Upgrade::Package-Blacklist {
"linux-image*";
"linux-headers*";
"nginx";
};
// Automatically remove no-longer-needed dependencies
Unattended-Upgrade::Remove-Unused-Dependencies "true";
// Automatically remove no-longer-needed kernels
Unattended-Upgrade::Remove-Unused-Kernel-Packages "true";
// Automatically reboot if necessary
Unattended-Upgrade::Automatic-Reboot "true";
Unattended-Upgrade::Automatic-Reboot-Time "03:00";
// Email notifications
Unattended-Upgrade::Mail "admin@example.com";
Unattended-Upgrade::MailReport "on-change";업데이트 빈도 구성:
sudo nano /etc/apt/apt.conf.d/20auto-upgradesAPT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";
APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::AutocleanInterval "7";자동 업데이트 테스트
# Dry run (does not actually install)
sudo unattended-upgrade --dry-run --debug
# Run automatic updates immediately
sudo unattended-upgrade -v
# View automatic update logs
cat /var/log/unattended-upgrades/unattended-upgrades.log업데이트 전략 권장 사항
데스크톱 사용자
# Recommended: auto-install security updates, manually install feature updates
# /etc/apt/apt.conf.d/20auto-upgrades
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";
APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::AutocleanInterval "7";정기적으로 업데이트를 확인하고 수동으로 설치합니다.
sudo apt update && apt list --upgradable
sudo apt upgrade서버 환경
프로덕션 서버의 경우 다음을 수행하는 것이 좋습니다.
- 보안 업데이트만 자동 설치; 다른 업데이트를 수동으로 처리합니다.
- 계획된 업데이트에 대한 유지관리 기간을 설정하세요.
- 프로덕션에 적용하기 전에 스테이징 환경에서 테스트하세요.
- 이메일 알림을 활성화하여 업데이트 소식을 받아보세요.
# Recommended server configuration
# /etc/apt/apt.conf.d/50unattended-upgrades
Unattended-Upgrade::Allowed-Origins {
"${distro_id}:${distro_codename}-security";
};
Unattended-Upgrade::Automatic-Reboot "false";
Unattended-Upgrade::Mail "admin@example.com";버전 업그레이드
새로운 Ubuntu 버전으로 업그레이드
# Ensure the current system is fully updated
sudo apt update && sudo apt full-upgrade
# Check if a new version is available
do-release-upgrade -c
# Perform the version upgrade
sudo do-release-upgrade업데이트 후 정리
# Clean the downloaded deb package cache
sudo apt clean
# Remove no-longer-needed dependencies
sudo apt autoremove
# Clean residual configuration files
dpkg -l | awk '$1 == "rc" {print $2}'