FreeBSD的可玩性还是很高的.

本文将介绍一下FreeBSD在vmware中的安装, 物理机的安装和这个差不多.

我们这里将要用到zfs的root disk mirror. 所以虚拟机环境中需要2块物理设备.
如果是物理机器的话, 建议使用RAID的JBOD模式. (原因参见 http://blog.163.com/digoal@126/blog/static/163877040201441694022110/)
首先我们要下载freebsd 的iso, 本文用到的是10.0 x64的版本.
ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/amd64/ISO-IMAGES/10.0/FreeBSD-10.0-RELEASE-amd64-dvd1.iso
然后需要安装vmware workstation. 我这里用到的是10的版本.
创建虚拟机
内存建议配大一点, 至少1G, 最好有2GB, 如果使用ZFS的话, 最好大于4GB.
创建磁盘

这里只创建了1块磁盘, 所以使用ZFS的话, 无法选择mirror模式.
最好创建2块一样的磁盘, 实际生产机中, 如果底层设备是RAID模式的, 那么没有必要使用MIRROR模式.
如果底层设备不是RAID模式, 那么建议使用JBOD+mirror模式.
准备安装, 选择1.
配置键盘
配置主机名
配置要安装的包
选择磁盘分区, 建议使用ZFS.
选择Install, 配置ZPOOL
因为例子中只有1块硬盘, 选择mirror后会导致无法进行安装.
关闭虚拟机, 新建一个硬盘.
现在可以选择mirror了, 选中两块硬盘作为mirror vdev.
开始安装包

安装完成后, 提示你设置root用户的密码
然后是配置网卡
配置时钟, 时区.
配置BSD启动后, 开启哪些常用的服务, 例如sshd, ntpd

询问是否新增一个普通用户, 可以在后面使用adduser命令添加.
是否安装handbook, 可选.
询问是否进入SHELL进行配置, 可以配置, 也可以直接exit退出
重启服务器.

接下来要配置一下sshd_config, 让root用户可以使用密码认证, 使用远程登录.
重启sshd服务

创建普通用户举例
root@my-domain:~ # adduser 
Username: digoal    输入用户名
Full name: digoal.zhou   输入全名
Uid (Leave empty for default): 
Login group [digoal]: 
Login group is digoal. Invite digoal into other groups? []:   类似linux 的useradd -G , 是否加入其他组
Login class [default]: 
Shell (sh csh tcsh nologin) [sh]: csh  使用csh
Home directory [/home/digoal]: 
Home directory permissions (Leave empty for default): 
Use password-based authentication? [yes]:   是否使用基于密码的认证
Use an empty password? (yes/no) [no]: 
Use a random password? (yes/no) [no]: 
Enter password: 
Enter password again: 
Lock out the account after creation? [no]:   创建完后是否锁住用户
Username   : digoal
Password   : *****
Full Name  : digoal.zhou
Uid        : 1002
Class      : 
Groups     : digoal 
Home       : /home/digoal
Home Mode  : 
Shell      : /bin/csh
Locked     : no
OK? (yes/no): yes
adduser: INFO: Successfully added (digoal) to the user database.
Add another user? (yes/no): no  是否继续创建其他用户
Goodbye!

root@my-domain:~ # id digoal
uid=1002(digoal) gid=1002(digoal) groups=1002(digoal)

查找包举例
pkg search $packagename
第一次使用pkg, 如果没有安装的话, 会提示安装.
root@digoal:~ # pkg search postgresql The package management tool is not yet installed on your system. Do you want to fetch and install it now? [y/N]: y Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/freebsd:10:x86:64/latest, please wait...
Verifying signature with trusted certificate pkg.freebsd.org.2013102301... done Installing pkg-1.2.7_2... done If you are upgrading from the old package format, first run: # pkg2ng
root@my-domain:~ # pkg search postgresql
exim-postgresql-4.82
ja-postgresql82-man-8.2.4
libgda4-postgresql-4.2.12
libgda5-postgresql-5.0.3
p5-Test-postgresql-0.09
pgtcl-postgresql90-2.0.0
pgtcl-postgresql91-2.0.0
pgtcl-postgresql92-2.0.0
pgtcl-postgresql93-2.0.0
pgtcl-postgresql94-2.0.0
postgresql-jdbc-9.1.902_1
postgresql-libpgeasy-3.0.4_1
postgresql-libpqxx-4.0.1_1
postgresql-libpqxx3-3.1.1_1
postgresql-odbc-09.01.0200_1
postgresql-pllua-1.0
postgresql-plproxy-2.5
postgresql-plruby-0.5.4_2
postgresql-plv8js-1.4.1
postgresql-relay-1.3.2_1
postgresql-repmgr-2.0_1
postgresql84-client-8.4.21
postgresql84-contrib-8.4.21_1
postgresql84-docs-8.4.21
postgresql84-plperl-8.4.21_1
postgresql84-plpython-8.4.21_1
postgresql84-pltcl-8.4.21
postgresql84-server-8.4.21_1
postgresql9-client-9.4.b1_1
postgresql9-contrib-9.4.b1_1
postgresql9-docs-9.4.b1
postgresql9-plperl-9.4.b1
postgresql9-plpython-9.4.b1
postgresql9-pltcl-9.4.b1
postgresql9-server-9.4.b1_1
postgresql90-client-9.0.17
postgresql90-contrib-9.0.17
postgresql90-docs-9.0.17
postgresql90-plperl-9.0.17
postgresql90-plpython-9.0.17
postgresql90-pltcl-9.0.17
postgresql90-server-9.0.17
postgresql91-client-9.1.13_1
postgresql91-contrib-9.1.13_1
postgresql91-docs-9.1.13
postgresql91-plperl-9.1.13_1
postgresql91-plpython-9.1.13_1
postgresql91-pltcl-9.1.13
postgresql91-server-9.1.13_1
postgresql92-client-9.2.8_1
postgresql92-contrib-9.2.8_1
postgresql92-docs-9.2.8
postgresql92-plperl-9.2.8_1
postgresql92-plpython-9.2.8_1
postgresql92-pltcl-9.2.8
postgresql92-server-9.2.8_1
postgresql93-client-9.3.4
postgresql93-contrib-9.3.4_1
postgresql93-docs-9.3.4
postgresql93-plperl-9.3.4
postgresql93-plpython-9.3.4
postgresql93-pltcl-9.3.4
postgresql93-server-9.3.4
postgresql_autodoc-1.41
py33-postgresql-1.1.0_1

安装包举例
pkg install $packagename
例如安装我们上面查到的postgresql 9.3.4
root@my-domain:~ # pkg install postgresql93-server-9.3.4
Updating repository catalogue
The following 2 packages will be installed:
        Installing postgresql93-client: 9.3.4
        Installing postgresql93-server: 9.3.4
The installation will require 25 MB more space
5 MB to be downloaded
Proceed with installing packages [y/N]: y
postgresql93-client-9.3.4.txz                                                           100% 1968KB  43.7KB/s 108.1KB/s   00:45    
postgresql93-server-9.3.4.txz                                                           100% 3196KB  47.0KB/s  55.5KB/s   01:08    
Checking integrity... done
[1/2] Installing postgresql93-client-9.3.4... done
[2/2] Installing postgresql93-server-9.3.4...===> Creating users and/or groups.
Creating group 'pgsql' with gid '70'.
Creating user 'pgsql' with uid '70'.
  =========== BACKUP YOUR DATA! =============
  As always, backup your data before
  upgrading. If the upgrade leads to a higher
  minor revision (e.g. 8.3.x -> 8.4), a dump
  and restore of all databases is
  required. This is *NOT* done by the port!
  Press ctrl-C *now* if you need to pg_dump.
  ===========================================
 done
The PostgreSQL port has a collection of "side orders":
postgresql-docs
  For all of the html documentation
p5-Pg
  A perl5 API for client access to PostgreSQL databases.
postgresql-tcltk 
  If you want tcl/tk client support.
postgresql-jdbc
  For Java JDBC support.
postgresql-odbc
  For client access from unix applications using ODBC as access
  method. Not needed to access unix PostgreSQL servers from Win32
  using ODBC. See below.
ruby-postgres, py-PyGreSQL
  For client access to PostgreSQL databases using the ruby & python
  languages.
postgresql-plperl, postgresql-pltcl & postgresql-plruby
  For using perl5, tcl & ruby as procedural languages.
postgresql-contrib
  Lots of contributed utilities, postgresql functions and
  datatypes. There you find pg_standby, pgcrypto and many other cool
  things.
etc...
For procedural languages and postgresql functions, please note that
you might have to update them when updating the server.
If you have many tables and many clients running, consider raising
kern.maxfiles using sysctl(8), or reconfigure your kernel
appropriately.
The port is set up to use autovacuum for new databases, but you might
also want to vacuum and perhaps backup your database regularly. There
is a periodic script, /usr/local/etc/periodic/daily/502.pgsql, that
you may find useful. You can use it to backup and perfom vacuum on all
databases nightly. Per default, it perfoms `vacuum analyze'. See the
script for instructions. For autovacuum settings, please review
~pgsql/data/postgresql.conf.
If you plan to access your PostgreSQL server using ODBC, please
consider running the SQL script /usr/local/share/postgresql/odbc.sql
to get the functions required for ODBC compliance.
Please note that if you use the rc script,
/usr/local/etc/rc.d/postgresql, to initialize the database, unicode
(UTF-8) will be used to store character data by default.  Set
postgresql_initdb_flags or use login.conf settings described below to
alter this behaviour. See the start rc script for more info.
To set limits, environment stuff like locale and collation and other
things, you can set up a class in /etc/login.conf before initializing
the database. Add something similar to this to /etc/login.conf:
---
postgres:\
        :lang=en_US.UTF-8:\
        :setenv=LC_COLLATE=C:\
        :tc=default:
---
and run `cap_mkdb /etc/login.conf'.
Then add 'postgresql_class="postgres"' to /etc/rc.conf.
======================================================================
To initialize the database, run
  /usr/local/etc/rc.d/postgresql initdb
You can then start PostgreSQL by running:
  /usr/local/etc/rc.d/postgresql start
For postmaster settings, see ~pgsql/data/postgresql.conf
NB. FreeBSD's PostgreSQL port logs to syslog by default
    See ~pgsql/data/postgresql.conf for more info
======================================================================
To run PostgreSQL at startup, add
'postgresql_enable="YES"' to /etc/rc.conf

root@my-domain:~ # su - pgsql
$ which psql
/usr/local/bin/psql
$ psql -V
psql (PostgreSQL) 9.3.4

这个pg的编译参数
$ pg_config --configure
'--with-libraries=/usr/local/lib' '--with-includes=/usr/local/include' '--enable-thread-safety' '--with-openssl' '--with-libxml' '--enable-nls' '--without-gssapi' '--prefix=/usr/local' '--mandir=/usr/local/man' '--infodir=/usr/local/info/' '--build=amd64-portbld-freebsd10.0' 'build_alias=amd64-portbld-freebsd10.0' 'CC=cc' 'CFLAGS=-O2 -pipe -fno-strict-aliasing' 'LDFLAGS= -L/usr/local/lib -Wl,-rpath,/usr/lib:/usr/local/lib' 'CPPFLAGS=' 'CPP=cpp' 'LDFLAGS_SL='

删除包举例
root@my-domain:~ # pkg remove postgresql93-server-9.3.4
Deinstallation has been requested for the following 1 packages:
        postgresql93-server-9.3.4
The deinstallation will free 17 MB
Proceed with deinstalling packages [y/N]: y
[1/1] Deleting postgresql93-server-9.3.4...==> You should manually remove the "pgsql" user. 
 done

提示用户需要手工删除
root@my-domain:~ # id pgsql
uid=70(pgsql) gid=70(pgsql) groups=70(pgsql)

手工删除用户
root@my-domain:~ # rmuser pgsql
Matching password entry:
pgsql:*:70:70::0:0:PostgreSQL pseudo-user:/usr/local/pgsql:/bin/sh
Is this the entry you wish to remove? yes
Remove user's home directory (/usr/local/pgsql)?    
Remove user's home directory (/usr/local/pgsql)? ys
Remove user's home directory (/usr/local/pgsql)? yes
Removing user (pgsql): mailspool home passwd.
root@my-domain:~ # rm
rm        rmail     rmd160    rmdir     rmextattr rmt       rmuser    
root@my-domain:~ # id pgsql
id: pgsql: no such user

下载软件举例
freebsd默认没有安装wget, 可以使用fetch命令下载软件.
fetch http://ftp.postgresql.org/pub/source/v9.3.4/postgresql-9.3.4.tar.bz2
如果要用wget的话, 可以使用pkg安装wget.

pkg install wget
[参考]

1.  http://blog.163.com/digoal@126/blog/static/163877040201441694022110/
2.  http://en.wikipedia.org/wiki/Non-RAID_drive_architectures
3.  http://www.freebsd.org/
4. ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/amd64/ISO-IMAGES/10.0/FreeBSD-10.0-RELEASE-amd64-dvd1.iso
5.  http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/
6. ftp://ftp.freebsd.org/pub/FreeBSD/doc/en_US.ISO8859-1/books/

FreeBSD install相关推荐

  1. 第 1 章 FreeBSD Install

    1.1. Welcome 回车即可 选择 Install 按钮后回车 选择 No 输入 Hostname 原文出处:Netkiller 系列 手札 本文作者:陈景峯 转载请与作者联系,同时请务必标明文 ...

  2. LINUX 邮件服务器qmail 架设

    BILL'S QMAIL   经过苦苦两个月--qmail终于配置完成,兴奋无比,感谢bill ,一路走来,将日志发布出来与大家共享! Getting Started DNS Before we be ...

  3. Go 学习笔记(37)— 标准命令(go build 跨平台编译、交叉编译、go clean、go run、go fmt、go install、go get)

    1. 标准命令简述 Go 本身包含来大量用于处理 Go 程序的命令和工具. 命令 作用 build 用于编译指定的代码包或 Go 语言源码文件.命令源码文件会被编译成可执行文件,并存放到命令执行的目录 ...

  4. FreeBSD Ports加速的方法

    使用代理. 在/etc/make.conf中设置: FETCH_ENV= "HTTP_PROXY=IP[:端口]" 如果需要,在FETCH_ENV值后面加入空格, HTTP_PRO ...

  5. FreeBSD 6.0架设管理与应用-第三章 UNIX 系统入门

    在开始进阶的 FreeBSD 设定之前,我们先来了解一下 UNIX 系统的架构及基本知识.这些知识对于我们之后管理.使用 FreeBSD 十分重要.如果您是 UNIX 新手,请务必详读本章. 本章将介 ...

  6. 邮件服务器 之 基于FreeBSD和Postfix的邮件系统与邮件列表的web mail安装

    作者: 杨廷勇(scyzxp at toping.net) 来自: LinuxSir.Org 版权:杨廷勇 Copyright © 2004.2005.2006 摘要: 本文介绍使用FreeBSD + ...

  7. 如何在FreeBSD中安装Nginx,MySQL,PHP(FEMP)

    本文介绍如何在FreeBSD 13系统中安装Nginx.MySQL.和PHP服务. 系统环境 FreeBSD 13.0-RELEASE 更新系统 在安装任何软件之前更新系统是一个好习惯,以便检查系统更 ...

  8. 在FreeBSD下安装mysql+apache+php

    转自:[url]http://bbs.chinaunix.net/viewthread.php?tid=389832[/url] 在FreeBSD下安装mysql+apache+php ======= ...

  9. freebsd php mysql_FreeBSD下Mysql5+Apache2+PHP5的安装

    ■ MySQL5 的安装 源代码:mysql-5.0.18.tar.gz 下载地址:http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-5.0.18. ...

最新文章

  1. 很多初接触乐鑫ESP32/ESP8266 模块时,都不清楚怎么为 ESP32、ESP8266 系列模组烧录固件呢?这里以启明云端WT8266-S5(ESP-12F)和ESP32-WROOM模块为例说明
  2. python教程从入门到实践第八章_python:从入门到实践--第八章:函数
  3. 30个最常用css选择器解析(经典)
  4. Ubuntu 1804 桌面版 Eclipse + JSP 学习记录
  5. 传智播客总裁黎活明“传智专修学院成立暨揭牌仪式”演讲实录
  6. 冬奥幕后故事:从低碳火炬到AI裁判,十四年后中国科技再上场
  7. 虚幻4皮肤材质_虚幻引擎4.5版本预览说明
  8. 105.1 巨量引擎相关开发
  9. java中super的三种用法
  10. 【网络问题】微软商店无法打开:重试该操作,无法加载页面。请稍后重试
  11. 大数据专业学校课程安排 (仅供参考)
  12. win10系统cmd窗口设置定时自动关机及取消命令
  13. 一文搞清楚码元速率(波特率)和比特速率(比特率)的区别
  14. 【华为云技术分享】敏捷设计,高效协同,凸显设计端云协同价值
  15. Canvas模拟太阳地球月球的运动过程
  16. python个人所得税怎么写分录_个人所得税的凭证分录怎么写
  17. Java对接高德地图计算距离_高德地图计算两点之间的距离java+html
  18. jquery 获取某个值得键名_jquery中获取元素里某一特定子元素的代码
  19. 微信第三方授权登录之oauth开发
  20. ECNUOJ 2856 仰望星空

热门文章

  1. 一张照片,AI生成抽象画(CLIPasso项目安装使用) | 机器学习
  2. rtmp直播拉流安卓开发
  3. Linux虚拟化之EXSI
  4. 我的世界java版怎么加整合包_我的世界完美世界整合包
  5. 微信业务域名两个解决方法
  6. 下载微信公众号或订阅号的文章封面图片
  7. 【AI简报20220311期】汽车AI芯片竞赛加速、苹果最强芯M1 Ultra登场
  8. WebStorm2018破解(2018年10月9日  16:13实测有效)
  9. 有孚原力超算,为客户提供定制化高性能计算服务
  10. 六度分离 ( floyd )