Add articles/linux-users
Translated by: Pengfei Ju (jupengfei at gmail dot com) Obtained from: The FreeBSD Simplified Chinese Project http://lists.cn.freebsd.org/pipermail/cnproj-cvs/2008-May/001843.html
This commit is contained in:
parent
2515e1cd2c
commit
07ed8e3e8a
Notes:
svn2git
2020-12-08 03:00:23 +00:00
svn path=/head/; revision=31994
3 changed files with 606 additions and 0 deletions
|
@ -7,6 +7,7 @@
|
|||
SUBDIR =
|
||||
SUBDIR+= contributing
|
||||
SUBDIR+= cvs-freebsd
|
||||
SUBDIR+= linux-users
|
||||
SUBDIR+= nanobsd
|
||||
SUBDIR+= remote-install
|
||||
|
||||
|
|
19
zh_CN.GB2312/articles/linux-users/Makefile
Normal file
19
zh_CN.GB2312/articles/linux-users/Makefile
Normal file
|
@ -0,0 +1,19 @@
|
|||
#
|
||||
# $FreeBSD$
|
||||
# Original Revision: 1.1
|
||||
# Article: FreeBSD Quickstart for Linux Users
|
||||
|
||||
DOC?= article
|
||||
|
||||
FORMATS?= html
|
||||
WITH_ARTICLE_TOC?= YES
|
||||
|
||||
INSTALL_COMPRESSED?= gz
|
||||
INSTALL_ONLY_COMPRESSED?=
|
||||
|
||||
SRCS= article.sgml
|
||||
|
||||
URL_RELPREFIX?= ../../../..
|
||||
DOC_PREFIX?= ${.CURDIR}/../../..
|
||||
|
||||
.include "${DOC_PREFIX}/share/mk/doc.project.mk"
|
586
zh_CN.GB2312/articles/linux-users/article.sgml
Normal file
586
zh_CN.GB2312/articles/linux-users/article.sgml
Normal file
|
@ -0,0 +1,586 @@
|
|||
<!--
|
||||
The FreeBSD Documentation Project
|
||||
The FreeBSD Chinese (Simplified) Documentation Project
|
||||
|
||||
Original Revision: 1.2
|
||||
-->
|
||||
<!DOCTYPE article PUBLIC "-//FreeBSD//DTD DocBook V4.1-Based Extension//EN" [
|
||||
<!ENTITY % articles.ent PUBLIC "-//FreeBSD//ENTITIES DocBook FreeBSD Articles Entity Set//EN">
|
||||
%articles.ent;
|
||||
]>
|
||||
|
||||
<article>
|
||||
<articleinfo>
|
||||
<title>FreeBSD Quickstart Guide for &linux; Users</title>
|
||||
|
||||
<authorgroup>
|
||||
<author>
|
||||
<firstname>John</firstname>
|
||||
<surname>Ferrell</surname>
|
||||
</author>
|
||||
</authorgroup>
|
||||
|
||||
<copyright>
|
||||
<year>2008</year>
|
||||
<holder>The FreeBSD Documentation Project</holder>
|
||||
</copyright>
|
||||
|
||||
<releaseinfo>$FreeBSD$</releaseinfo>
|
||||
|
||||
<legalnotice id="trademarks" role="trademarks">
|
||||
&tm-attrib.freebsd;
|
||||
&tm-attrib.linux;
|
||||
&tm-attrib.intel;
|
||||
&tm-attrib.redhat;
|
||||
&tm-attrib.unix;
|
||||
&tm-attrib.general;
|
||||
</legalnotice>
|
||||
|
||||
<abstract>
|
||||
<para>本文档旨在快速使那些高级 &linux;
|
||||
用户熟悉FreeBSD的一些基础知识。</para>
|
||||
</abstract>
|
||||
</articleinfo>
|
||||
|
||||
<sect1 id="intro">
|
||||
<title>简介</title>
|
||||
|
||||
<para>本文档将突出介绍 &os; 与 &linux; 的差别,
|
||||
以使得那些 &linux; 高级用户能自己快速熟悉 &os;
|
||||
的基础内容。这只是份技术上的快速入门,
|
||||
并非是试图描绘这两种操作系统之间的"哲学"上的差异。</para>
|
||||
|
||||
<para>此文档假定认为你已经安装好了 &os;。
|
||||
如果你还没有安装 &os; 或者对 &os;
|
||||
的安装过程方面需要帮助,请参考 &os; 手册的
|
||||
<ulink url="&url.base;/doc/en_US.ISO8859-1/books/handbook/install.html">
|
||||
安装 FreeBSD</ulink>一章。
|
||||
</sect1>
|
||||
|
||||
<sect1 id="shells">
|
||||
<title>Shell程序:没有Bash吗?</title>
|
||||
|
||||
<para>那些从 &linux; 转过来的用户经常会惊讶于
|
||||
<application>Bash</application> 不是 &os; 的默认 Shell。
|
||||
事实上,<application>Bash</application> 甚至没有包括在
|
||||
&os; 的默认安装中。代替的是,&os; 使用 &man.tcsh.1;
|
||||
作为自己的默认 Shell,尽管如此,<application>Bash</application>
|
||||
和其他你喜爱的 Shell 程序在 &os; 的
|
||||
<ulink url="article.html#SOFTWARE">Packages 和 Ports 套件</ulink>
|
||||
里都可以找到。</para>
|
||||
|
||||
<para>如果你安装了其他的 Shell 你可以使用 &man.csh.1;
|
||||
来设置一个用户的默认 Shell。通常情况下,
|
||||
强烈建议不要去更改 <username>root</username>
|
||||
用户的默认 Shell。原因是这些 Shell
|
||||
没有包括在基本系统中,正常情况下它们会被安装到
|
||||
<filename>/usr/local/bin</filename> 和
|
||||
<filename>/usr/bin</filename> 目录下。万一某天
|
||||
<filename>/usr/local/bin</filename> 和
|
||||
<filename>/usr/bin</filename> 的文件系统不能被挂载,
|
||||
这样情况下 <username>root</username>
|
||||
将不能进入自己默认的 Shell,从而
|
||||
<username>root</username> 将不能够登录进去。
|
||||
鉴于这个原因,第二个系统管理员帐户
|
||||
<username>toor</username> 创建时使用的是非默认的
|
||||
Shell。在安全 FAQ 可以查阅到关于 <ulink
|
||||
url="&url.base;/doc/en_US.ISO8859-1/books/faq/security.html#TOOR-ACCOUNT">toor 帐户</ulink>
|
||||
的信息。</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="software">
|
||||
<title>Packages和Ports:在 &os; 中添加软件</title>
|
||||
|
||||
<para>除了经典的 &unix; 安装软件的方法
|
||||
(下载源码包,解压,编辑源码,编译)外,&os;
|
||||
还提供了另外两种方法来安装应用程序:packages 和 ports。
|
||||
你可以在 <ulink
|
||||
url="http://www.freebsd.org/ports/master-index.html">这里</ulink>
|
||||
到一份完整可用的 ports 和 packages 的软件清单。</para>
|
||||
|
||||
<sect2 id="packages">
|
||||
<title>Packages</title>
|
||||
|
||||
<para>Packages 是预编译好的应用程序,在 &os;
|
||||
中等价于基于 Debian/Ubuntu 的系统中的
|
||||
<filename>.deb</filename> 软件包以及基于
|
||||
Red Hat/Fedora 的系统中的
|
||||
<filename>.rpm</filename> 软件包。
|
||||
Packages使用 &man.pkg.add.1; 来进行安装。
|
||||
例如,下面的命令将用来安装
|
||||
<application>Apache 2.2</application>:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>pkg_add <replaceable>/tmp/apache-2.2.6_2.tbz</replaceable></userinput></screen>
|
||||
|
||||
<para>使用 <option>-r</option> 操作将告诉 &man.pkg.add.1;
|
||||
来自动获取并安装一个软件包,以及解决所有的依赖关系:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>pkg_add -r <replaceable>apache22</replaceable></userinput>
|
||||
Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-6.2-release/Latest/apache22.tbz... Done.
|
||||
Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-6.2-release/All/expat-2.0.0_1.tbz... Done.
|
||||
Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-6.2-release/All/perl-5.8.8_1.tbz... Done.
|
||||
[snip]
|
||||
|
||||
To run apache www server from startup, add apache22_enable="YES"
|
||||
in your /etc/rc.conf. Extra options can be found in startup script.</screen>
|
||||
|
||||
<note>
|
||||
<para>如果你正运行着 release 版本的 &os; (6.2,6.3,7.0等,
|
||||
通常从 CD-ROM 被安装的)<command>pkg_add -r</command>
|
||||
会为其下载专门为这些特定版本构建好的软件包。
|
||||
这些软件包 <emphasis>可能</emphasis> 不是当前最新的程序。
|
||||
你可以使用 <envar>PACKAGESITE</envar> 变量来覆盖默认的动作。
|
||||
例如,把 <envar>PACHAGESITE</envar> 设置成
|
||||
<ulink url="ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-6-stable/Latest/"></ulink>
|
||||
来下载 6.X 系列最新的包。</para>
|
||||
|
||||
<para>你可以阅读这篇文章
|
||||
<ulink url="&url.base;/doc/en_US.ISO8859-1/articles/version-guide/">
|
||||
选择最适合自己的 &os; 版本号</ulink> 来获取更多关于 &os;
|
||||
版本号的东西。</para>
|
||||
</note>
|
||||
|
||||
<para>想了解更多的 packages 信息请查阅 &os;
|
||||
手册的 4.4 小节:<ulink
|
||||
url="&url.base;/doc/en_US.ISO8859-1/books/handbook/packages-using.html">使用 Packages 系统</ulink>。</para>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="ports">
|
||||
<title>Ports</title>
|
||||
|
||||
<para>&os; 的第二种安装应用程序的方法就是使用 Ports 了。
|
||||
Ports 系统是 &os 上的一个利用 <filename>Makefile</filename>
|
||||
和一些补丁文件来特定从源码定制安装各种软件程序的框架。
|
||||
当安装一个 port 时系统会获取程序源码,
|
||||
应用任何所需要的补丁,编译源码,
|
||||
并安装应用程序(并针对依赖关系以同样的方式安装解决)。</para>
|
||||
|
||||
<para>Ports 套件,常被称作 ports 树,可以在
|
||||
<filename>/usr/ports</filename> 下找到。
|
||||
假设Ports套件已经在安装 &os; 时安装过了。
|
||||
如果 Ports 套件还没有被安装可以通过 &man.sysinstall.8;
|
||||
来进行安装,或者使用 &man.csup.1; 或 &man.portsnap.8;
|
||||
来从 &os; 的服务器上面拉下来。在手册的 <ulink
|
||||
url="&url.base;/doc/en_US.ISO8859-1/books/handbook/ports-using.html">4.5.1 小节</ulink>
|
||||
可以找到安装Ports套件的详细介绍。</para>
|
||||
|
||||
<para>安装一个 port 就像进入 port
|
||||
的目录并开始构建过程一样简单(通常情况下),
|
||||
下面是从 Ports 套件安装
|
||||
<application>Apache 2.2</application> 的例子:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>cd /usr/ports/www/apache22</userinput>
|
||||
&prompt.root; <userinput>make install clean</userinput></screen>
|
||||
|
||||
<para>使用 ports 安装软件的最大好处就是能够自定义安装选项。
|
||||
例如,从 ports 安装 <application>Apache 2.2</application>
|
||||
时你可以通过设置 <makevar>WITH_LDAP</makevar> &man.make.1;
|
||||
变量来启用 <application>mod_ldap</application>:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>cd /usr/ports/www/apache22</userinput>
|
||||
&prompt.root; <userinput>make WITH_LDAP="YES" install clean</userinput></screen>
|
||||
|
||||
<para>请查看 &os; 手册的 4.5 小节,<ulink
|
||||
url="&url.base;/doc/en_US.ISO8859-1/books/handbook/ports-using.html">
|
||||
使用 Ports Collection</ulink>,
|
||||
以获取更多关于Ports Collection 的信息。</para>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="which">
|
||||
<title>Ports还是packages,我应该使用哪个?</title>
|
||||
|
||||
<para>Packages 就是预编译好的 ports,
|
||||
所以从源码(ports)安装与从二进制 packages
|
||||
安装这两者间确实有很大关联。每种方法各有自己的优点:</para>
|
||||
|
||||
<itemizedlist>
|
||||
<title>Packages(二进制)</title>
|
||||
|
||||
<listitem><simpara>更快速的安装
|
||||
(比较大的应用程序编译起来会花很长时间)。</simpara></listitem>
|
||||
|
||||
<listitem><simpara>你不需要知道如何编译软件。</simpara></listitem>
|
||||
|
||||
<listitem><simpara>不需要在操作系统上安装编译器。</simpara></listitem>
|
||||
</itemizedlist>
|
||||
|
||||
<itemizedlist>
|
||||
<title>Ports(源码)</title>
|
||||
|
||||
<listitem><simpara>能够定制安装选项。
|
||||
(Packages通常都是使用标准选项构建的。使用 ports
|
||||
你能够定义各种各样的选项,
|
||||
比如类似构建附加的模块或是更改安装路径之类的。)</simpara></listitem>
|
||||
|
||||
<listitem><simpara>如果你喜欢的话还可以使用自己的补丁。</simpara></listitem>
|
||||
</itemizedlist>
|
||||
|
||||
<para>如果你没有一些特别的需求,packages
|
||||
可能刚好最适合你的情况。如果你需要进一步定制,
|
||||
ports 是最适合的方法了。(请记得,
|
||||
如果你需要定制而自己又更倾向于使用 packages,
|
||||
你可以使用 <command>make</command>
|
||||
<maketarget>patch</maketarget> 从 ports
|
||||
构建一个定制的 package,然后复制到其他的服务器。)</para>
|
||||
</sect2>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="startup">
|
||||
<title>系统启动:运行级别在哪里?</title>
|
||||
|
||||
<para>&linux; 使用 Sysv init 初始化系统,而 &os;
|
||||
使用的是传统的 BSD 风格的 &man.init.8;。在 BSD 风格的
|
||||
&man.init.8; 中没有运行级别和 <filename>/etc/inittab</filename>,
|
||||
代替控制启动的是 &man.rc.8; 实用程序。
|
||||
<filename>/etc/rc</filename> 脚本读取
|
||||
<filename>/etc/defaults/rc.conf</filename> 和
|
||||
<filename>/etc/rc.conf</filename> 文件来决定哪个服务将被启动。
|
||||
特殊服务在此后由处于 <filename>/etc/rc.d/</filename> 和
|
||||
<filename>/usr/local/etc/rc.d/</filename>
|
||||
下的相应服务初始化脚本文件所启动。
|
||||
这些脚本类似于位于 &linux; 系统中的
|
||||
<filename>/etc/init.d/</filename> 目录下的脚本。</para>
|
||||
|
||||
<sidebar>
|
||||
<para><emphasis>为何会有两个服务初始化脚本的目录呢?</emphasis>
|
||||
<filename>/etc/rc.d/</filename> 下的脚本是属于
|
||||
<quote>基本</quote> 系统一部分的应用程序所使用的。
|
||||
(&man.cron.8;,&man.sshd.8;,&man.syslog.3;,以及其他。)
|
||||
<filename>/usr/local/etc/rc.d/</filename>
|
||||
下的脚本是用户安装的应用程序如 <application>Apache</application>,
|
||||
<application>Squid</application> 等使用的。</para>
|
||||
|
||||
<para><emphasis><quote>基本</quote>
|
||||
系统和用户安装的应用程序之间的区别是什么?</emphasis> FreeBSD
|
||||
是一套开发出来的完整的操作系统,也就是说,内核,系统类库,
|
||||
还有实用应用程序(如 &man.ls.1;,&man.cat.1;,&man.cp.1; 等)
|
||||
全部被做为一个整体一起开发并释出。这就是被认为归属于
|
||||
<quote>基本</quote>系统的程序。用户安装的程序并不是
|
||||
<quote>基本</quote>系统的一部分,如
|
||||
<application>Apache</application>,<application>X11</application>,
|
||||
<application>Moazilla Firefox</application>,等等。这
|
||||
些用户安装的应用程序通常是使用 &os; 的 Packages 和 Ports
|
||||
套件安装上去的。为了将这些程序和 <quote>基本</quote>
|
||||
系统区分开来,用户安装的应用程序通常被安装到
|
||||
<filename>/usr/local/</filename>下。
|
||||
因此用户安装的二进制执行文件存在于
|
||||
<filename>/usr/local/bin</filename>下,配置文件在
|
||||
<filename>/usr/local/etc</filename>下,以此类推。</para>
|
||||
</sidebar>
|
||||
|
||||
<para>服务通过在
|
||||
<filename>/etc/rc.conf</filename>(&man.rc.conf.5;)
|
||||
文件中使用特定的
|
||||
<literal><replaceable>ServiceName</replaceable>_enable="YES"</literal>
|
||||
格式被启动。看一下系统默认的
|
||||
<filename>/etc/defaults/rc.conf</filename> 文件,这些默认设定被
|
||||
<filename>/etc/rc.conf</filename> 文件中的设定所修改。因此,
|
||||
当安装附加应用程序时最好回顾下文档来决定到底该如何启用任何相关的服务。</para>
|
||||
|
||||
<para>下面的一小段内容用来在 <filename>/etc/rc.conf</filename>
|
||||
中启用 &man.sshd.8; 和 <application>Apache 2.2</application>。
|
||||
还指定了 <application>Apache</application> 应该通过
|
||||
SSL 方式启动。</para>
|
||||
|
||||
<programlisting># enable SSHD
|
||||
sshd_enable="YES"
|
||||
# enable Apache with SSL
|
||||
apache22_enable="YES"
|
||||
apache22_flags="-DSSL"</programlisting>
|
||||
|
||||
<para>一旦服务已经在 <filename>/etc/rc.conf</filename>
|
||||
中启用,服务将能够从命令行启动(不需要重新启动系统):</para>
|
||||
|
||||
<screen>&prompt.root; <userinput><replaceable>/etc/rc.d/sshd</replaceable> start</userinput></screen>
|
||||
|
||||
<para>如果服务还没有被启用,可以使用
|
||||
<option>forcestart</option> 来从命令行启动:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput><replaceable>/etc/rc.d/sshd</replaceable> forcestart</userinput></screen>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="network">
|
||||
<title>网络配置</title>
|
||||
|
||||
<sect2 id="interfaces">
|
||||
<title>网络接口</title>
|
||||
|
||||
<para>代替 &linux; 中所使用的标识网络接口所常用的
|
||||
<emphasis>ethX</emphasis> 格式的是,&os;
|
||||
使用驱动名字后跟一个数字来标识。下面
|
||||
&man.ifconfig.8; 的输出显示了两个 &intel; Pro 1000
|
||||
的网络接口(em0 和 em1):</para>
|
||||
|
||||
<screen>&prompt.user; <userinput>ifconfig</userinput>
|
||||
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
|
||||
options=b<RXCSUM,TXCSUM,VLAN_MTU>
|
||||
inet 10.10.10.100 netmask 0xffffff00 broadcast 10.10.10.255
|
||||
ether 00:50:56:a7:70:b2
|
||||
media: Ethernet autoselect (1000baseTX <full-duplex>)
|
||||
status: active
|
||||
em1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
|
||||
options=b<RXCSUM,TXCSUM,VLAN_MTU>
|
||||
inet 192.168.10.222 netmask 0xffffff00 broadcast 192.168.10.255
|
||||
ether 00:50:56:a7:03:2b
|
||||
media: Ethernet autoselect (1000baseTX <full-duplex>)
|
||||
status: active</screen>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="ipaddress">
|
||||
<title>IP配置</title>
|
||||
|
||||
<para>一个 IP 地址可以使用 &man.ifconfig.8;
|
||||
来指定到一个网络接口。通常,要保持重启后依然能够使用的
|
||||
IP 配置信息需要包含在 <filename>/etc/rc.conf</filename>
|
||||
中。下列例子指定了主机名,IP 地址,以及默认网关:</para>
|
||||
|
||||
<programlisting>hostname="server1.example.com"
|
||||
ifconfig_em0="inet 10.10.10.100 netmask 255.255.255.0"
|
||||
defaultrouter="10.10.10.1"</programlisting>
|
||||
|
||||
<para>使用下面内容来为网络接口配置DHCP:</para>
|
||||
|
||||
<programlisting>hostname="server1.example.com"
|
||||
ifconfig_em0="DHCP"</programlisting>
|
||||
|
||||
</sect2>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="firewall">
|
||||
<title>防火墙</title>
|
||||
|
||||
<para>像 &linux; 中的 <application>IPTABLES</application>
|
||||
一样, &os; 也提供了一个内核级的防火墙;
|
||||
实际上 &os; 提供了三个防火墙:</para>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem><simpara><ulink url="&url.base;/doc/en_US.ISO8859-1/books/handbook/firewalls-ipfw.html">IPFIREWALL</ulink></simpara></listitem>
|
||||
<listitem><simpara><ulink url="&url.base;/doc/en_US.ISO8859-1/books/handbook/firewalls-ipf.html">IPFILTER</ulink></simpara></listitem>
|
||||
<listitem><simpara><ulink url="&url.base;/doc/en_US.ISO8859-1/books/handbook/firewalls-pf.html">PF</ulink></simpara></listitem>
|
||||
</itemizedlist>
|
||||
|
||||
<para><application>IPFIREWALL</application> 或是
|
||||
<application>IPFW</application>(管理
|
||||
<application>IPFW</application> 规则的 &man.ipfw.8; 命令)
|
||||
是 &os; 开发者开发并维持的。
|
||||
<application>IPFW</application> 能够与 &man.dummynet.4;
|
||||
配合使用来提供流量图形功能以及模拟不同网络连接类型的功能。</para>
|
||||
|
||||
<para>允许 <application>SSH</application>
|
||||
进入的 <application>IPFW</application> 规则样例如下:</para>
|
||||
|
||||
<programlisting>ipfw add allow tcp from any to me 22 in via $ext_if</programlisting>
|
||||
|
||||
<para><application>IPFILTER</application> 是
|
||||
Darren Reed 所开发的防火墙程序。不是专门针对
|
||||
&os; 的,它已经被移植到 NetBSD,OpenBSD,SunOS,HP/UX,
|
||||
还有Solaris等一些操作系统之上。</para>
|
||||
|
||||
<para>允许 <application>SSH</application>
|
||||
进入的 <application>IPFILTER</application>
|
||||
命令样例如下:</para>
|
||||
|
||||
<programlisting>pass in on $ext_if proto tcp from any to any port = 22</programlisting>
|
||||
|
||||
<para>最后一种防火墙程序,<application>PF</application>,
|
||||
是 OpenBSD 项目所开发的。<application>PF</application>
|
||||
是被作为 <application>IPFILTER</application>
|
||||
的一个替代品而被创建出的。就这点而言,
|
||||
<application>PF</application> 的语法与
|
||||
<application>IPFILTER</application> 的非常相似。
|
||||
<application>PF</application> 可以与 &man.altq.4;
|
||||
配合来提供 QoS 的特性。</para>
|
||||
|
||||
<para>允许 <application>SSH</application>
|
||||
进入的 <application>PF</application>
|
||||
命令样例如下:</para>
|
||||
|
||||
<programlisting>pass in on $ext_if inet proto tcp from any to ($ext_if) port 22</programlisting>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="updates">
|
||||
<title>升级 &os;</title>
|
||||
|
||||
<para>共有三种方法来升级 &os; 系统:
|
||||
源码,二进制更新,还有安装光盘。</para>
|
||||
|
||||
<para>从源码升级是最复杂的升级方法,但是提供了最棒的总体灵活性。
|
||||
这个过程包含了使用 &os; <application>CVS</application>
|
||||
(并行版本系统)来同步一个本地的 &os; 源代码。
|
||||
一旦本地源码已经更新到当前最新你便可以构建新版本的内核以及应用程序。
|
||||
关于源码更新的更多信息可见于 &os; 手册
|
||||
<ulink url="&url.base;/doc/en_US.ISO8859-1/books/handbook/cutting-edge.html">
|
||||
第 23 章</ulink>。</para>
|
||||
|
||||
<para>二进制更新类似于使用 <command>yum</command> 或
|
||||
<command>apt-get</command> 更新 &linux; 系统。
|
||||
&man.freebsd-update.8; 命令会获取新的更新并安装它们。
|
||||
这些更新可以通过 &man.cron.8; 使用程序来调度。</para>
|
||||
|
||||
<note>
|
||||
<para>如果你使用 &man.cron.8; 来预定更新,
|
||||
请确信在你的 &man.crontab.1; 中使用了
|
||||
<command>freebsd-update cron</command>
|
||||
来控制大数目的机器同时获取更新。</para>
|
||||
|
||||
<programlisting>0 3 * * * root /usr/sbin/freebsd-update cron</programlisting>
|
||||
</note>
|
||||
|
||||
<para>最后一种更新的方法,从安装光盘来升级,是个直接的过程。
|
||||
从安装光盘启动并选择该选项来更新。</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="procfs">
|
||||
<title>procfs:已是过去式但仍未被遗忘</title>
|
||||
|
||||
<para>&linux; 中,你可能会通过看一看
|
||||
<filename>/proc/sys/net/ipv4/ip_forward</filename>
|
||||
来确定 IP 转发是否被启用。在 &os; 中你应该使用 &man.sysctl.8;
|
||||
来查看这和其他方面的系统设置,在当前的 &os; 版本中
|
||||
&man.procfs.5; 已经不赞成使用了。(虽然
|
||||
<command>sysctl</command>在 &os; 也同样可用。)</para>
|
||||
|
||||
<para>在 IP 转发样例中,你应该使用下列内容来确定 &os;
|
||||
系统中是否已经开启了 IP 转发:</para>
|
||||
|
||||
<screen>&prompt.user; <userinput>sysctl net.inet.ip.forwarding</userinput>
|
||||
net.inet.ip.forwarding: 0</screen>
|
||||
|
||||
<para><option>-a</option> 标志用来列出所有的系统设置:</para>
|
||||
|
||||
<screen>&prompt.user; <userinput>sysctl -a</userinput>
|
||||
kern.ostype: FreeBSD
|
||||
kern.osrelease: 6.2-RELEASE-p9
|
||||
kern.osrevision: 199506
|
||||
kern.version: FreeBSD 6.2-RELEASE-p9 #0: Thu Nov 29 04:07:33 UTC 2007
|
||||
root@i386-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC
|
||||
|
||||
kern.maxvnodes: 17517
|
||||
kern.maxproc: 1988
|
||||
kern.maxfiles: 3976
|
||||
kern.argmax: 262144
|
||||
kern.securelevel: -1
|
||||
kern.hostname: server1
|
||||
kern.hostid: 0
|
||||
kern.clockrate: { hz = 1000, tick = 1000, profhz = 666, stathz = 133 }
|
||||
kern.posix1version: 200112
|
||||
...</screen>
|
||||
|
||||
<note>
|
||||
<para>某些 <command>sysctl</command> 的参数是只读的。</para>
|
||||
</note>
|
||||
|
||||
<para>需要 procfs 的情况是,运行一些较老的软件,使用
|
||||
&man.truss.1; 来跟踪系统信号,以及
|
||||
<ulink url="&url.base;/doc/en_US.ISO8859-1/books/handbook/linuxemu.html">&linux; 二进制兼容</ulink>.
|
||||
(尽管,&linux; 二进制兼容性使用其本身的 procfs,&man.linprocfs.5;。)
|
||||
如果你需要挂载 procfs 你可以在
|
||||
<filename>/etc/fstab</filename> 中加入如下内容:</para>
|
||||
|
||||
<screen>proc /proc procfs rw,noauto 0 0</screen>
|
||||
|
||||
<note>
|
||||
<para><option>noauto</option> 会防止
|
||||
<filename>/proc</filename> 在启动时被自动挂载。</para>
|
||||
</note>
|
||||
|
||||
<para>然后使用如下命令挂载 procfs:</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>mount /proc</userinput></screen>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="commands">
|
||||
<title>常用命令</title>
|
||||
|
||||
<sect2 id="packageCommands">
|
||||
<title>软件包管理</title>
|
||||
|
||||
<para>
|
||||
<informaltable frame="none" pgwide="1">
|
||||
<tgroup cols="3">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>&linux; 命令 (Red Hat/Debian)</entry>
|
||||
<entry>&os; 等价命令</entry>
|
||||
<entry>目的</entry>
|
||||
</row>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<row>
|
||||
<entry><command>yum install <package></command> / <command>apt-get install <package></command></entry>
|
||||
<entry><command>pkg_add -r <package></command></entry>
|
||||
<entry>从远程仓库安装 <package></entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry><command>rpm -ivh <package></command> / <command>dpkg -i <package></command></entry>
|
||||
<entry><command>pkg_add -v <package></command></entry>
|
||||
<entry>安装 package</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry><command>rpm -qa</command> / <command>dpkg -l</command></entry>
|
||||
<entry><command>pkg_info</command></entry>
|
||||
<entry>列出已安装的软件包</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="systemCommands">
|
||||
<title>系统管理</title>
|
||||
|
||||
<para>
|
||||
<informaltable frame="none" pgwide="1">
|
||||
<tgroup cols="3">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>&linux; 命令</entry>
|
||||
<entry>&os; 等价命令</entry>
|
||||
<entry>目的</entry>
|
||||
</row>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<row>
|
||||
<entry><command>lspci</command></entry>
|
||||
<entry><command>pciconf</command></entry>
|
||||
<entry>列出 PCI 设备</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry><command>lsmod</command></entry>
|
||||
<entry><command>kldstat</command></entry>
|
||||
<entry>列出已载入的内核模块</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry><command>modprobe</command></entry>
|
||||
<entry><command>kldload</command> / <command>kldunload</command></entry>
|
||||
<entry>载入/卸载内核模块</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry><command>strace</command></entry>
|
||||
<entry><command>truss</command></entry>
|
||||
<entry>跟踪系统调用</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</para>
|
||||
</sect2>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="conclusion">
|
||||
<title>总结</title>
|
||||
|
||||
<para>非常希望这篇文档能够给予你足够的帮助来开始你的
|
||||
&os; 之路。务必要再去看一下 <ulink
|
||||
url="&url.base;/doc/en_US.ISO8859-1/books/handbook/index.html">&os; 手册</ulink>
|
||||
所提到的但并没有被包含在本文档中的那些更深入广泛的主题。</para>
|
||||
</sect1>
|
||||
</article>
|
Loading…
Reference in a new issue