[7152faa] | 1 | <?xml version="1.0" encoding="UTF-8"?>
|
---|
[fcc02767] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
| 4 | <!ENTITY % general-entities SYSTEM "../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 | ]>
|
---|
| 7 |
|
---|
| 8 | <sect1 id="ch-tools-creatingdirs">
|
---|
| 9 | <?dbhtml filename="creatingdirs.html"?>
|
---|
| 10 |
|
---|
| 11 | <title>Creating Directories</title>
|
---|
| 12 |
|
---|
[36cb08f] | 13 | <para>It is time to create the full directory structure in the LFS file system.</para>
|
---|
[fcc02767] | 14 |
|
---|
[36cb08f] | 15 | <note><para>Some of the directories mentioned in this section may have
|
---|
| 16 | already been created earlier with explicit instructions, or when installing some
|
---|
[9b73f94] | 17 | packages. They are repeated below for completeness.</para></note>
|
---|
| 18 |
|
---|
[17ca548] | 19 | <para>Create some root-level directories that are not in the limited set
|
---|
| 20 | required in the previous chapters by issuing the following command:</para>
|
---|
| 21 |
|
---|
| 22 | <screen><userinput>mkdir -pv /{boot,home,mnt,opt,srv}</userinput></screen>
|
---|
| 23 |
|
---|
| 24 | <para>Create the required set of subdirectories below the root-level by
|
---|
| 25 | issuing the following commands:</para>
|
---|
| 26 |
|
---|
| 27 | <screen><userinput>mkdir -pv /etc/{opt,sysconfig}
|
---|
| 28 | mkdir -pv /lib/firmware
|
---|
| 29 | mkdir -pv /media/{floppy,cdrom}
|
---|
[d7a9421] | 30 | mkdir -pv /usr/{,local/}{include,src}
|
---|
[5818041] | 31 | mkdir -pv /usr/lib/locale
|
---|
[d7a9421] | 32 | mkdir -pv /usr/local/{bin,lib,sbin}
|
---|
[fcc02767] | 33 | mkdir -pv /usr/{,local/}share/{color,dict,doc,info,locale,man}
|
---|
[387a32af] | 34 | mkdir -pv /usr/{,local/}share/{misc,terminfo,zoneinfo}
|
---|
[fcc02767] | 35 | mkdir -pv /usr/{,local/}share/man/man{1..8}
|
---|
[17ca548] | 36 | mkdir -pv /var/{cache,local,log,mail,opt,spool}
|
---|
| 37 | mkdir -pv /var/lib/{color,misc,locate}
|
---|
[fcc02767] | 38 |
|
---|
[ba82c18] | 39 | ln -sfv /run /var/run
|
---|
| 40 | ln -sfv /run/lock /var/lock
|
---|
[17ca548] | 41 |
|
---|
| 42 | install -dv -m 0750 /root
|
---|
| 43 | install -dv -m 1777 /tmp /var/tmp</userinput></screen>
|
---|
[fcc02767] | 44 |
|
---|
| 45 | <para>Directories are, by default, created with permission mode 755, but
|
---|
[36cb08f] | 46 | this is not desirable everywhere. In the commands above, two
|
---|
[fcc02767] | 47 | changes are made—one to the home directory of user <systemitem
|
---|
| 48 | class="username">root</systemitem>, and another to the directories for
|
---|
| 49 | temporary files.</para>
|
---|
| 50 |
|
---|
| 51 | <para>The first mode change ensures that not just anybody can enter
|
---|
[36cb08f] | 52 | the <filename class="directory">/root</filename> directory—just
|
---|
| 53 | like a normal user would do with his or her own home directory. The
|
---|
[fcc02767] | 54 | second mode change makes sure that any user can write to the
|
---|
| 55 | <filename class="directory">/tmp</filename> and <filename
|
---|
| 56 | class="directory">/var/tmp</filename> directories, but cannot remove
|
---|
| 57 | another user's files from them. The latter is prohibited by the so-called
|
---|
[c88ec71] | 58 | <quote>sticky bit,</quote> the highest bit (1) in the 1777 bit mask.</para>
|
---|
[fcc02767] | 59 |
|
---|
| 60 | <sect2>
|
---|
| 61 | <title>FHS Compliance Note</title>
|
---|
| 62 |
|
---|
[36cb08f] | 63 | <para>This directory tree is based on the Filesystem Hierarchy Standard
|
---|
[fcc02767] | 64 | (FHS) (available at <ulink
|
---|
| 65 | url="https://refspecs.linuxfoundation.org/fhs.shtml"/>). The FHS also specifies
|
---|
[36cb08f] | 66 | the optional existence of additional directories such as <filename
|
---|
[fcc02767] | 67 | class="directory">/usr/local/games</filename> and <filename
|
---|
[36cb08f] | 68 | class="directory">/usr/share/games</filename>. In LFS, we create only the
|
---|
| 69 | directories that are really necessary. However, feel free to create more
|
---|
| 70 | directories, if you wish. </para>
|
---|
[fcc02767] | 71 |
|
---|
[295e337] | 72 | <warning>
|
---|
| 73 | <para>
|
---|
[da6e70f] | 74 | The FHS does not mandate the existence of the directory
|
---|
[295e337] | 75 | <filename class="directory">/usr/lib64</filename>, and the LFS editors
|
---|
[da6e70f] | 76 | have decided not to use it. For the instructions in LFS and BLFS to work correctly,
|
---|
| 77 | it is imperative that this directory be non-existent. From time to time you should
|
---|
| 78 | verify that it does not exist, because it is easy to create it
|
---|
| 79 | inadvertently, and this will probably break your system.
|
---|
[295e337] | 80 | </para>
|
---|
| 81 | </warning>
|
---|
| 82 |
|
---|
[fcc02767] | 83 | </sect2>
|
---|
| 84 |
|
---|
| 85 | </sect1>
|
---|