mirror of https://github.com/tLDP/LDP
new
This commit is contained in:
parent
3fe13a526b
commit
c04c663c32
|
@ -0,0 +1,208 @@
|
|||
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook V4.1//EN"[]>
|
||||
<article id="Multi_Distro_Development">
|
||||
<articleinfo>
|
||||
<title>Development for Multiple Linux Distributions mini-HOWTO</title>
|
||||
<author>
|
||||
<firstname>Ed</firstname>
|
||||
<surname>Hill</surname>
|
||||
<affiliation><address><email><ed@eh3.com></email></address></affiliation>
|
||||
</author>
|
||||
<abstract>
|
||||
<para>This document outlines a quick hack to aid in developing
|
||||
and testing user-space programs for multiple Linux
|
||||
distributions.</para>
|
||||
</abstract>
|
||||
<pubdate>2001-12-03</pubdate>
|
||||
<revhistory>
|
||||
<revision>
|
||||
<revnumber>0.9</revnumber>
|
||||
<date>2001-12-03</date>
|
||||
<authorinitials>EH3</authorinitials>
|
||||
<revremark>Initial version.</revremark>
|
||||
</revision>
|
||||
</revhistory>
|
||||
</articleinfo>
|
||||
|
||||
<sect1 id="Introduction"> <title>Introduction</title>
|
||||
|
||||
<para>As a developer, there is occasionally a need to code and/or
|
||||
test programs on multiple Linux distributions. This mini-howto
|
||||
outlines a neat <application>chroot</application> trick that can,
|
||||
in many cases, obviate the need to reboot into different Linux
|
||||
distributions to do testing or development. </para>
|
||||
|
||||
<para>In a nutshell, the "trick" is to place all the files from a
|
||||
particular linux distribution into a single directory and then
|
||||
<application>chroot</application> into that directory to
|
||||
develop/test/debug your program. This approach will work provided
|
||||
that:
|
||||
</para>
|
||||
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
The kernel version of the "main" or "primary" distribution that you
|
||||
are running is (at least somewhat) compatible with the "secondary" or
|
||||
<application>chroot</application>'ed distributions, and
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Your application is primarily user-space (ie. no kernel modules) and
|
||||
does not depend intimately on any particular kernel features
|
||||
(ie. <filename>/proc</filename> behavior).
|
||||
</para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
|
||||
<sect2 id="Copyright"><title>Copyright and License</title>
|
||||
|
||||
<para>
|
||||
This document is copyright 2001 by Ed Hill III. Permission is granted
|
||||
to copy, distribute and/or modify this document under the terms of the
|
||||
GNU Free Documentation License, Version 1.1 or any later version
|
||||
published by the Free Software Foundation; with no Invariant Sections,
|
||||
with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the
|
||||
license is available at <ulink url="http://www.gnu.org/copyleft/fdl.html">
|
||||
http://www.gnu.org/copyleft/fdl.html</ulink>.
|
||||
</para>
|
||||
|
||||
</sect2>
|
||||
|
||||
</sect1>
|
||||
|
||||
<sect1 id="Setup"> <title>Setup</title>
|
||||
|
||||
<para>We assume that you already have:</para>
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
One "main" or "primary" Linux distribution installed that is running a
|
||||
2.4-series or newer kernel,
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
a free partition with 2--4Gigs available, and
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
sufficient disk
|
||||
space for the secondary installs (and any subsequent
|
||||
development/testing work).
|
||||
</para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
|
||||
<para>Given those assumptions, the following outline is one way to
|
||||
setup the multiple secondary Linux distributions that will be used
|
||||
for development, testing, or other purposes:
|
||||
</para>
|
||||
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
First, create or locate an unused partition on one of your hard drives
|
||||
that is large enough (usually 2--4Gb is sufficient) to do a basic
|
||||
install of one of the secondary Linux distributions.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Install the secondary distro into this partition but do not add it to
|
||||
your boot configuration. Note that this install need only include the
|
||||
packages that your target application (or tests) require. For
|
||||
instance, you may be able to ignore applications such as the X server
|
||||
or other space-hogs.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Reboot your primary Linux distribution and mount the partition
|
||||
containing the freshly-installed "secondary" distro. Copy (preferably
|
||||
using <filename>tar -cp</filename> or some other method that preserves
|
||||
permissions) all the files from the secondary distro to a location
|
||||
such as <filename>/opt/distros/DISTRO_NAME</filename>.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Repeat steps 2--3 for any additional distributions that you wish to
|
||||
install. The result should be a directory structure resembling:
|
||||
</para>
|
||||
<programlisting>
|
||||
/opt/distros/redhat_6.2/
|
||||
suse_7.2/
|
||||
mandrake_8.1/
|
||||
debian-potato/
|
||||
slackware_8.0/</programlisting>
|
||||
<para>
|
||||
where each directory contains the complete set of files resulting from
|
||||
each distribution install. </para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="Use"> <title>Using the Secondary Distributions</title>
|
||||
|
||||
<para>With the secondary distributions installed, the steps to use
|
||||
them are: </para>
|
||||
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
It is important to use a 2.4-series or newer Linux kernel in the
|
||||
"primary" Linux distribution in order to take advantage of the
|
||||
multiple mount points feature that the 2.4-series permits. For many
|
||||
tasks, the <filename>/proc</filename> filesystem will have to be
|
||||
remounted in the secondary distribution using:
|
||||
<programlisting>
|
||||
mount --bind /proc /opt/distros/redhat_6.2/proc</programlisting>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Also, it can be helpful to remount (rather than copy) the source tree
|
||||
from the primary to the secondary distro:
|
||||
<programlisting>
|
||||
mount --bind /home/USER/src/PROJECT /opt/distros/redhat_6.2/USER/src/PROJECT</programlisting>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Become root and use:
|
||||
<programlisting>
|
||||
chroot /opt/distros/redhat_6.2 /bin/bash</programlisting>
|
||||
to obtain a shell with one of the secondary distros.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Finally, create a user (if necessary) within the
|
||||
<filename>chroot</filename>-ed shell and develop, build, and/or test
|
||||
your application within this "separate" Linux distribution!
|
||||
</para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
|
||||
<para>Done! You now have a shell that is, for all practical
|
||||
purposes, running within the secondary Linux distribution of your
|
||||
choice. </para>
|
||||
|
||||
</sect1>
|
||||
|
||||
<sect1 id="Credits"> <title>Credits</title>
|
||||
|
||||
<para>The ideas contained in this mini-HOWTO are not mine. They
|
||||
are culled from posts by Ben Reed (of <ulink
|
||||
url="http://www.opennms.org/"> OpenNMS </ulink>) to one of the
|
||||
<ulink url="http://www.trilug.org/"> TriLUG </ulink> mailing lists.
|
||||
I found the information to be so useful that I wanted to document
|
||||
the idea for others. </para>
|
||||
|
||||
</sect1>
|
||||
|
||||
</article>
|
||||
|
||||
|
Loading…
Reference in New Issue