creatingdirs.xml 2.8 KB

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