cd ubuntu-base-22.04-base-amd64
find . | cpio -o -H newc | gzip > ../initramfs.gz
dd if=/dev/zero of=ubuntu-disk.img bs=1M count=2048
mkfs.ext4 ubuntu-disk.img
Mount 후 rootfs 옮기기 → Umount 실행
sudo mount -o loop ubuntu-disk.img ./mount_point
bash
cat <<EOF > /etc/apt/sources.list
deb <http://archive.ubuntu.com/ubuntu> jammy main restricted universe multiverse
deb <http://archive.ubuntu.com/ubuntu> jammy-updates main restricted universe multiverse
deb <http://security.ubuntu.com/ubuntu> jammy-security main restricted universe multiverse
deb <http://archive.ubuntu.com/ubuntu> jammy-backports main restricted universe multiverse
EOF
echo "nameserver 8.8.8.8" > /etc/resolv.conf
All in One Set SCript
#!/bin/bash
# LTS 버전별 소스 리스트 생성 함수
generate_sources_list() {
local version=$1
case $version in
"16.04")
cat <<EOF > /etc/apt/sources.list
deb <http://archive.ubuntu.com/ubuntu> xenial main restricted universe multiverse
deb <http://archive.ubuntu.com/ubuntu> xenial-updates main restricted universe multiverse
deb <http://archive.ubuntu.com/ubuntu> xenial-security main restricted universe multiverse
deb <http://archive.ubuntu.com/ubuntu> xenial-backports main restricted universe multiverse
EOF
;;
"18.04")
cat <<EOF > /etc/apt/sources.list
deb <http://archive.ubuntu.com/ubuntu> bionic main restricted universe multiverse
deb <http://archive.ubuntu.com/ubuntu> bionic-updates main restricted universe multiverse
deb <http://security.ubuntu.com/ubuntu> bionic-security main restricted universe multiverse
deb <http://archive.ubuntu.com/ubuntu> bionic-backports main restricted universe multiverse
EOF
;;
"20.04")
cat <<EOF > /etc/apt/sources.list
deb <http://archive.ubuntu.com/ubuntu> focal main restricted universe multiverse
deb <http://archive.ubuntu.com/ubuntu> focal-updates main restricted universe multiverse
deb <http://security.ubuntu.com/ubuntu> focal-security main restricted universe multiverse
deb <http://archive.ubuntu.com/ubuntu> focal-backports main restricted universe multiverse
EOF
;;
"22.04")
cat <<EOF > /etc/apt/sources.list
deb <http://archive.ubuntu.com/ubuntu> jammy main restricted universe multiverse
deb <http://archive.ubuntu.com/ubuntu> jammy-updates main restricted universe multiverse
deb <http://security.ubuntu.com/ubuntu> jammy-security main restricted universe multiverse
deb <http://archive.ubuntu.com/ubuntu> jammy-backports main restricted universe multiverse
EOF
;;
"24.04")
mkdir -p /etc/apt/sources.list.d
cat <<EOF > /etc/apt/sources.list.d/ubuntu.sources
Types: deb
URIs: <http://archive.ubuntu.com/ubuntu/>
Suites: noble noble-updates noble-backports
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
EOF
;;
*)
echo "지원되지 않는 버전입니다: $version"
exit 1
;;
esac
}
# DNS 설정 함수
configure_dns() {
echo "nameserver 8.8.8.8" > /etc/resolv.conf
echo "nameserver 8.8.4.4" >> /etc/resolv.conf
}
# 사용자 입력받기
read -p "Ubuntu LTS Version (16.04, 18.04, 20.04, 22.04, 24.04): " ubuntu_version
# 소스 리스트 구성 및 DNS 설정
echo "Ubuntu Version Input: $ubuntu_version"
generate_sources_list "$ubuntu_version"
echo "sources.list 구성 완료."
configure_dns
echo "DNS 설정 완료."
# 업데이트 실행
echo "패키지 리스트 업데이트 중..."
apt update
echo "업데이트 완료."