⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ports-overview.html

📁 FreeBSD操作系统的详细使用手册
💻 HTML
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta name="generator" content="HTML Tidy, see www.w3.org" /><title>Overview of Software Installation</title><meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.7" /><link rel="HOME" title="FreeBSD Handbook" href="index.html" /><link rel="UP" title="Installing Applications: Packages and Ports" href="ports.html" /><link rel="PREVIOUS" title="Installing Applications: Packages and Ports"href="ports.html" /><link rel="NEXT" title="Finding Your Application"href="ports-finding-applications.html" /><link rel="STYLESHEET" type="text/css" href="docbook.css" /></head><body class="SECT1" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#840084"alink="#0000FF"><div class="NAVHEADER"><table summary="Header navigation table" width="100%" border="0" cellpadding="0"cellspacing="0"><tr><th colspan="3" align="center">FreeBSD Handbook</th></tr><tr><td width="10%" align="left" valign="bottom"><a href="ports.html"accesskey="P">Prev</a></td><td width="80%" align="center" valign="bottom">Chapter 4 Installing Applications:Packages and Ports</td><td width="10%" align="right" valign="bottom"><a href="ports-finding-applications.html"accesskey="N">Next</a></td></tr></table><hr align="LEFT" width="100%" /></div><div class="SECT1"><h1 class="SECT1"><a id="PORTS-OVERVIEW" name="PORTS-OVERVIEW">4.2 Overview of SoftwareInstallation</a></h1><p>If you have used a <span class="TRADEMARK">UNIX</span>&reg; system before you willknow that the typical procedure for installing third party software goes something likethis:</p><div class="PROCEDURE"><ol type="1"><li><p>Download the software, which might be distributed in source code format, or as abinary.</p></li><li><p>Unpack the software from its distribution format (typically a tarball compressed with<a href="http://www.FreeBSD.org/cgi/man.cgi?query=compress&sektion=1"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">compress</span>(1)</span></a>, <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=gzip&sektion=1"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">gzip</span>(1)</span></a>, or <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=bzip2&sektion=1"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">bzip2</span>(1)</span></a>).</p></li><li><p>Locate the documentation (perhaps an <tt class="FILENAME">INSTALL</tt> or <ttclass="FILENAME">README</tt> file, or some files in a <tt class="FILENAME">doc/</tt>subdirectory) and read up on how to install the software.</p></li><li><p>If the software was distributed in source format, compile it. This may involve editinga <tt class="FILENAME">Makefile</tt>, or running a <tt class="COMMAND">configure</tt>script, and other work.</p></li><li><p>Test and install the software.</p></li></ol></div><p>And that is only if everything goes well. If you are installing a software packagethat was not deliberately ported to FreeBSD you may even have to go in and edit the codeto make it work properly.</p><p>Should you want to, you can continue to install software the ``traditional'' way withFreeBSD. However, FreeBSD provides two technologies which can save you a lot of effort:packages and ports. At the time of writing, over 10,500 third party applications havebeen made available in this way.</p><p>For any given application, the FreeBSD package for that application is a single filewhich you must download. The package contains pre-compiled copies of all the commands forthe application, as well as any configuration files or documentation. A downloadedpackage file can be manipulated with FreeBSD package management commands, such as <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=pkg_add&sektion=1"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">pkg_add</span>(1)</span></a>, <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=pkg_delete&sektion=1"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">pkg_delete</span>(1)</span></a>, <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=pkg_info&sektion=1"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">pkg_info</span>(1)</span></a>, and soon. Installing a new application can be carried out with a single command.</p><p>A FreeBSD port for an application is a collection of files designed to automate theprocess of compiling an application from source code.</p><p>Remember that there are a number of steps you would normally carry out if you compileda program yourself (downloading, unpacking, patching, compiling, installing). The filesthat make up a port contain all the necessary information to allow the system to do thisfor you. You run a handful of simple commands and the source code for the application isautomatically downloaded, extracted, patched, compiled, and installed for you.</p><p>In fact, the ports system can also be used to generate packages which can later bemanipulated with <tt class="COMMAND">pkg_add</tt> and the other package managementcommands that will be introduced shortly.</p><p>Both packages and ports understand <span class="emphasis"><iclass="EMPHASIS">dependencies</i></span>. Suppose you want to install an application thatdepends on a specific library being installed. Both the application and the library havebeen made available as FreeBSD ports and packages. If you use the <ttclass="COMMAND">pkg_add</tt> command or the ports system to add the application, bothwill notice that the library has not been installed, and automatically install thelibrary first.</p><p>Given that the two technologies are quite similar, you might be wondering why FreeBSDbothers with both. Packages and ports both have their own strengths, and which one youuse will depend on your own preference.</p><p><b>Package Benefits</b></p><ul><li><p>A compressed package tarball is typically smaller than the compressed tarballcontaining the source code for the application.</p></li><li><p>Packages do not require any additional compilation. For large applications, such as <bclass="APPLICATION">Mozilla</b>, <b class="APPLICATION">KDE</b>, or <bclass="APPLICATION">GNOME</b> this can be important, particularly if you are on a slowsystem.</p></li><li><p>Packages do not require any understanding of the process involved in compilingsoftware on FreeBSD.</p></li></ul><p><b>Ports Benefits</b></p><ul><li><p>Packages are normally compiled with conservative options, because they have to run onthe maximum number of systems. By installing from the port, you can tweak the compilationoptions to (for example) generate code that is specific to a Pentium IV or Athlonprocessor.</p></li><li><p>Some applications have compile time options relating to what they can and cannot do.For example, <b class="APPLICATION">Apache</b> can be configured with a wide variety ofdifferent built-in options. By building from the port you do not have to accept thedefault options, and can set them yourself.</p><p>In some cases, multiple packages will exist for the same application to specifycertain settings. For example, <b class="APPLICATION">Ghostscript</b> is available as a<tt class="FILENAME">ghostscript</tt> package and a <ttclass="FILENAME">ghostscript-nox11</tt> package, depending on whether or not you haveinstalled an X11 server. This sort of rough tweaking is possible with packages, butrapidly becomes impossible if an application has more than one or two different compiletime options.</p></li><li><p>The licensing conditions of some software distributions forbid binary distribution.They must be distributed as source code.</p></li><li><p>Some people do not trust binary distributions. At least with source code, you can (intheory) read through it and look for potential problems yourself.</p></li><li><p>If you have local patches, you will need the source in order to apply them.</p></li><li><p>Some people like having code around, so they can read it if they get bored, hack it,borrow from it (license permitting, of course), and so on.</p></li></ul><p>To keep track of updated ports, subscribe to the <ahref="http://lists.FreeBSD.org/mailman/listinfo/freebsd-ports" target="_top">FreeBSDports mailing list</a> and the <ahref="http://lists.FreeBSD.org/mailman/listinfo/freebsd-ports-bugs" target="_top">FreeBSDports bugs mailing list</a>.</p><div class="WARNING"><blockquote class="WARNING"><p><b>Warning:</b> Before installing any application, you should check <ahref="http://vuxml.freebsd.org/" target="_top">http://vuxml.freebsd.org/</a> for securityissues related to your application.</p><p>You can also install <ahref="http://www.FreeBSD.org/cgi/url.cgi?ports/security/portaudit/pkg-descr"><ttclass="FILENAME">security/portaudit</tt></a> which will automatically check all installedapplications for known vulnerabilities, a check will be also performed before any portbuild. Meanwhile, you can use the command <tt class="COMMAND">portaudit -F -a</tt> afteryou have installed some packages.</p></blockquote></div><p>The remainder of this chapter will explain how to use packages and ports to installand manage third party software on FreeBSD.</p></div><div class="NAVFOOTER"><hr align="LEFT" width="100%" /><table summary="Footer navigation table" width="100%" border="0" cellpadding="0"cellspacing="0"><tr><td width="33%" align="left" valign="top"><a href="ports.html"accesskey="P">Prev</a></td><td width="34%" align="center" valign="top"><a href="index.html"accesskey="H">Home</a></td><td width="33%" align="right" valign="top"><a href="ports-finding-applications.html"accesskey="N">Next</a></td></tr><tr><td width="33%" align="left" valign="top">Installing Applications: Packages andPorts</td><td width="34%" align="center" valign="top"><a href="ports.html"accesskey="U">Up</a></td><td width="33%" align="right" valign="top">Finding Your Application</td></tr></table></div><p align="center"><small>This, and other documents, can be downloaded from <ahref="ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/">ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/</a>.</small></p><p align="center"><small>For questions about FreeBSD, read the <ahref="http://www.FreeBSD.org/docs.html">documentation</a> before contacting &#60;<ahref="mailto:questions@FreeBSD.org">questions@FreeBSD.org</a>&#62;.<br />For questions about this documentation, e-mail &#60;<ahref="mailto:doc@FreeBSD.org">doc@FreeBSD.org</a>&#62;.</small></p></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -