Files
master/chapter06/creatingdirs.html
wxy efa9c8bd8b 重新设置了页面字符集
如有冲突,手工解决一下。
2015-04-23 00:48:01 +08:00

144 lines
5.3 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content=
"application/xhtml+xml; charset=utf-8" />
<title>
6.5.&nbsp;Creating Directories
</title>
<link rel="stylesheet" type="text/css" href="../stylesheets/lfs.css" />
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
<link rel="stylesheet" href="stylesheets/lfs-print.css" type="text/css"
media="print" />
</head>
<body class="lfs" id="lfs-7.7-systemd">
<div class="navheader">
<h4>
Linux From Scratch - Version 7.7-systemd
</h4>
<h3>
Chapter&nbsp;6.&nbsp;Installing Basic System Software
</h3>
<ul>
<li class="prev">
<a accesskey="p" href="chroot.html" title=
"Entering the Chroot Environment">Prev</a>
<p>
Entering the Chroot Environment
</p>
</li>
<li class="next">
<a accesskey="n" href="createfiles.html" title=
"Creating Essential Files and Symlinks">Next</a>
<p>
Creating Essential Files and Symlinks
</p>
</li>
<li class="up">
<a accesskey="u" href="chapter06.html" title=
"Chapter&nbsp;6.&nbsp;Installing Basic System Software">Up</a>
</li>
<li class="home">
<a accesskey="h" href="../index.html" title=
"Linux From Scratch - Version 7.7-systemd">Home</a>
</li>
</ul>
</div>
<div class="sect1" lang="en" xml:lang="en">
<h1 class="sect1">
<a id="ch-system-creatingdirs" name="ch-system-creatingdirs"></a>6.5.
Creating Directories
</h1>
<p>
It is time to create some structure in the LFS file system. Create a
standard directory tree by issuing the following commands:
</p>
<pre class="userinput">
<kbd class=
"command">mkdir -pv /{bin,boot,etc/{opt,sysconfig},home,lib/firmware,mnt,opt}
mkdir -pv /{media/{floppy,cdrom},sbin,srv,var}
install -dv -m 0750 /root
install -dv -m 1777 /tmp /var/tmp
mkdir -pv /usr/{,local/}{bin,include,lib,sbin,src}
mkdir -pv /usr/{,local/}share/{color,dict,doc,info,locale,man}
mkdir -v /usr/{,local/}share/{misc,terminfo,zoneinfo}
mkdir -v /usr/libexec
mkdir -pv /usr/{,local/}share/man/man{1..8}
case $(uname -m) in
x86_64) ln -sv lib /lib64
ln -sv lib /usr/lib64
ln -sv lib /usr/local/lib64 ;;
esac
mkdir -v /var/{log,mail,spool}
ln -sv /run /var/run
ln -sv /run/lock /var/lock
mkdir -pv /var/{opt,cache,lib/{color,misc,locate},local}</kbd>
</pre>
<p>
Directories are, by default, created with permission mode 755, but
this is not desirable for all directories. In the commands above, two
changes are made&mdash;one to the home directory of user <code class=
"systemitem">root</code>, and another to the directories for
temporary files.
</p>
<p>
The first mode change ensures that not just anybody can enter the
<code class="filename">/root</code> directory&mdash;the same as a
normal user would do with his or her home directory. The second mode
change makes sure that any user can write to the <code class=
"filename">/tmp</code> and <code class="filename">/var/tmp</code>
directories, but cannot remove another user's files from them. The
latter is prohibited by the so-called <span class=
"quote">&ldquo;<span class="quote">sticky bit,</span>&rdquo;</span>
the highest bit (1) in the 1777 bit mask.
</p>
<div class="sect2" lang="en" xml:lang="en">
<h2 class="sect2">
6.5.1. FHS Compliance Note
</h2>
<p>
The directory tree is based on the Filesystem Hierarchy Standard
(FHS) (available at <a class="ulink" href=
"https://wiki.linuxfoundation.org/en/FHS">https://wiki.linuxfoundation.org/en/FHS</a>).
The FHS also stipulates the existence of <code class=
"filename">/usr/local/games</code> and <code class=
"filename">/usr/share/games</code>. The FHS is not precise as to
the structure of the <code class="filename">/usr/local/share</code>
subdirectory, so we create only the directories that are needed.
However, feel free to create these directories if you prefer to
conform more strictly to the FHS.
</p>
</div>
</div>
<div class="navfooter">
<ul>
<li class="prev">
<a accesskey="p" href="chroot.html" title=
"Entering the Chroot Environment">Prev</a>
<p>
Entering the Chroot Environment
</p>
</li>
<li class="next">
<a accesskey="n" href="createfiles.html" title=
"Creating Essential Files and Symlinks">Next</a>
<p>
Creating Essential Files and Symlinks
</p>
</li>
<li class="up">
<a accesskey="u" href="chapter06.html" title=
"Chapter&nbsp;6.&nbsp;Installing Basic System Software">Up</a>
</li>
<li class="home">
<a accesskey="h" href="../index.html" title=
"Linux From Scratch - Version 7.7-systemd">Home</a>
</li>
</ul>
</div>
</body>
</html>