First pass through first half of this article. More commits to follow.

Sponsored by: iXsystems
This commit is contained in:
Dru Lavigne 2014-02-04 16:18:13 +00:00
parent 113ea372b4
commit 722cb2bdd1
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=43763

View file

@ -29,59 +29,82 @@
<abstract>
<para>This document is intended to quickly familiarize intermediate to
advanced &linux; users with the basics of FreeBSD.</para>
advanced &linux; users with the basics of &os;.</para>
</abstract>
</info>
<sect1 xml:id="intro">
<title>Introduction</title>
<para>This document will highlight the differences between &os; and
<para>This document highlights the technical differences between &os; and
&linux; so that intermediate to advanced &linux; users can quickly
familiarize themselves with the basics of &os;. This is just a
technical quickstart, it does not attempt to design
<quote>philosophical</quote> differences between the two
operating systems.</para>
familiarize themselves with the basics of &os;.</para>
<para>This document assumes that you have already installed &os;.
If you have not installed &os; or need help with the installation
process please refer to the
<link xlink:href="&url.base;/doc/en_US.ISO8859-1/books/handbook/install.html">
Installing FreeBSD</link> chapter of the &os;&nbsp;Handbook.</para>
<para>This document assumes that &os; is already installed.
Refer to the
<link xlink:href="&url.base;/doc/en_US.ISO8859-1/books/handbook/bsdinstall.html">
Installing &os;</link> chapter of the &os;&nbsp;Handbook for help with the installation
process.</para>
</sect1>
<sect1 xml:id="shells">
<title>Shells: No Bash?</title>
<para>Those coming from &linux; are often surprised to find that
<para>&linux; users are often surprised to find that
<application>Bash</application> is not the default shell in &os;.
In fact, <application>Bash</application> is not even in the default
installation. Instead, &os; uses &man.tcsh.1; as the default shell.
Although, <application>Bash</application> and your other favorite
shells are available in &os;'s <link xlink:href="article.html#SOFTWARE">Packages and Ports&nbsp;Collection</link>.</para>
However, <application>Bash</application> and other
shells are available in &os;'s <link xlink:href="&url.base;/doc/en_US.ISO8859-1/books/handbook/ports.html">Packages and Ports&nbsp;Collection</link>.</para>
<para>If you do install other shells you can use &man.chsh.1; to set
a user's default shell. It is, however, recommended that the
<systemitem class="username">root</systemitem>'s default shell remain unchanged. The
reason for this is that shells not included in the base distribution
are normally installed in <filename>/usr/local/bin</filename> or
<filename>/usr/bin</filename>. In the event of a problem the file
systems where <filename>/usr/local/bin</filename> and
<filename>/usr/bin</filename> are located may not be mounted. In this
case <systemitem class="username">root</systemitem> would not have access to its default
shell, preventing <systemitem class="username">root</systemitem> from logging in. For this
reason a second <systemitem class="username">root</systemitem> account, the
<systemitem class="username">toor</systemitem> account, was created for use with non-default
shells. See the security FAQ for information regarding the <link xlink:href="&url.base;/doc/en_US.ISO8859-1/books/faq/security.html#TOOR-ACCOUNT">toor account</link>.</para>
<para>After installing another shell, use &man.chsh.1; to change
a user's default shell. It is recommended that the
<systemitem class="username">root</systemitem> user's default shell remain unchanged since
shells which are not included in the base distribution
are installed to <filename>/usr/local/bin</filename>.
In the event of a problem, the file
system where <filename>/usr/local/bin</filename> is
located may not be mounted. In this
case, <systemitem class="username">root</systemitem> would not have access to its default
shell, preventing <systemitem class="username">root</systemitem> from logging in.</para>
</sect1>
<sect1 xml:id="software">
<title>Packages and Ports: Adding software in &os;</title>
<title>Packages and Ports: Adding Software in &os;</title>
<para>In addition to the traditional &unix; method of installing software
(download source, extract, edit source code, and compile), &os; offers
two other methods for installing applications: packages and ports. A
complete list of of all available ports and packages can be found <link xlink:href="http://www.freebsd.org/ports/master-index.html">here</link>.</para>
<para>&os; provides
two methods for installing applications: binary packages and compiled ports.
Each method has its own benefits:</para>
<itemizedlist>
<title>Binary Packages</title>
<listitem><simpara>Faster installation as compared to compiling large applications.</simpara></listitem>
<listitem><simpara>Does not require an understanding of how to compile
software.</simpara></listitem>
<listitem><simpara>No need to install a compiler.</simpara></listitem>
</itemizedlist>
<itemizedlist>
<title>Ports</title>
<listitem><simpara>Ability to customize installation options.</simpara></listitem>
<listitem><simpara>Custom patches can be applied.</simpara></listitem>
</itemizedlist>
<para>If an application installation does not require any customization, installing the package
is sufficient. Compile the port instead whenever an application requires
customization of the default options. If needed,
a custom
package can be compiled from ports using <command>make</command>
<buildtarget>package</buildtarget>.</para>
<para>A complete list of of all available ports and packages
can be found <link
xlink:href="http://www.freebsd.org/ports/master-index.html">here</link>.</para>
<sect2 xml:id="packages">
<title>Packages</title>
@ -89,124 +112,50 @@
<para>Packages are pre-compiled applications, the &os; equivalents
of <filename>.deb</filename> files on Debian/Ubuntu based systems
and <filename>.rpm</filename> files on Red&nbsp;Hat/Fedora based
systems. Packages are installed using &man.pkg.add.1;. For example,
systems. Packages are installed using <application>pkg</application>. For example,
the following command installs
<application>Apache 2.2</application>:</para>
<application>Apache 2.4</application>:</para>
<screen>&prompt.root; <userinput>pkg_add /tmp/apache-2.2.6_2.tbz</userinput></screen>
<screen>&prompt.root; <userinput>pkg install apache24</userinput></screen>
<para>Using the <option>-r</option> switch will tell &man.pkg.add.1;
to automatically fetch a package and install it, as well as any
dependencies:</para>
<screen>&prompt.root; <userinput>pkg_add -r apache22</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>If you are running a release version of &os; (6.2, 6.3, 7.0,
etc., generally installed from CD-ROM) <command>pkg_add -r</command>
will download packages built for that specific release. These
packages <emphasis>may not</emphasis> be the most up-to-date
version of the application. You can use the
<envar>PACKAGESITE</envar> variable to override this default
behavior. For example, set <envar>PACKAGESITE</envar> to
<uri xlink:href="ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-6-stable/Latest/">ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-6-stable/Latest/</uri>
to download the most recent packages built for the
6.X series.</para>
</note>
<para>For more information on packages please refer to section 5.4 of
<para>For more information on packages refer to section 5.4 of
the &os; Handbook: <link xlink:href="&url.base;/doc/en_US.ISO8859-1/books/handbook/pkgng-intro.html">Using pkgng for Binary Package Management</link>.</para>
</sect2>
<sect2 xml:id="ports">
<title>Ports</title>
<para>&os;'s second method for installing applications is the
Ports&nbsp;Collection. The Ports&nbsp;Collection is a framework of
<para>The &os; Ports Collection is a framework of
<filename>Makefiles</filename> and patches specifically customized
for installing various software applications from source on &os;.
When installing a port the system will fetch the source code, apply
for installing applications from source on &os;.
When installing a port, the system will fetch the source code, apply
any required patches, compile the code, and install the application
(and do the same for any dependencies).</para>
and any required dependencies.</para>
<para>The Ports&nbsp;Collection, sometimes referred to as the ports tree,
can be found in <filename>/usr/ports</filename>. That is assuming
the Ports&nbsp;Collection was installed during the &os; installation
process. If the Ports&nbsp;Collection has not been installed it can be
added from the installation discs using &man.sysinstall.8;, or pulled
from the &os; servers using &man.csup.1; or &man.portsnap.8;.
Detailed instructions for installing the Ports&nbsp;Collection can be
found in <link xlink:href="&url.base;/doc/en_US.ISO8859-1/books/handbook/ports-using.html">section 4.5.1</link>
of the handbook.</para>
<para>The Ports Collection, sometimes referred to as the ports tree,
can be installed to <filename>/usr/ports</filename> using &man.portsnap.8;.
Detailed instructions for installing the Ports Collection can be
found in <link xlink:href="&url.base;/doc/en_US.ISO8859-1/books/handbook/ports-using.html">section 5.5</link>
of the &os; Handbook.</para>
<para>Installing a port is as simple (generally) as changing in to the
<para>To compile a port, change to the
port's directory and starting the build process. The following example
installs <application>Apache 2.2</application> from the
Ports&nbsp;Collection:</para>
installs <application>Apache 2.4</application> from the
Ports Collection:</para>
<screen>&prompt.root; <userinput>cd /usr/ports/www/apache22</userinput>
<screen>&prompt.root; <userinput>cd /usr/ports/www/apache24</userinput>
&prompt.root; <userinput>make install clean</userinput></screen>
<para>A major benefit of using ports to install software is the
ability to customize the installation options. For example, when
installing <application>Apache 2.2</application> from ports you can
enable <application>mod_ldap</application> by setting the
<varname>WITH_LDAP</varname> &man.make.1; variable:</para>
<para>A benefit of using ports to install software is the
ability to customize the installation options. This example
enables <application>mod_ldap</application> by setting
<varname>WITH_LDAP</varname>:</para>
<screen>&prompt.root; <userinput>cd /usr/ports/www/apache22</userinput>
<screen>&prompt.root; <userinput>cd /usr/ports/www/apache24</userinput>
&prompt.root; <userinput>make WITH_LDAP="YES" install clean</userinput></screen>
<para>Please see section 4.5 of the &os; Handbook, <link xlink:href="&url.base;/doc/en_US.ISO8859-1/books/handbook/ports-using.html">Using
the Ports&nbsp;Collection</link>, for more information about the
Ports&nbsp;Collection.</para>
</sect2>
<sect2 xml:id="which">
<title>Ports or packages, which one should I use?</title>
<para>Packages are just pre-compiled ports, so it is really a matter
of installing from source (ports) versus installing from binary
packages. Each method has its own benefits:</para>
<itemizedlist>
<title>Packages (binary)</title>
<listitem><simpara>Faster installation (compiling large applications
can take quite a while).</simpara></listitem>
<listitem><simpara>You do not need to understand how to compile
software.</simpara></listitem>
<listitem><simpara>No need to install compilers on your
system.</simpara></listitem>
</itemizedlist>
<itemizedlist>
<title>Ports (source)</title>
<listitem><simpara>Ability to customize installation options.
(Packages are normally built with standard options. With ports
you can customize various options, such as building additional
modules or changing the default path.)</simpara></listitem>
<listitem><simpara>You can apply your own patches if you are so
inclined.</simpara></listitem>
</itemizedlist>
<para>If you do not have any special requirements, packages will
probably suit your situation just fine. If you may ever need to
customize, ports are the way to go. (And remember, if you
need to customize but prefer packages, you can build a custom
package from ports using <command>make</command>
<buildtarget>package</buildtarget> and then copy the package to
other servers.)</para>
<para>Refer to <link xlink:href="&url.base;/doc/en_US.ISO8859-1/books/handbook/ports-using.html">Using
the Ports Collection</link> for more information.</para>
</sect2>
</sect1>