Installing in a chroot Debian/Ubuntu

From EPrints Documentation
Revision as of 18:16, 26 November 2007 by DaveTarrant (talk | contribs) (Step 1 - Install chroot)
Jump to: navigation, search

These instructions were submitted to ePrints via the EP-Tech mailing list:

Please email ep-tech with any comments / suggestions on this process as this was written by a user and has not been verified by the eprints team.


chroot allows you to create a "virtual machine" inside of an actual machine with its own libraries. Here you can run separate copies of apache and eprints.

Step 1 - Install chroot

All commands need to be executed as root unless otherwise specified. Ubuntu users should prefix all commands with sudo.

#apt-get install dchroot debootstrap
#mkdir /chroot/

Add this line to /etc/dchroot.conf:

feisty /chroot


#debootstrap --arch i386 feisty /chroot
#cp /var/lib/locales/supported.d/local /chroot/var/lib/locales/supported.d
#chroot /chroot
#dpkg-reconfigure locales

Step 2 - Configuring chroot

Add the following lines to /chroot/etc/apt/sources.list:

deb feisty main restricted universe multiverse
deb feisty-security main restricted
universe multiverse

You can also add ONE of the following for ePrints:

deb stable/
deb unstable/

Step 3 - Installing in the chroot

Change to your chroot by executing:

 #chroot /chroot
 #apt-get update;
 #apt-get upgrade;

Step 4 - User Details

In ANOTHER terminal (or exit chroot):

#cp /etc/passwd /chroot/etc/
#cp /etc/shadow /chroot/etc/
#cp /etc/group /chroot/etc/
#cp /etc/sudoers /chroot/etc/
#cp /etc/hosts /chroot/etc/

Step 5 - Home Areas and other directories

Add the following lines to /etc/fstab:

/home /chroot/home none bind 0 0
/tmp /chroot/tmp none bind 0 0
/dev /chroot/dev none bind 0 0
/proc /chroot/proc proc defaults 0 0
/media/cdrom0 /chroot/media/cdrom0 none bind 0 0
/usr/share/fonts /chroot/usr/share/fonts none bind 0 0

There may be more depending on the setup of your system and how it mounts devices.

Step 6 - Finalalising Install of chroot

 #mkdir /chroot/media/cdrom0
 #mkdir /chroot/usr/share/fonts
 #mount -a

Add the following to /usr/local/bin/do_dchroot (new file):

 exec /usr/bin/dchroot -d "`echo $0 | sed 's|^.*/||'` `for i in "$@";
 do echo -n '"'$i'" '; done`"
 #sudo chmod 755 /usr/local/bin/do_dchroot

Access your chroot now as yourself by executing (not as root):

 user@box# dchroot -d

Installing Eprints in a chroot

You can now follow the normal instructions from the many guides provided in Documentation.

If you added to your apt/sources.list then the following can be executed (as root):

 #apt-get install eprints

Follow the Instructions.