Chroot
From Koset Surakomol
I found a great source for how to build a chroot environment with Fedora. It was originally written for FC9, but I adapted it for FC10.
Modifications
I found that in order to make Apache work, I needed to do the following. First, I changed the listen port to 10080 so it wouldn't interfere with my regular apache. Second, I had to make a file /var/www/html/index.html because nothing existed. Third, I had to create the random devices.
pre mknod -m 644 /dev/random c 1 8 mknod -m 644 /dev/urandom c 1 9 chown root:root /dev/random /dev/urandom /pre
I also had to add some more packages that I use often. pre yum -y install httpd lynx curl wget tar which nc telnet ftp openssh-server openssh-clients openssh-askpass rsync /pre
I manually installed ccrypt, ncftp and ncftpd. In order to allow anonymous users to upload, it required manually creating the directory for /var/ftp/incoming
Notes
I might have it copy a pre-made etc/yum.repos.d/fedora.repo so I don't have to edit it. Then the whole process can be automated.
I also used an encrypted file container. See Encrypted_File_System. That also makes it transportable and easy to back up.
Script
Here is my starter script:
pre
- How to install FC10 in a chroot
- http://cormander.com/blog/2008/05/install-fc9-into-a-chroot-from-a-dvd-iso/
if [ -d $1 ] ; then if [ -f /b/FC10/Fedora-10-i386-DVD/Fedora-10-i386-DVD.iso ] ; then
- create target directories
mkdir -p $1/dev mkdir -p $1/etc mkdir -p $1/proc mkdir -p $1/var/lib/rpm mkdir -p $1/mnt/fc10-dvd cp /etc/resolv.conf $1/etc/
- setup the installroot so yum works inside it
mknod $1/dev/null c 1 3 mount -t proc none $1/proc rpm --root $1 --initdb
- mount your Fedora-10 DVD iso image
- NOTE: change /PATH/TO/ to the path to your .iso file
mount -o loop /b/FC10/Fedora-10-i386-DVD/Fedora-10-i386-DVD.iso $1/mnt/fc10-dvd
- create a symlink to the target iso mount
ln -s $1/mnt/fc10-dvd /mnt/
- force the install of the release file so we can use its contents for yum
rpm --root $1 -Uvh --nodeps $1/mnt/fc10-dvd/Packages/fedora-release-10-1.noarch. rpm
- import the Fedora GPG key
rpm --root $1 --import http://download.fedora.redhat.com/pub/fedora/linux/releas es/10/Fedora/i386/os/RPM-GPG-KEY-fedora
echo Now you need to edit the file: echo vi $1/etc/yum.repos.d/fedora.repo echo and comment out the “mirrorlist” line, and under it add a new line: echo baseurl=file:///mnt/fc10-dvd/ echo echo You also need to do: echo mknod -m 644 /dev/random c 1 8 echo mknod -m 644 /dev/urandom c 1 9 echo chown root:root /dev/random /dev/urandom echo echo Hit return when ready. read something
yum --installroot=$1 -y install wget bash gcc rpm-build \
make yum rootfiles pam pam-devel bzip2-devel curl-devel gmp-devel \ libjpeg-devel libpng-devel smtpdaemon ncurses-devel freetype-devel \ vim-minimal
else echo No iso file found fi else echo No such directory $1 fi /pre
