1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
|
---|
3 | <!ENTITY % general-entities SYSTEM "../general.ent">
|
---|
4 | %general-entities;
|
---|
5 | ]>
|
---|
6 | <sect1 id="ch-system-creatingdirs">
|
---|
7 | <title>Creating Directories</title>
|
---|
8 | <?dbhtml filename="creatingdirs.html"?>
|
---|
9 |
|
---|
10 | <para>It is time to create some structure in the LFS file system. Create a
|
---|
11 | standard directory tree by issuing the following commands:</para>
|
---|
12 |
|
---|
13 | <screen><userinput>install -d /{bin,boot,dev,etc/opt,home,lib,mnt}
|
---|
14 | install -d /{sbin,srv,usr/local,var,opt}
|
---|
15 | install -d /root -m 0750
|
---|
16 | install -d /tmp /var/tmp -m 1777
|
---|
17 | install -d /media/{floppy,cdrom}
|
---|
18 | install -d /usr/{bin,include,lib,sbin,share,src}
|
---|
19 | ln -s share/{man,doc,info} /usr
|
---|
20 | install -d /usr/share/{doc,info,locale,man}
|
---|
21 | install -d /usr/share/{misc,terminfo,zoneinfo}
|
---|
22 | install -d /usr/share/man/man{1,2,3,4,5,6,7,8}
|
---|
23 | install -d /usr/local/{bin,etc,include,lib,sbin,share,src}
|
---|
24 | ln -s share/{man,doc,info} /usr/local
|
---|
25 | install -d /usr/local/share/{doc,info,locale,man}
|
---|
26 | install -d /usr/local/share/{misc,terminfo,zoneinfo}
|
---|
27 | install -d /usr/local/share/man/man{1,2,3,4,5,6,7,8}
|
---|
28 | install -d /var/{lock,log,mail,run,spool}
|
---|
29 | install -d /var/{opt,cache,lib/{misc,locate},local}
|
---|
30 | install -d /opt/{bin,doc,include,info}
|
---|
31 | install -d /opt/{lib,man/man{1,2,3,4,5,6,7,8}}</userinput></screen>
|
---|
32 |
|
---|
33 | <para>Directories are, by default, created with permission mode 755,
|
---|
34 | but this is not desirable for all directories. In the commands above,
|
---|
35 | two changes are made—one to the home directory of user
|
---|
36 | <emphasis>root</emphasis>, and another to the directories for
|
---|
37 | temporary files.</para>
|
---|
38 |
|
---|
39 | <para>The first mode change ensures that not just anybody can enter
|
---|
40 | the <filename class="directory">/root</filename> directory—the same
|
---|
41 | as a normal user would do with his or her home directory. The second
|
---|
42 | mode change makes sure that any user can write to the <filename
|
---|
43 | class="directory">/tmp</filename> and <filename
|
---|
44 | class="directory">/var/tmp</filename> directories, but cannot remove
|
---|
45 | another user's files from them. The latter is prohibited by the
|
---|
46 | so-called <quote>sticky bit,</quote> the highest bit (1) in the 1777
|
---|
47 | bit mask.</para>
|
---|
48 |
|
---|
49 | <sect2>
|
---|
50 | <title>FHS Compliance Note</title>
|
---|
51 |
|
---|
52 | <para>The directory tree is based on the Filesystem Hierarchy Standard (FHS)
|
---|
53 | (available at <ulink url="http://www.pathname.com/fhs/"/>). In addition
|
---|
54 | to the tree created above, this standard stipulates the existence of <filename
|
---|
55 | class="directory">/usr/local/games</filename> and <filename
|
---|
56 | class="directory">/usr/share/games</filename>. The FHS is not precise as to the
|
---|
57 | structure of the <filename class="directory">/usr/local/share</filename>
|
---|
58 | subdirectory, so we create only the directories that are needed. However, feel
|
---|
59 | free to create these directories if you prefer to conform more strictly to the
|
---|
60 | FHS.</para>
|
---|
61 |
|
---|
62 | </sect2>
|
---|
63 |
|
---|
64 | </sect1>
|
---|
65 |
|
---|