ubuntu 개발용 chroot 시스템 만들기

ubuntu에 개발용 시스템을 만드는 방법을 정리한다.

개발 시스템을 구성하는 패키지 설치

# apt install -y debootstrap
# apt install -y schroot

 

개발용 시스템 구축을 위한 환경 파일 구성

# vi /etc/schroot/chroot.d/focal_x64.conf

-------------------------------------------------
[focal_x64]
description=Ubuntu 20.04.3 LTS x64
location=/home/develope/ubuntu_20_chroot
#personality=linux32
root-users=kinkist
type=directory
users=test
-------------------------------------------------

 

개발용 시스템을 구축할 디렉토리 생성

# mkdir -p /home/develope/ubuntu_20_chroot

 

개발용 시스템 구축

# debootstrap --variant=buildd focal /home/develope/ubuntu_20_chroot http://mirror.kakao.com/ubuntu/

 

사용법

보통은 schroot를 사용하라고 하는데 아래와 같이 그냥 chroot를 사용해도 된다.

# chroot /home/develope/ubuntu_20_chroot /bin/bash
(focal_x64)root@test:/#

or

# schroot -c focal_x64
W: line 3 [focal_x64]: Obsolete key ‘location’ used
I: This option has been removed, and no longer has any effect
(focal_x64)root@:/#