FreeBSD官方articles
- 格式:doc
- 大小:380.00 KB
- 文档页数:67
FreeBSD 安装图文示例o准备安装镜像▪关于FreeBSD的安装镜像▪芯片体系架构的选择▪查看硬件支持列表▪刻录镜像o图解安装过程▪第一步:选择启动模式▪第二步:选择国家▪第三步:选择键盘映射▪第四步:进入安装菜单▪第五步:提示信息▪第六步:硬盘分区▪第七步:引导管理器▪第八步:提示信息▪第九步:创建FreeBSD分区▪第十步:选择发行版▪第十一步:选择安装介质▪第十二步:确认安装▪第十三步:顺利安装完毕▪第十四步:网络配置▪第十五步:选择网络接口▪第十六步:是否使用IPv6▪第十七步:是否在网络接口上启用DHCP ▪第十八步:网卡配置▪第十九步:是否启用网络接口▪第二十步:是否做为网关▪第二十一步:是否启用超级服务器▪第二十三步:是否允许被远程安全连接▪第二十三步:是否启用FTP 服务▪第二十四步:是启做为NFS服务器▪第二十五步:是否启用NFS客户端▪第二十六步:自定义控制台▪第二十七步:设置时区▪第二十八步:选择本地硬件时间或通用协调时▪第二十九步:选择所在区域▪第三十步:选择国家或地区▪第三十一步:选择时区▪第三十二步:确认是否使用中国标准时间▪第三十三步:是否使用Linux兼容模式▪第三十四步:是否需要在控制台下使用鼠标▪第三十五步:是否要浏览FreeBSD的软件集合▪第三十六步:是否增加新用户▪第三十七步:用户和组管理界面▪第三十八步:增加用户▪第三十九步:退出用户管理▪第四十步:设置Root密码▪第四十一步:写下Root密码▪第四十二步:再次确认您的配置▪第四十三步:结束安装▪最后一步:重启o安装完成后的工作(编写中)▪非官方常见问答▪学习FreeBSD使用手册▪到论坛参与讨论▪加入邮件列表▪其他资源FreeBSD 安装图文示例本文以安装FreeBSD 7.1 (i386) 为示范,同时也适用于FreeBSD 8.1 Release。
文中可能存在某些错误和疏漏,请老鸟们指正。
准备安装镜像关于FreeBSD的安装镜像大家可以到官方网站或者在本站下载。
作为一个服务器管理员,经常性的服务器软件更新是必不可少的。
FreeBSD提供了非常便捷的升级方式——cvsup,它可以从FreeBSD中央cvsup服务器,或某个cvsup镜像上获取FreeBSD的部分或全部源代码,而且,它只下载那些修改过的源代码,并且可以根据需要选择适合你的版本(使用-STABLE可以提供较好的稳定性以及操作系统的最新特性,多数管理员都会选择这个;使用-RELEASE能够获得成熟产品的品质,尽管话是这样说,但实际上选择这一分支的人很少;使用-CURRENT的用户主要是参与FreeBSD 开发的人员,这个分支包含了所有即将进入-STABLE分支的新特性,但不要指望这个分支能够提供必要的稳定性保证,也不要指望它能够带来很好的性能,但所有的安全问题都是首先在这个分支内修正的。
我将在后面详细介绍这些)。
一旦最初的内核配置完成,它就会立即启动,并根据配置文件启动sysinstall(8)。
我们将看到一个标准的文字模式配置界面,这有点类似于早期Visual Basic For MS-DOS编写的应用程序的界面。
选择Standard进入标准的FreeBSD安装过程。
首先是对磁盘进行分区。
FreeBSD对于磁盘的管理和Windows有比较大的差别。
一个磁盘上通常有一个Partition就够了,而一个Partition又可以分成若干个slice,并加以标记(label)。
实际上,FreeBSD的slice基本上可以等同于Windows的磁盘分区,或卷的概念。
为了保证与FreeBSD共存的系统能够启动,默认情况下FreeBSD会保留一部分磁盘空间(64 cyl)。
对于单一操作系统的计算机来说,这是完全没有必要的。
分区时按Shift+F可以选择不使用这个特性,不过这种情况下,除了彻底毁掉这套FreeBSD之外,恐怕就没有其他方法能够从这块硬盘上引导其他操作系统了。
为了完全使用磁盘空间,我选择了不保留预留空间。
FreeBSD 使用手册第一章介绍目录1.1 概述1.2 欢迎来到 FreeBSD 的世界!1.3 关于 FreeBSD 项目Restructured, reorganized, and parts rewritten by Jim Mock.1.1 概述非常感谢您对 FreeBSD 感兴趣!下面的章节涵盖了 FreeBSD 项目的各个方面,比如它的历史、目标、开发模式,等等。
阅读完这章,您将了解:∙FreeBSD 与其它计算机操作系统的关系。
∙FreeBSD 项目的历史。
∙FreeBSD 项目的目标。
∙FreeBSD 开放源代码开发模式的基础。
∙当然还有:“FreeBSD” 这个名称的由来。
FreeBSD 是一个支持 Intel (x86 和Itanium®),AMD64,Alpha™,Sun UltraSPARC® 计算机的基于 4.4BSD-Lite 的操作系统。
到其他体系结构的移植也在进行中。
您也可以阅读FreeBSD 的历史,或者最新的发行版本。
如果您有意捐助(代码,硬件,基金),请看为 FreeBSD 提供帮助这篇文章。
1.2 欢迎来到 FreeBSD 的世界!FreeBSD 是一个支持 Intel (x86 和Itanium®),AMD64,Alpha™,Sun UltraSPARC® 计算机的基于 4.4BSD-Lite 的操作系统。
到其他体系结构的移植也在进行中。
您也可以阅读FreeBSD 的历史,或者最新的发行版本。
如果您有意捐助(代码,硬件,基金),请看为 FreeBSD 提供帮助这篇文章。
1.2.1 FreeBSD 能做些什么?FreeBSD有许多非凡的特性。
其中一些是:∙抢占式多任务与动态优先级调整确保在应用程序和用户之间平滑公正的分享计算机资源,即使工作在最大的负载之下。
∙多用户设备使得许多用户能够同时使用同一 FreeBSD 系统做各种事情。
Table of ContentsAbout1 Chapter 1: Getting started with FreeBSD2 Remarks2 Versions2 Examples4 Installation or Setup4 Chapter 2: Build from source5 Introduction5 Remarks5 Overview of the whole process5 Get the number of processors5 Examples5 Download the latest source code5 SVN5 Get Current6 Get Releases6 Tarball (http & ftp)6 http6 ftp6 Git6 GitHub6 Configure the kernel6 Build the world and the kernel7 Build the world7 Estimated time7 Build the kernel7 Estimated time7 Configure the root filesystem of your new FreeBSD7 Install the world and the kernel8Install the world8 Install the kernel8 Chapter 3: FreeBSD Jails9 Examples9 Deploying jail9 Simple jail deployment from binaries9 Simple jail deployment from source9 Simple thin jail deployment10 Initializing our environment10 downloading sources10 Initializing our thin jail10 Networking and Jails11 Removing network support11 Allowing only IPv4 networking11 Allowing only IPv6 networking11 Dedicated network stack (VNET)11 Chapter 4: Packages and Ports management13 Remarks13 Examples13 Getting Ports tree13 Portsnap13 updating ports tree with portsnap13 schedule cron job for daily updates13 SVN13 head13 quaterly13 Tarball (http or ftp)14 Git14 Searching software14 keyword search14name search14 Using fresports14 Building and installing software14 Simple build and install with manual configuration14 Simple build and install with automatic configuration15 Configuring software sources15 Configuring www/apache2415 Packaging15 Manual packaging15 Using poudriere15 Installing poudriere15 Configuring poudriere16 Deploying poudriere jail16 Updating poudriere jail16 Deploying poudriere ports tree16 Updating poudriere ports tree16 Bulk build16 Chapter 5: Set up the FreeBSD development environment17 Examples17 ctags17 Build exctags(1) using ports17 Download and install a prebuilt binary of Exuberant Ctags:17 Create the tag file17 Credits18AboutYou can share this PDF with anyone you feel could benefit from it, downloaded the latest version from: freebsdIt is an unofficial and free FreeBSD ebook created for educational purposes. All the content is extracted from Stack Overflow Documentation, which is written by many hardworking individuals at Stack Overflow. It is neither affiliated with Stack Overflow nor official FreeBSD.The content is released under Creative Commons BY-SA, and the list of contributors to each chapter are provided in the credits section at the end of this book. Images may be copyright of their respective owners unless otherwise specified. All trademarks and registered trademarks are the property of their respective company owners.Use the content presented in this book at your own risk; it is not guaranteed to be correct nor accurate, please send your feedback and corrections to ********************Chapter 1: Getting started with FreeBSD RemarksThis section provides an overview of what freebsd is, and why a developer might want to use it.It should also mention any large subjects within freebsd, and link out to the related topics. Since the Documentation for freebsd is new, you may need to create initial versions of those related topics.VersionsSome versions were omitted since the exact release date is unknown. See the source of this post to view the list of the omitted versions.ExamplesInstallation or SetupFreeBSD is known of its well-written handbook (link). The installation process is described in detail in the Chapter 2. Installing FreeBSD.Read Getting started with FreeBSD online: https:///freebsd/topic/5708/getting-started-with-freebsdChapter 2: Build from sourceIntroductionExamples below are not necessarily in the correct order. See the Remarks section below for more information on the whole process.RemarksOverview of the whole processDownload the latest source code.1.2.Configure the kernel.3.Build the world and the kernel.4.Configure the root filesystem of your new FreeBSD.5.Install the world and the kernel.Get the number of processorsAn easy way to speed up the process of building and installing the new system is to use more processors to increase the computational power.To find out what's the number of the processors you have to speed up the process:sysctl hw.ncpuFor example:hw.ncpu: 1Let's set the $NUMBER_OF_PROCESSORS environmental variable then:export $NUMBER_OF_PROCESSORS=$(sysctl hw.ncpu | tr -d 'a-z.: ')ExamplesDownload the latest source codeSVNFreeBSD project use SVN as default SCM. Source could be download with svnlite software. Get Currentcd /usr/srcsvnlite checkout https:///base/head .Get Releasescd /usr/srcsvnlite checkout https:///base/release/11.0.0 .Tarball (http & ftp)You can also get source from frozen tarball with fetch commandhttpcd /tmpfetch /pub/FreeBSD/releases/amd64/11.0-RELEASE/src.txzcd /usr/srctar xJvf /tmp/src.txzftpcd /tmpfetch ftp:///pub/FreeBSD/releases/amd64/11.0-RELEASE/src.txzcd /usr/srctar xJvf /tmp/src.txzGitGitHubgit clone https:///freebsd/freebsd freebsdsrcConfigure the kernelGo to the directory with the source code:1.cd freebsdsrc2.Go to the directory with the kernel's configuration code:# If your system is 32-bit.cd sys/i386/conf/# If your system is 64-bit.cd sys/amd64/conf/3.Get a copy of the GENERIC kernel (let's call it MODEDKERNEL). It will be the base of your customisations.cp GENERIC MODEDKERNEL4.Modify the MODEDKERNEL file at your will.Build the world and the kernelBuild the worldGo to the freebsdsrc/ (the root directory of the FreeBSD source tree you've already downloaded) and build the world:sudo make -j${NUMBER_OF_PROCESSORS} buildworld KERNCONF=MODEDKERNEL -DNO_CLEAN Estimated time•Estimated time on Hasee Q540S running on a one processor: 8 hours.•Estimated time on Dell L702X running on 8 processors: 98 minutes.Build the kernelTo build the kernel run:sudo make -j${NUMBER_OF_PROCCESORS} buildkernel KERNCONF=UFFIE -DNO_CLEANEstimated time•Estimated time on Hasee Q540S running on a one processor: 2 hours.•Estimated time on Dell L702X running on 8 processors: 19 minutes.Configure the root filesystem of your new FreeBSDLet's configure the destination directory for the root filesystem of your new FreeBSD (for exampleAdd the following lines to /etc/src.conf to set it up:.if ${KERNCONF} == "MODEDKERNEL"DESTDIR?=/usr/home/beastie/MODEDKERNELMODULES_OVERRIDE=md ufs.endifRemember to use spaces not tabs if you wish to indent the code.1. Create the root file system now:Make distribution directories:sudo make distrib-dirs KERNCONF=MODEDKERNELEstimated time on Hasee Q540S: a few seconds.•Make the distribution:sudo make distribution KERNCONF=UFFIEEstimated time on Hasee Q540S: 3 minutes.•2. Install the world and the kernel Install the worldsudo make installworld KERNCONF=MODEDKERNEL Estimated time on Hasee Q540S: 5 minutes.Install the kernelsudo make installkernel KERNCONF=MODEDKERNELEstimated time on Hasee Q540S: a few seconds.Read Build from source online: https:///freebsd/topic/7062/build-from-sourceChapter 3: FreeBSD JailsExamplesDeploying jailA jail is simply a chroot with strong isolation. So, if you want to create jail, you simply need to create an alternative root and starting a new jail in it.Simple jail deployment from binaries# create our alternative root pathJAILROOT="/path/to/my/jail"mkdir -p "${JAILROOT}"cd "${JAILROOT}"# get distribution from freebsd repositoryfetch /pub/FreeBSD/releases/amd64/11.0-RELEASE/base.txz# extract it in our alternative roottar xJvf base.txz# now we can launch our jailjail -c name=simplejail path=${JAILROOT}# to check if jail is up and running we use jlsjls# now we can enter in our new jailjexec simplejail shSimple jail deployment from source# create our alternative root pathJAILROOT="/path/to/my/jail"mkdir -p "${JAILROOT}"# we need to build binaries from source...cd /usr/srcmake buildworld# ... and install it in our alternative pathmake installworld DESTDIR=${JAILROOT}# now we can launch our jailjail -c name=simplejail path=${JAILROOT}# to check if jail is up and running we use jls# now we can enter in our new jailjexec simplejail shSimple thin jail deploymentThin jail is simply a jail with shared read-only alternative root mounted with nullfs. Initializing our environment# making our shared alternative rootSHARED_ROOT=/path/to/your/shared/rootmkdir -p "${SHARED_ROOT}"# making our jail rootJAIL_ROOT=/path/to/your/jail/rootmkdir -p "${JAIL_ROOT}"downloading sources# to initialize our shared root, we can use# all method described above. Here, we will use# simple binary initialization from official# repositorycd "${SHARED_ROOT}"# get distribution from freebsd repositoryfetch /pub/FreeBSD/releases/amd64/11.0-RELEASE/base.txz# extract it in our alternative roottar xJvf base.txzInitializing our thin jail# now we need to initialize our dedicated# jail rootcd "${JAIL_ROOT}"mkdir base# we make symbolic link pointing to# files stored in read-only directoryfor link in bin boot lib libexec rescue sbindoln -s ${link} /base/${link}done# we do same thing with directory in /usrfor link in bin include lib lib32 libdata libexec sbin sharedoln -s usr/${link} /base/usr/${link}# now we are ready to start our jail!jail -c name=thinjail path="${JAIL_ROOT}" \mount="${SHARED_ROOT} ${JAIL_ROOT} nullfs ro 0 0"# check if our thin jail is ok...jls# we can now grab in it!jexec thinjail shNetworking and JailsFreeBSD jails can have fine grained networking configuration. By default, every jails use the same network configuration than host.Removing network supportjail -c name="nonetwork" path="/path/to/your/jail" ip4=disable ip6=disableAllowing only IPv4 networkingjail -c name="onlyipv4" path="/path/to/your/jail" ip4=inherit ip6=disableAllowing only IPv6 networkingjail -c name="onlyipv6" path="/path/to/your/jail" ip4=disable ip6=inherit Dedicated network stack (VNET)VNET is recent feature allowing jail to have its own network stack. Doing this configuration need to add routing feature to the host. VIMAGE option is required in host kernel.# starting our own jail with vnetjail -c name="vnetjail" path="/path/to/your/jail" vnet=new# we need a bridge...ifconfig bridge0 create# a pair of ethernet interface...ifconfig epair0 create# and interconnecting epair, jail and bridgeifconfig epair0b vnet vnetjailRead FreeBSD Jails online: https:///freebsd/topic/7070/freebsd-jailsChapter 4: Packages and Ports management RemarksTips:Remember to always check the /usr/ports/UPDATING file before upgrading. There might be •some significant changes in programs you use or in their configuration which will break your current setup.ExamplesGetting Ports treePortsnapportsnap fetchportsnap extractupdating ports tree with portsnapportsnap updateschedule cron job for daily updates0 3 * * * root /usr/sbin/portsnap cronSVNheadcd /usr/portssvnlite checkout https:///ports/head .quaterlyFreeBSD Ports team freeze ports tree every 3 months. To get this ports tree you can use ports branches:cd /usr/portssvnlite checkout https:///ports/branches/2016Q4 .Tarball (http or ftp)cd /usr/portsfetch /pub/FreeBSD/releases/amd64/11.0-RELEASE/ports.txztar xJvf ports.txzGitgit clone https:///freebsd/freebsd-portsSearching softwarekeyword searchcd /usr/portsmake search key=apachename searchcd /usr/portsmake search name=apache24Using fresportsOfficial FreeBSD ports website (/) give you a nice way to find ports and all information concerning it.Building and installing softwareIf you have found your software in the ports tree, now its the time to build it.Simple build and install with manual configurationcd /usr/ports/www/apache24makemake installSimple build and install with automatic configurationcd /usr/ports/www/apache24make BATCH=yesmake installConfiguring software sourcesIf you want custom configuration from ports, you can configure it before building it make config. All ports configuration are stored in /var/db/ports/${CATEGORY_NAME}/options as makefile. Configuring www/apache24cd /usr/ports/www/apache24make configmakemake installThis configuration will be saved in /var/db/ports/www_apache24/options.PackagingManual packagingYou can make your own package based on ports.cd /usr/ports/www/apache24make package BATCH=yesThis command will store your package in /usr/ports/packages/All.Using poudrierepoudriere is currently the official package builder for FreeBSD.pkg install poudriere# orcd /usr/ports/ports-mgmt/poudrieremakemake installConfiguring poudrierepoudriere configuration is stored in /usr/local/etc/poudriere.conf and /usr/local/etc/poudriere.d Deploying poudriere jailpoudriere jail -c -j myjailUpdating poudriere jailpoudriere jail -u -j myjailDeploying poudriere ports treepoudriere ports -c -p myportsUpdating poudriere ports treepoudriere ports -u -p myportsBulk buildpoudriere bulk -j myjail -p myports www/apache24Read Packages and Ports management online:https:///freebsd/topic/7069/packages-and-ports-managementChapter 5: Set up the FreeBSD development environmentExamplesctagsctags is a useful utility you can use to read and move around the source code more efficiently. The built-in ctags(1) however is not the Exuberant Ctags utility you might expect.You can install Exuberant Ctags (exctags(1)) using either ports or pkg:Build exctags(1) using portscd /usr/ports/devel/ctags/ && make install cleanDownload and install a prebuilt binary of Exuberant Ctags: pkg install ctagsCreate the tag fileexctags -RRead Set up the FreeBSD development environment online:https:///freebsd/topic/6136/set-up-the-freebsd-development-environmentCredits。
FREEBSD安装与配置之概述篇 ----------------------------------------------------------- 1 FREEBSD系统安装与配置之准备篇 ----------------------------------------------------- 6 FREEBSD系统安装与配置安装篇(上) ---------------------------------------------- 11 FREEBSD系统安装配置之安装篇(下) ---------------------------------------------- 19 FREEBSD系统安装配置之配置篇 ------------------------------------------------------- 26 FREEBSD系统终极安装手册 ------------------------------------------------------------- 37 FreeBSD安装与配置之概述篇FreeBSD是一种运行在Intel平台上、可以自由使用的Unix系统,它可以从Internet上免费获得。
而它又具备极其优异的性能,使它得到了计算机研究人员和网络专业人士的认可。
因此,不但专业人员把它用作个人使用的Unix工作站,很多企业,特别是ISP(Internet服务提供商)都使用运行FreeBSD的服务器来为他们的众多用户提供网络服务。
BSD Unix使用一个神话中的精灵形象作为其吉祥物,这个吉祥物标志被各BSD发行版本沿用。
1993年12月FreeBSD 1.0版本正式发布。
任何人都可以通过购买光盘或者通过Internet下载的方法,自由获得FreeBSD系统,使得FreeBSD取得了很大成功。
由于Unix商标属于X/Open组织,而FreeBSD只是一个自由操作系统,从法律角度上看FreeBSD 不能被叫作Unix(不能使用Unix做商标)。
freebsd开发环境解决方案-电脑资料以前曾经看过很多开发人员提到FreeBSD用于开发是非常优秀的系统,但是之前提到的主要都是freebsd在单机的开发环境下所具有的优势,但是最近我发现其实FreeBSD在开发方面所具备的优势并不仅只于此,。
在一个开发团队中使用FreeBSD是可以形成一个完整的解决方案的。
在单机方面的开发环境上,我不想多说了,Linux其实也具备很多好的特点的,我想说得更多是linux所不具备的特点。
当然这个方案使用linux来完成并不是不可能的,但是使用linux来完成其中的很多部分是有一些困难的,从便利性上来讲不如FreeBSD,从我这个懒人的角度来讲,如果有两个方法来解决问题,一个既简单又快速(还很清晰),另一个相对比较复杂,耗时长。
那我没有理由非要选用后一种。
说这话的原因是,我不想跟我们国家普遍存在的某些偏执的人引起任何的争论。
只是想说这里其实有一种简单易行的方法。
更主要的原因是,这种方法在我已知的情况下还没有人在开发环境的建立中使用。
其实这个方法所使用的技术都是已经被广泛采用的,甚至可以说有些古老的东西。
只是通过FreeBSD这个系统能够把它们都串连在一起。
可以形成一套完整的开发环境,还包括办公环境。
我这个想法的核心是由一台FreeBSD中心服务器来完成的。
这个中心服务器上安装CVS server,Samba server和NFS server就可以了,其中Samber server可以提供方便的空间共享,之所以除了NFS还要再单装Samba,是因为Samba在非*nix的环境上也可以使用。
同时还可以安装CUPS 来驱动一台打印机,通过Samba共享,让整个工作环境都可以共享打印服务。
用FreeBSD做中央文件服务器和CVS服务器的好处是不会受到广大的Windows病毒的影响。
现在还有一点缺憾的是在FreeBSD 上还没有好的杀毒软件可用,虽然有个老美的杀毒软件,但是因为是付费的,付给老美一方面有点贵贵,另一方面也比较麻烦,希望我们国家的杀毒软件厂商也能考虑做一个能在FreeBSD上运行的版本,就算收点钱也可以。
FreeBSD全能服务器安装手册之基础介绍篇--FreeBSD的历史简介FreeBSD 的历史Contributed by Jordan Hubbard FreeBSD 专案开始于1993 年早期,衍伸于由Nate Williams, Rod Grimes 跟Jordan K. Hubbard 三人所发表的"Unofficial 386BSD Patchkit". David Greenman 跟Julian Elischer 也在幕后参与了这些计画,但是他们一直到正式发表后的一两个月后才全力参与本专案。
我们原先的计画是产生386BSD 的测试版以修正一些patchkit 无法解决的bug。
386BSD 是Bill Jolitz 所主导的作业系统,但是长H来却已经被他疏忽,而没有继续维护,戌鸠M定帮忙Bill Jolitz 继续维护386BSD 但是Bill Jolitz 突然决定离开386BSD 的发展而没有继续的计画。
不中妨M定继续发展这套作业系统(就算没有Bill Jolitz 的支持) ,并且将其命名为"FreeBSD" (该名称由David Greenman 掷铜板所决定的)。
在跟该系统的使用者讨论过后,我们决定了最初的目标,并且联络了Walnut Creek CDROM 以提供FreeBSD 的支持,Walnut Creek CDROM 不但提供作CDROM 的服务,还提供机器以及高速网路连线以供FreeBSD 的发展,最后才有今日的FreeBSD。
第一个CDROM 跟透过网路发行的版本是1993 年12 月的FreeBSD 1.0,那是基于U.C. Berkeley 所发行的4.3 BSD Lite("Net/2") 加上其它386BSD 跟Free Software Foundation 所发行的软体。
由于此版发行的成功,很快的在1994 年5 月就有了FreeBSD 1.1 release。
I. 让我们开始吧!FreeBSD使用手册的这部分是专门针对FreeBSD用户和系统管理员新手的。
这些章节包括:1.向你介绍FreeBSD。
2.指导你一步步地安装。
3.教你一些UNIX的基础知识。
4.向你展示如何安装针对FreeBSD的大量第三方应用程序。
5.向你介绍X----UNIX的视窗系统,以及如何配置一个桌面环境。
我们已经尽量压缩了介绍文本的页数,以便你在阅读这章时不至于太累。
第1章介绍(翻译中出现的任何问题或错误,请广大读者及时反馈给我:freebsdhandbook@) 1.1概要非常感谢你对FreeBSD感兴趣!在下面的章节中,我们将为你介绍有关FreeBSD计划的各个方面,例如,它的历史、目标和开发模式等等。
读完这章,您将了解到:•FreeBSD与其它电脑操作系统的关系是怎样的。
•FreeBSD计划的历史。
•FreeBSD计划的目标。
•FreeBSD开放源代码开发模式的基础知识。
•当然,还有FreeBSD这个名称的由来。
1.2欢迎使用FreeBSD!FreeBSD是一个同时支持Intel架构和DEC架构的,以4.4BSD-Lite为基础发展而来的操作系统。
其它架构的Ports(注)也正在发展中。
如果你想对FreeBSD有一个大致的了解,你可以看一下下面的章节。
你也可以在本手册的后面介绍中了解一下FreeBSD的历史或者是它的当前发行版本。
如果你想为这一计划贡献点什么,你可以参看后面的“为FreeBSD作贡献”一节。
注: 每种要被移植到FreeBSD上的软件被称为一个Port,由某个FreeBSD的开发者维护。
这个Port的维护者首先将软件移植到FreeBSD上,并将他所完成的这些移植工作按照Ports Collection的要求进行设置,编写相关的脚本,使下载软件、配置、编译、安装的全过程能够自动完成,不需人工干预。
每个Port中并没有保存软件包的源代码或者二进制代码,而只是提供了搜索它的源代码或者二进制软件包的方法。
004 FreeBSD全能服务器安装手册之基础介绍篇--FreeBSD的历史FreeBSD全能服务器安装手册之基础介绍篇--FreeBSD的历史自从计算机技术的发展以来,操作系统一直是广大互联网从业者所关注的热点。
在这个领域,FreeBSD作为一款功能强大的开源操作系统备受关注。
本文将为读者介绍FreeBSD的历史背景,帮助读者更好地了解其发展和应用。
一、FreeBSD的起源和发展FreeBSD,全称为"Free Berkeley Software Distribution",它起源于加利福尼亚大学伯克利分校(University of California, Berkeley)的计算机科学研究项目。
在1977年,伯克利分校发布了BSD(Berkeley Software Distribution)的第一个版本,这是一个开放源代码的UNIX操作系统。
随着时间的推移,BSD系统不断发展演进,并从早期的BSD UNIX 和BSD 4.4开始分为不同的版本和分支,其中就包括了FreeBSD。
FreeBSD于1993年推出,同时BSD的开放源码也是这个时期开始逐渐对外公开。
二、FreeBSD的特点和优势1. 开放源代码:FreeBSD是一款开放源代码操作系统,用户可以自由地获取、修改和分发系统的源代码。
这为用户提供了更大的自由度和灵活性,可以根据自身需求进行定制。
2. 安全稳定:FreeBSD以其极佳的安全性和稳定性而受到赞誉。
由于有着严格的安全审核和持续的漏洞修复,FreeBSD被广泛运用于高安全性要求的企业环境以及各种互联网服务器。
3. 高度可定制:FreeBSD为用户提供了丰富的第三方软件包,以及灵活的个性化配置选项。
用户可以根据自己系统的需求,选择安装所需的软件工具,并进行相应的配置,以实现个性化的设置。
4. 出色的网络性能:FreeBSD在网络性能上表现出色,具有较高的处理能力和网络吞吐量。
第15章 FreeBSD配置文件(欢迎提出意见和建议:freebsdhandbook@)UNIX的最突出的一个特征是所有的系统配置信息都存储在文本文件中,通常是在/etc目录下。
一些人认为这种方法与一个漂亮的GUI配置编辑器相比显得很原始,但这种方法有很多突出的优点。
特别是,你可以正确地看到程序的执行情况。
对于一个GUI编辑器,真正的配置通常被保存在一个你不能读取的格式中,甚至即使你可以读,也没有相关的介绍。
而且,每次你都需要看很多的配置文件:一个GUI编辑器通常只有一小部分的配置你能够看到,很难看清楚相互之间的关系。
在Microsoft世界里,解决问题的最普通的方法是重新安装系统。
这是一个糟糕的宣布:它经常需要这样做,途中你还会遇到很多其他的问题,你永远无法找到问题是什么。
如果你的FreeBSD系统不能按你的要求来做,不需要重新安装系统。
只要看看配置文件,就可以很好地找出问题所在。
在所有版本的UNIX中,绝大部分的配置文件是一样的。
这篇文章可以暂时地让我们了解它们,但你可以在Evi Nemeth, Garth Snyder, Scott Seebass和Trent R. Hein合著的书《UNIX System Administration Handbook》中深入地了解这些信息。
在所有的情况下,你可以联机手册的第5部分了解更多的信息。
在这节,我们将首先看看/etc/defaults/rc.conf和/etc/rc.conf。
在第278页,我们将看看其他非网络配置文件,在第87页,我们将看看与网络配置有关的文件。
/etc/rc.conf/etc/rc.conf是主系统配置文件,这种格式是FreeBSD唯一的。
在比较老的FreeBSD中,这个文件被叫做/etc/sysconfig——仅仅是名称修改了。
/etc/rc.conf是一个用来定义你系统配置的文件——也就是说,当系统启动时,它需要做些什么。
FreeBSD 操作系统在无远程控制台下的远程安装Daniel Gerzo<danger@>$FreeBSD:head/zh_CN.GB2312/articles/remote-install/article.xml 39632 2012-10-01 11:56:00Z gabor $版权© 2008 The FreeBSD Documentation Project$FreeBSD:head/zh_CN.GB2312/articles/remote-install/article.xml 39632 2012-10-01 11:56:00Z gabor $FreeBSD 是 FreeBSD基金会的注册商标许多制造商和经销商使用一些称为商标的图案或文字设计来彰显自己的产品。
本文档中出现的,为 FreeBSD Project 所知晓的商标,后面将以'™' 或'®' 符号来标注。
本文归档了当远程控制台不可用的情况下 FreeBSD 操作系统的远程安装。
文章背后的主要灵感归功于和 Martin Matuska<mm@> 还有由 Pawel Jakub Dawidek<pjd@> 提供的宝贵输入合作的结果。
1 背景世界上有很多的服务器主机供应商,但是他们中只有很少的一部分正式支持 FreeBSD,他们通常为他们提供的服务器上安装Linux® 发行版提供支持。
在某些情况下,如果你请求这些公司他们会安装一个你首选的Linux 发行版。
有了这个选择,我们将试图安装 FreeBSD。
在其他情况下,他们可能提供一个急救系统用于紧急情况。
使用这个可能将有利于我们的目的更好的实现。
本文涵盖了引导一个包含 RAID-1 及ZFS性能的 FreeBSD 系统的远程安装的基本安装配置所必须的步骤。
2 简介这一节会摘要本文的目的以及更好阐述这里所概括的东西。
本文中的这些指令将有益于那些使用不支持 FreeBSD 的托管设施提供的服务的人。
1.如我们提到过的背景的那一节,许多的有声望的服务器主机托管公司提供了各种的急救系统。
可以从他们自己的局域网启动并可以通过SSH访问。
他们通常提供这种支持目的用于帮助他们的顾客修正损坏的操作系统。
如文章将说明的,我们将能够通过这些急救系统的帮助来安装 FreeBSD。
2.文章的下一小节会描述如何配置,并在本地机器上构建最小限度的 FreeBSD。
该版本最终会从随机存储盘运行到远程机器上面去。
这将允许我们使用sysinstall实用程序从一个FTP 镜像安装一套完整的 FreeBSD 操作系统。
3.文章的剩余内容除了描述ZFS文件系统的配置还将描述系统本身的安装步骤。
2.1 需求想要成功地做下去,你必须:∙拥有一个可通过SSH网络访问的操作系统。
∙理解 FreeBSD 的安装过程∙熟悉sysinstall(8)实用程序∙拥有 FreeBSD 安张的 ISO 镜像文件或者易于使用的 CD3 准备工作 - mfsBSD在 FreeBSD 可能安装到目标系统上之前,需要先构建一个最小化的从磁盘启动的 FreeBSD 操作系统映像文件。
此方法中新系统必须能够从网络访问,并且安装的其他过程能够在没有远程访问到系统控制台的情况下完成。
mfsBSD设置工具能够被用来构建一个微小的 FreeBSD 映像。
如mfsBSD名字的含义(“mfs” 的意思是“memory file system” 内存文件系统),最后的映像全部从随机存储器运行。
多亏了这个特性,磁盘的操作将不会有任何限制,因此它能够被用来安装一个完整的 FreeBSD 操作系统。
mfsBSD的主页在/~mm/mfsbsd/,包含了指向最新释出的设置工具。
请注意关于mfsBSD内幕以及它所有的适用都超出了本文的内容,感兴趣的读者应该去查阅mfs的原始文档得到更多详细内容。
下载并解压出最新的mfsBSD版本,并改变自己的当前工作目录到存在mfsBSD脚本文件的目录:# fetch/~mm/mfsbsd/mfsbsd-latest.tar.gz # tar xvzf mfsbsd-1.0-beta1.tar.gz# cd mfsbsd-1.0-beta1/3.1 mfsBSD 的配置引导mfsBSD之前,必须设置一些重要的配置选项。
最重要的是我们必须有正确地,自然地,网络配置。
最适合的方法配置网络选项取决于我们是否事先知道我们会用到的网络接口,而且网络接口驱动程序应被系统为我们的硬件载入。
我们将看到mfsBSD如何能够在任一种情况下被配置。
另外一件重要的事情是设置 root 的密码。
这将通过编辑conf/rootpw.conf 文件来完成。
请记住该文件将把你的密码保存在简单的文本中,所以在此我们不推荐你使用真实的密码。
然而,这只是一个临时使用一次的密码,你可以在随后安装好的系统中更改它。
3.1.1 编辑 conf/interfaces.conf 的方法如果我们安装好的网卡是未知类型的,我们可以使用mfsBSD 的自动探测功能。
mfsBSD启动脚本能够探测到正确的驱动来使用,基于网络接口的 MAC 地址,我们假设在 conf/interfaces.conf 文件中设置如下选项:initconf_interfaces="ext1"initconf_mac_ext1="00:00:00:00:00:00"initconf_ip_ext1="192.168.0.2"initconf_netmask_ext1="255.255.255.0"别忘了添加 defaultrouter 信息到 conf/rc.conf 文件中:defaultrouter="192.168.0.1"3.1.2 编辑 conf/rc.conf 的方法当网络接口的驱动是已知类型的,使用 conf/rc.conf 文件添加联网选项会更加方便。
该文件的语法跟 FreeBSD 中标准的rc.conf(5)文件的语法相同。
例如,当你知道被使用的将是一个re(4)网络接口设备,你可以在 conf/rc.conf 文件中设置如下选项:defaultrouter="192.168.0.1"ifconfig_re0="inet 192.168.0.2 netmask 255.255.255.0"3.2 构建一个 mfsBSD 映像构建一个mfsBSD映像文件的过程是非常简单明了的。
第一步是挂载 FreeBSD 的安装 CD,或者挂载安装 ISO 文件到 /cdrom。
因为例子的缘故,在文章中我们将假定你下载的是FreeBSD 7.0-RELEASE ISO 文件。
使用mdconfig(8)实用程序挂载ISO 映像文件到 /cdrom 目录非常简单:# mdconfig -a -t vnode -u 10 -f 7.0-RELEASE-amd64-disc1.iso # mount_cd9660 /dev/md10 /cdrom紧接着,构建可启动的mfsBSD映像:# make BASE=/cdrom/7.0-RELEASE注意:上面的 make 命令必须在mfsBSD目录树的最高一层运行,也就是: ~/mfsbsd-1.0-beta1/。
3.3 启动 mfsBSD现在mfsBSD映像已经准备好了,必须把它上传到远程的一个正在运行的急救系统上或者一个预安装了 Linux 发行版的系统上。
最适合做这个工作的工具是scp:# scp disk.img root@192.168.0.2:.想要正确的引导mfsBSD映像,必须把它安放在机器的第一块(可启动)设备上。
这可能会和使用的例子我们假定的一样,第一块可启动磁盘设备是 sda:# dd if=/root/disk.img of=/dev/sda bs=1m如果一切正常,该映像现在应该存在于第一块设备的 MBR(主引导区)而机器也应该能够被启动了。
使用工具ping(8)来查看机器是否被正确启动。
一旦它回复在线状态,就应该能够使用 root 用户和配置好的密码通过ssh(1)来访问它了。
4 FreeBSD 操作系统的安装mfsBSD成功被引导后它就应该能够通过ssh(1)登入了。
这一节会描述如何创建 slices 并标记 slices 的 label,为 RAID-1 配置gmirror,还有如何使用sysinstall来安装一个最小的FreeBSD操作系统版本。
4.1 准备磁盘首要的任务是为 FreeBSD 分配磁盘空间,也就是,创建slices 和 partitions。
很显然,当前运行的系统是全部被载入到系统内存中的因此操作磁盘将没有任何问题。
要完成这个任务,可以是使用sysinstall或者fdisk(8)中的二者任一并结合工具bsdlabel(8)。
在开始时,将所有磁盘都标记成空的,在每个磁盘上重复如下命令:# dd if=/dev/zero of=/dev/ad0 count=2下面,使用你喜欢的工具创建 slices 并标记磁盘 label。
比较简单的方法是使用sysinstall,强大也可能几乎没有漏洞方法是使用标准的基于文本的UNIX® 工具,类似于fdisk(8)和bsdlabel(8)这些工具的使用也会在这一节中包括。
前者已经被包括在 FreeBSD 手册的安装FreeBSD一章中了。
如本节中刚提到的,这篇文章会展示如何设置一个带有 RAID-1 和ZFS性能的系统。
我们的设置由一个小工具gmirror(8)镜像为 / (root), /usr 和 /var 文件系统,并把剩余的磁盘空间被分配为zpool(8)镜像出的ZFS文件系统。
请注意,ZFS文件系统将在 FreeBSD 操作系统成功安装并启动后才会被配置。
下面的例子会描述如何去创建 slices 和 labels,在每个partition 上初始化gmirror(8)并如何在每个被镜像过的partition 上创建UFS2文件系统:# fdisk -BI /dev/ad0# fdisk -BI /dev/ad1# bsdlabel -wB /dev/ad0s1# bsdlabel -wB /dev/ad1s1# bsdlabel -e /dev/ad0s1# bsdlabel /dev/ad0s1 > /tmp/bsdlabel.txt && bsdlabel -R/dev/ad1s1 /tmp/bsdlabel.txt# gmirror label root /dev/ad[01]s1a# gmirror label var /dev/ad[01]s1d# gmirror label usr /dev/ad[01]s1e# gmirror label -F swap /dev/ad[01]s1b# newfs /dev/mirror/root# newfs /dev/mirror/var# newfs /dev/mirror/usr在整个磁盘上创建一个 slice 并初始化包含在磁盘第一个扇区启动代码。