LoginSignup
1
1

More than 3 years have passed since last update.

各種 Linux の chroot による開発環境の分離まとめ

Posted at

chroot による開発環境の分離まとめ

OpenCV によるクロスプラットフォーム開発において Linux の開発環境を chroot で本体から切り分けたかったので。

※ とはいえ一番簡単なのは Docker だと思う。

※ FreeBSD なら jail。

※ macOS には chroot 有り。brew の jailkit や brew 自身と併用で色々出来そう。

※ Windows なら UNIX Like な開発環境は Cygwin にせよ MSYS2 にせよ WSL1 や WSL2 にせよある程度分離されている気がしないでもないので割愛。

chroot について

Debian/Ubuntu

pbuilder を使用する
https://www.debian.org/doc/manuals/maint-guide/build.ja.html
https://wiki.ubuntu.com/PbuilderHowto

参考とした文献

Fedora/RHEL/CentOS

mock を使用する
https://github.com/rpm-software-management/mock/wiki

参考とした文献

Slackware/Zenwalk/SalixOS

インストールCD から対象ディレクトリに展開・導入する
https://docs.slackware.com/howtos:general_admin:setting_up_a_slackware_chroot

あとは通常手順で chroot

Arch

pacstrap コマンドを用いる
https://wiki.archlinux.jp/index.php/インストールガイド#ベースシステムのインストール

pacstrap /var/tmp/chroot base base-devel

あとは通常手順で chroot

Manjaro

extra/manjaro-tools-base に含まれる basestrap コマンドを用いる
https://wiki.manjaro.org/index.php?title=Manjaro-tools

basestrap /var/tmp/chroot base base-devel

あとは通常手順で chroot

Gentoo

stage3 イメージを対象ディレクトリに展開する
https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Stage/ja

あとは通常手順で chroot

Sabayon

Sabayon_Linux_<年>.<月>_amd64_tarball.tar.gz を対象ディレクトリに展開する

mkdir /var/tmp/chroot
cd /var/tmp/chroot
curl -LO http://<ミラーのSabayonのディレクトリ>/stable/Sabayon_Linux_<年>.<月>_amd64_tarball.tar.gz
#以下は理研のミラーの場合
#curl -LO http://ftp.riken.jp/Linux/sabayon/stable/Sabayon_Linux_19.03_amd64_tarball.tar.gz
tar xpvf Sabayon_Linux_<年>.<月>_amd64_tarball.tar.gz --xattrs-include='*.*' --numeric-owner # アーカイブの展開

あとは通常手順で chroot

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1