BLFS‎ > ‎

2. Essentials

created : 2010-02-03   updated : 2010-02-03
The definition of "essentials" in a BLFS system is very personal.  At least, after those "essentials" are installed, means we don't need the chroot environment anymore.  For example, without ssh support, a freshly installed LFS system have no ways to communicate with the outside world.  If you want to copy some files to it, you still have to use the chroot environment from the host OS. 
I intended to use putty to connect to my BLFS system, so I decided to install openssh first.  
After checking the BLFS ebook,  openssh have a required dependency.  So I have to install openssl first.
Download size: 3.2 MB
Estimated disk space required: 40 MB
Estimated build time: 1.2 SBU (additional 0.5 SBU to run the test suite)
Download :
Login to the host (in my case, the Virtual Ubuntu system) :

cd /mnt/lfs/blfs
Now go to the chroot environment. Instruction can be found in this page, I repeat here anyway.
export LFS=/mnt/lfs
mount /dev/sdb1 $LFS
mount -v --bind /dev $LFS/dev
mount -vt devpts devpts $LFS/dev/pts
mount -vt tmpfs shm $LFS/dev/shm
mount -vt proc proc $LFS/proc
mount -vt sysfs sysfs $LFS/sys
chroot "$LFS" /tools/bin/env -i \
HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
/tools/bin/bash --login +h
Unpack source :
cd /blfs
tar xvf openssl-0.9.8g.tar.gz
cd openssl-0.9.8g

Build and install :
time {
patch -Np1 -i ../openssl-0.9.8g-fix_manpages-1.patch &&
./config --openssldir=/etc/ssl --prefix=/usr shared &&
make MANDIR=/usr/share/man ;
real    4m12.725s
user    2m26.581s
sys     1m27.613s
To test the results, issue: make test.
Now, as the root user:
make MANDIR=/usr/share/man install &&
cp -v -r certs /etc/ssl &&
install -v -d -m755 /usr/share/doc/openssl-0.9.8g &&
cp -v -r doc/{HOWTO,README,*.{txt,html,gif}} \
Download size: 968 KB
Estimated disk space required: 16.2 MB
Estimated build time: 0.5 SBU (additional 1.2 SBU to run the test suite)

Unpack source :
cd /blfs
tar xvf openssh-4.7p1.tar.gz
cd openssh-4.7p1
Add user :
install -v -m700 -d /var/lib/sshd &&
chown -v root:sys /var/lib/sshd &&
groupadd -g 50 sshd &&
useradd -c 'sshd PrivSep' -d /var/lib/sshd -g sshd \
-s /bin/false -u 50 sshd
OpenSSH is very sensitive to changes in the linked OpenSSL libraries. If you recompile OpenSSL, OpenSSH may fail to startup. An alternative is to link against the static OpenSSL library. To link against the static library, execute the following command:
sed -i 's@-lcrypto@/usr/lib/libcrypto.a -ldl@' configure
Install OpenSSH by running the following commands:
time {
sed -i 's@ -ldes@@' configure &&
./configure --prefix=/usr --sysconfdir=/etc/ssh --datadir=/usr/share/sshd \
--libexecdir=/usr/lib/openssh --with-md5-passwords \
--with-privsep-path=/var/lib/sshd \
--with-xauth=/usr/bin/xauth &&
make ;
real    2m49.745s
user    1m14.141s
sys     1m25.169s
I skipped the test and install directly :
make install &&
install -v -m755 -d /usr/share/doc/openssh-4.7p1 &&
Config Files
~/.ssh/*, /etc/ssh/ssh_ config, and /etc/ssh/sshd_ config
Boot Script
unpack blfs-bootscripts-20080816.tar.bz2, change to that folder :
make install-sshd
At this point,  we don't need the chroot environment at all.
Yes, we don't have wget,  but it is not essential for eliminating the chroot environment, as we can copy file through scp.
So from now on, all packages will be built on a running BLFS system.  Not the chroot environment in the host OS (in my case, the Virtual Ubuntu).