creatingdirs.xml 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/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>Let's now create some structure in our LFS file system. Let's create
  10. a directory tree. Issuing the following commands will create a more or less
  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, but this
  32. isn't desirable for all directories. In the commands above, we make two changes:
  33. one to the home directory of <emphasis>root</emphasis>, and another to the
  34. directories for temporary files.</para>
  35. <para>The first mode change ensures that not just anybody can enter the
  36. <filename class="directory">/root</filename> directory -- the same
  37. as a normal user would do with his or her home directory.
  38. The second mode change makes sure that any user can write to the
  39. <filename class="directory">/tmp</filename> and
  40. <filename class="directory">/var/tmp</filename> directories, but
  41. cannot remove other users' files from them. The latter is prohibited
  42. by the so-called <quote>sticky bit</quote> -- the highest bit in the 1777 bit
  43. mask.</para>
  44. <sect2>
  45. <title>FHS compliance note</title>
  46. <para>We have based our directory tree on the FHS standard (available at
  47. <ulink url="http://www.pathname.com/fhs/"/>). Besides the above created
  48. tree this standard stipulates the existence of
  49. <filename class="directory">/usr/local/games</filename> and
  50. <filename class="directory">/usr/share/games</filename>, but we don't
  51. much like these for a base system. However, feel free to make your system
  52. FHS-compliant. As to the structure of the
  53. <filename class="directory">/usr/local/share</filename> subdirectory, the FHS
  54. isn't precise, so we created here the directories that we think are needed.</para>
  55. </sect2>
  56. </sect1>