[1987d72] | 1 | <sect1 id="ch06-creatingdirs">
|
---|
| 2 | <title>Creating directories</title>
|
---|
| 3 | <?dbhtml filename="creatingdirs.html" dir="chapter06"?>
|
---|
| 4 |
|
---|
[44c2fd8] | 5 | <para>Let's now create some structure in our LFS file system, let's create
|
---|
| 6 | a directory tree. Issuing the following commands will create a more or less
|
---|
| 7 | standard tree:</para>
|
---|
[1987d72] | 8 |
|
---|
| 9 | <para><screen><userinput>mkdir -p /{bin,boot,dev/pts,etc/opt,home,lib,mnt,proc} &&
|
---|
[b864e06] | 10 | mkdir -p /{root,sbin,tmp,usr/local,var,opt} &&
|
---|
[1987d72] | 11 | for dirname in /usr /usr/local
|
---|
| 12 | do
|
---|
| 13 | mkdir $dirname/{bin,etc,include,lib,sbin,share,src}
|
---|
| 14 | ln -s share/{man,doc,info} $dirname
|
---|
| 15 | mkdir $dirname/share/{dict,doc,info,locale,man}
|
---|
| 16 | mkdir $dirname/share/{nls,misc,terminfo,zoneinfo}
|
---|
| 17 | mkdir $dirname/share/man/man{1,2,3,4,5,6,7,8}
|
---|
| 18 | done &&
|
---|
| 19 | mkdir /var/{lock,log,mail,run,spool} &&
|
---|
| 20 | mkdir -p /var/{tmp,opt,cache,lib/misc,local} &&
|
---|
| 21 | mkdir /opt/{bin,doc,include,info} &&
|
---|
| 22 | mkdir -p /opt/{lib,man/man{1,2,3,4,5,6,7,8}} &&
|
---|
| 23 | ln -s ../var/tmp /usr</userinput></screen></para>
|
---|
| 24 |
|
---|
[44c2fd8] | 25 | <para>Directories are by default created with permission mode 755, but this
|
---|
| 26 | isn't desirable for all directories. We will make two changes: one to the home
|
---|
| 27 | directory of root, and another to the directories for temporary files.</para>
|
---|
[1987d72] | 28 |
|
---|
[a358a47] | 29 | <para><screen><userinput>chmod 0750 /root &&
|
---|
| 30 | chmod 1777 /tmp /var/tmp</userinput></screen></para>
|
---|
[1987d72] | 31 |
|
---|
[44c2fd8] | 32 | <para>The first mode change ensures that not just everybody can enter the
|
---|
| 33 | <filename class="directory">/root</filename> directory -- the same
|
---|
| 34 | a normal user would do with his or her home directory.
|
---|
| 35 | The second mode change makes sure that any user can write to the
|
---|
| 36 | <filename class="directory">/tmp</filename> and
|
---|
| 37 | <filename class="directory">/var/tmp</filename> directories, but
|
---|
| 38 | cannot remove other users's files from them. The latter is prohibited
|
---|
| 39 | by the so-called "sticky bit" -- the highest bit in the 1777 bit mask.</para>
|
---|
| 40 |
|
---|
[06c61ca] | 41 | <para>Now that the directories are created, move the source tarballs that
|
---|
[26e62aa] | 42 | were downloaded in Chapter 3 to some subdirectory under
|
---|
[44c2fd8] | 43 | <filename class="directory">/usr/src</filename> (you
|
---|
| 44 | will have to create the desired subdirectory yourself).</para>
|
---|
[1987d72] | 45 |
|
---|
| 46 | <sect2>
|
---|
[44c2fd8] | 47 | <title>FHS compliance note</title>
|
---|
| 48 |
|
---|
| 49 | <para>We have based our directory tree on the FHS standard (available at
|
---|
| 50 | <ulink url="http://www.pathname.com/fhs/"/>). Besides the above created
|
---|
| 51 | tree this standard stipulates the existence of
|
---|
| 52 | <filename class="directory">/usr/local/games</filename> and
|
---|
| 53 | <filename class="directory">/usr/share/games</filename>, but we don't
|
---|
| 54 | much like these for a base system. However, feel free to make your system
|
---|
| 55 | FHS-compliant. As to the structure of the
|
---|
| 56 | <filename class="directory">/usr/local/share</filename> subdirectory the FHS
|
---|
| 57 | isn't precise, so we created here the directories that we think are needed.</para>
|
---|
[1987d72] | 58 |
|
---|
| 59 | </sect2>
|
---|
| 60 |
|
---|
| 61 | </sect1>
|
---|
| 62 |
|
---|