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