<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Lemmz</id>
	<title>Alpine Linux - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Lemmz"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/Lemmz"/>
	<updated>2026-05-09T16:16:33Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Setting_up_the_build_environment_in_a_chroot&amp;diff=2980</id>
		<title>Setting up the build environment in a chroot</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Setting_up_the_build_environment_in_a_chroot&amp;diff=2980"/>
		<updated>2009-08-16T09:39:42Z</updated>

		<summary type="html">&lt;p&gt;Lemmz: changed --root from fixed path to ${build_dir} at &amp;quot;basic chroot&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Setting up a build environment for Alpine 1.9 =&lt;br /&gt;
&lt;br /&gt;
This document explains how to set up an Alpine build environment in a chroot under a &amp;quot;normal&amp;quot; Linux distro, such as Arch, Debian, Fedora, Gentoo,  or Ubuntu. Once inside the chroot environment, you can build, debug and run alpine packages.&lt;br /&gt;
&lt;br /&gt;
== Introduction  ==&lt;br /&gt;
&lt;br /&gt;
You will need a few Gigabytes to have enough pace for kernel compiling and storing all the binary packages and iso image. &lt;br /&gt;
&lt;br /&gt;
== Create a build environment  ==&lt;br /&gt;
&lt;br /&gt;
We are setting up our Build Environment in chroot.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; The variables below: &lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;${build_dir}&#039;&#039;&#039; = You can name it whatever you like. &lt;br /&gt;
*&#039;&#039;&#039;${mirror}&#039;&#039;&#039; = Should be replaced with one of the available alpine-mirrors:&lt;br /&gt;
&lt;br /&gt;
{{Mirrors}} &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; Lets start by geting the latest apk static binary: &lt;br /&gt;
&lt;br /&gt;
 wget ${mirror}/v1.9/apk.static&lt;br /&gt;
 chmod +x ./apk.static&lt;br /&gt;
&lt;br /&gt;
Verify you have apk-tools 2.0_rc1 or later:&lt;br /&gt;
 ./apk.static --version&lt;br /&gt;
   apk-tools 2.0_rc1&lt;br /&gt;
&lt;br /&gt;
We are setting up a basic chroot: &lt;br /&gt;
&lt;br /&gt;
 mkdir ${build_dir}&lt;br /&gt;
 sudo ./apk.static --repo ${mirror}/v1.9/packages/main -U --allow-untrusted --root ${build_dir} --initdb add alpine-base alpine-sdk&lt;br /&gt;
 mkdir -p ./${build_dir}/proc&lt;br /&gt;
 sudo mount --bind /proc ./${build_dir}/proc&lt;br /&gt;
&lt;br /&gt;
Lets setup our needed devices: &lt;br /&gt;
&lt;br /&gt;
 sudo mknod -m 666 ./${build_dir}/dev/full c 1 7&lt;br /&gt;
 sudo mknod -m 777 ./${build_dir}/dev/null c 1 3&lt;br /&gt;
 sudo mknod -m 666 ./${build_dir}/dev/ptmx c 5 2&lt;br /&gt;
 sudo mknod -m 644 ./${build_dir}/dev/random c 1 8&lt;br /&gt;
 sudo mknod -m 644 ./${build_dir}/dev/urandom c 1 9&lt;br /&gt;
 sudo mknod -m 666 ./${build_dir}/dev/zero c 1 5&lt;br /&gt;
 sudo mknod -m 666 ./${build_dir}/dev/tty c 5 0&lt;br /&gt;
&lt;br /&gt;
We need or dns servers and root dir: &lt;br /&gt;
&lt;br /&gt;
 sudo cp /etc/resolv.conf ./${build_dir}/etc/&lt;br /&gt;
 mkdir -p ./${build_dir}/root&lt;br /&gt;
&lt;br /&gt;
We are setting up apk mirrors: &lt;br /&gt;
&lt;br /&gt;
 sudo mkdir -p ./${build_dir}/etc/apk&lt;br /&gt;
 su&lt;br /&gt;
 echo &amp;quot;${mirror}/v1.9/packages/main&amp;quot; &amp;gt; ./${build_dir}/etc/apk/repositories&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
At this point you should be able to enter your chroot: &lt;br /&gt;
&lt;br /&gt;
 sudo chroot ./${build_dir} /bin/sh -l&lt;/div&gt;</summary>
		<author><name>Lemmz</name></author>
	</entry>
</feed>