installasuser.xml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <sect1 id="ch05-installasuser">
  2. <title>Install all software as an unprivileged user</title>
  3. <?dbhtml filename="installasuser.html" dir="chapter05"?>
  4. <para>When you are logged in as root during chapter 5, it is possible
  5. that some files of your host system will be overwritten by the ones
  6. you'll build in chapter 5. There can be all kinds of reasons for this
  7. to happen, for example because the $LFS environment variable is not
  8. set. Overwriting some files from your host system will most likely
  9. cause all kinds of problems, so it's a good idea to be logged in as
  10. an unprivileged user during chapter 5. To make sure the environment
  11. is as clean as possible, we'll create a new user "lfs" that can be
  12. used while building the static installation. Issuing the following
  13. commands as root will create a new user "lfs":</para>
  14. <para><screen><userinput>useradd -s /bin/bash -m lfs &amp;&amp;
  15. passwd lfs</userinput></screen></para>
  16. <para>Now it's time to change the permissions on your LFS partitions
  17. so user "lfs" will have write access to it. Run the following command
  18. as root to change the ownership of the LFS partition to user "lfs":</para>
  19. <para><screen><userinput>chown -R lfs $LFS</userinput></screen></para>
  20. <para>Now you can login as user "lfs". You can do this two ways: either
  21. the normal way through the console or the display manager, or with
  22. <userinput>su - lfs</userinput>. When you're working as user "lfs", type
  23. the following commands to set up a good environment to work in:</para>
  24. <para><screen><userinput>cat &gt; ~/.bash_profile &lt;&lt; "EOF"
  25. umask 022
  26. LFS=/mnt/lfs
  27. LC_ALL=POSIX
  28. export LFS LC_ALL
  29. EOF
  30. source ~/.bash_profile</userinput></screen></para>
  31. <para>This profile makes sure the umask is set to 022 so newly created
  32. files and directories will have the correct permission. It is advisable
  33. to keep this setting throughout your LFS installation. Also, the $LFS
  34. and $LC_ALL environment variables are set. $LFS has been explained in
  35. previous chapters already. $LC_ALL is a variable that is used for
  36. internationalization.</para>
  37. <para>When your host distribution uses a glibc version older than 2.2.4,
  38. having $LC_ALL set to something else than "C" or "POSIX" while working
  39. through chapter 5 may cause trouble when you exit the chroot environment
  40. of chapter 6 and try to return to it. By setting this to "POSIX" ("C"
  41. is an alias for "POSIX") we ensure that everything will work as expected
  42. in the chroot environment.</para>
  43. </sect1>