| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 | <sect1 id="ch05-installasuser"><title>Install all software as an unprivileged user</title><?dbhtml filename="installasuser.html" dir="chapter05"?><para>When you are logged in as root during chapter 5, it is possiblethat some files of your host system will be overwritten by the onesyou'll build in chapter 5. There can be all kinds of reasons for thisto happen, for example because the $LFS environment variable is notset. Overwriting some files from your host system will most likelycause all kinds of problems, so it's a good idea to be logged in asan unprivileged user during chapter 5. To make sure the environmentis as clean as possible, we'll create a new user "lfs" that can beused while building the static installation. Issuing the followingcommands as root will create a new user "lfs":</para><para><screen><userinput>useradd -s /bin/bash -m lfs &&passwd lfs</userinput></screen></para><para>Now we need to give proper permissions to the <filenameclass="directory">$LFS/static</filename> directory so user "lfs" can writeto it:</para><para><screen><userinput>chown -R lfs $LFS/static</userinput></screen></para><para>Now you can login as user "lfs". You can do this two ways: eitherthe normal way through the console or the display manager, or with<userinput>su - lfs</userinput>. When you're working as user "lfs", typethe following commands to set up a good environment to work in:</para><para><screen><userinput>cat > ~/.bash_profile << "EOF"umask 022LFS=/mnt/lfsLC_ALL=POSIXCC='gcc -s'export LFS LC_ALL CCEOFsource ~/.bash_profile</userinput></screen></para><para>This profile makes sure the umask is set to 022 so newly createdfiles and directories will have the correct permissions. It is advisableto keep this setting throughout your LFS installation. Also, the $LFS,$LC_ALL, and $CC environment variables are set. $LFS has been explainedin previous chapters already. $LC_ALL is a variable that is used forinternationalization.</para><para>When your host distribution uses a glibc version older than 2.2.4,having $LC_ALL set to something else than "C" or "POSIX" while workingthrough chapter 5 may cause trouble when you exit the chroot environmentof chapter 6 and try to return to it. By setting this to "POSIX" ("C"is an alias for "POSIX") we ensure that everything will work as expectedin the chroot environment.</para><para>$CC is a variable we set in order to prevent debugging symbols frombeing compiled into our static packages. By omitting these symbols duringthe linking stage of compilation, we save hard drive space and decreaseour the build time.</para></sect1>
 |