creatingdirs.xml 2.8 KB

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