FreeBSD10.1安装过程

时间:  2015-02-28 21:37
作者:  lsgxeva
分类:  工作学习>>FreeBSD>>server
摘要:  用vmware安装 FreeBSD10.1 系统
标签:  Freebsd 系统 vmware
提示:  文章均来自网络,版权为原作者所有,如有侵犯权益,请联络我们.
一:安装FreeBSD10.1系统
1: 默认选择即可 >> boot multi user(多用户模式)
2: 选择开始安装该系统 >> install
3: 选择默认的键盘设置 >> 直接按enter键即可
4: 配置主机名 >> lsgxbsd
4: 选择安装套件 >> 全部选择
5: 选择分区方式 >> 自动UFS
5: 安装选定的套件
6: 设置Root密码
7: 网络配置
8: 时区配置
9: 系统配置
10: 完成安装
虚拟机拍摄快照 >> start
1:  start
创建新用户
root@lsgxbsd:~ #  adduser 
Username:  lsgx
Full name:  lsgx
Uid (Leave empty for default): 
Login group [lsgx]: 
Login group is lsgx. Invite lsgx into other groups? []: 
Login class [default]: 
Shell (sh csh tcsh nologin) [sh]:  csh
Home directory [/home/lsgx]: 
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   : lsgx
Password   : *****
Full Name  : lsgx
Uid        : 1001
Class      : 
Groups     : lsgx 
Home       : /home/lsgx
Home Mode  : 
Shell      : /bin/csh
Locked     : no
OK? (yes/no):  yes
adduser: INFO: Successfully added (lsgx) to the user database.
Add another user? (yes/no):  no
Goodbye!

root@lsgxbsd :~ #  pw groupmod wheel -m lsgx
root@lsgxbsd :~ #  pw user mod lsgx -g wheel

root@lsgxbsd :~ #  su -l lsgx
lsgx@lsgxbsd:~ %  id
uid=1001(lsgx) gid=0(wheel) groups=0(wheel)
lsgx@lsgxbsd:~ %  exit
logout
root@lsgxbsd:~ # 
root@lsgxbsd:~ #  rmuser 
Please enter one or more usernames:  lsgx
Matching password entry:
lsgx:*:1001:1001::0:0:lsgx:/home/lsgx:/bin/csh
Is this the entry you wish to remove? y
Remove user's home directory (/home/lsgx)? y
Removing user (lsgx): mailspool home passwd.
配置网络
root@lsgxbsd:~ #  bsdinstall
root@lsgxbsd:~ #  bsdconfig
选择 networking management
hostname/domain
network interfaces
default router/gateway
dns nameservers
root@lsgxbsd:~ #  /etc/netstart restart
Setting hostuuid: 564de1d5-90ad-3a49-97ef-b97d0ba7a48b.
Setting hostid: 0xc7b783ff.
Starting Network: lo0 em0.
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
inet6 ::1 prefixlen 128 
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2 
inet 127.0.0.1 netmask 0xff000000 
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
ether 00:0c:29:42:45:34
inet6 fe80::20c:29ff:fe42:4534%em0 prefixlen 64 scopeid 0x1 
inet 192.168.195.137 netmask 0xffffff00 broadcast 192.168.195.255 
nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
media: Ethernet autoselect (1000baseT <full-duplex>)
status: active
route: writing to routing socket: File exists
add net default: gateway 192.168.195.2 fib 0: route already in table
route: writing to routing socket: File exists
add net fe80::: gateway ::1 fib 0: route already in table
route: writing to routing socket: File exists
add net ff02::: gateway ::1 fib 0: route already in table
route: writing to routing socket: File exists
add net ::ffff:0.0.0.0: gateway ::1 fib 0: route already in table
route: writing to routing socket: File exists
add net ::0.0.0.0: gateway ::1 fib 0: route already in table
root@lsgxbsd:~ #  ee /etc/resolv.conf
--------------------------------------
# Generated by resolvconf
# nameserver 192.168.2.1                   
# nameserver fe80::861b:5eff:fe6a:58fe%em0 
nameserver 192.168.195.2                   
nameserver 114.114.114.114                 
nameserver 8.8.8.8                         
search localdomain                         
options edns0
------------------------------------
root@lsgxbsd:~ #  hostname -f
lsgxbsd
root@lsgxbsd:~ #  ee /etc/hosts
----------------------------------------------------------
::1                     localhost localhost.my.domain
127.0.0.1               localhost localhost.my.domain
# Beginning of the block added by the lsgx - DO NOT EDIT
::1 lsgxbsd lsgxbsd.my.domain
127.0.0.1 lsgxbsd lsgxbsd.my.domain
192.168.195.165 lsgxbsd lsgxbsd.my.domain
# End of the block added by the lsgx
----------------------------------------------------------
root@lsgxbsd:~ #  ee /etc/rc.conf
----------------------------------------------------------------
hostname="lsgxbsd"
#ifconfig_em0="DHCP"
ifconfig_em0=" inet 192.168.195.165 netmask 255.255.255.0 "
defaultrouter="192.168.195.2"
ifconfig_em0_ipv6="inet6 accept_rtadv"
local_unbound_enable="YES"
sshd_enable="YES"
moused_enable="YES"
ntpd_enable="YES"
powerd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"
-------------------------------------------------------------------------------------
root@lsgxbsd:~ #  sh /etc/rc 
root@lsgxbsd:~ #  /etc/rc.d/routing restart
root@lsgxbsd:~ #  /etc/rc.d/netif restart
root@lsgxbsd:~ #  /etc/netstart restart
配置NTPD
root@lsgxbsd:~ #  ee /etc/ntp.conf
------------------------------------------------
# Beginning of the block added by the lsgx - DO NOT EDIT
server time.windows.com prefer
server time.nist.gov iburst
server time-nw.nist.gov iburst
server 210.72.145.44 iburst
server 159.226.154.47 iburst
server 127.127.1.0 iburst
fudge 127.127.0.1 stratum 5
restrict default ignore
restrict 127.0.0.0 mask 255.0.0.0
restrict 192.168.195.0 mask 255.255.255.0 noquery nopeer notrust
restrict 210.72.145.44 noquery
restrict 159.226.154.47 noquery
driftfile /var/db/ntpd.drift
# End of the block added by the lsgx
------------------------------------------------
root@lsgxbsd:~ #  /etc/rc.d/ntpd restart
Stopping ntpd.
Waiting for PIDS: 611.
Starting ntpd.
配置SSH
root@lsgxfb:~ #  ee /etc/ssh/ssh_config
----------------------------------------------------
PasswordAuthentication yes
----------------------------------------------------
root@lsgxfb:~ #  ee /etc/ssh/sshd_config
----------------------------------------------------
PermitRootLogin yes
PasswordAuthentication yes

----------------------------------------------------
root@lsgxfb:~ #  ee /etc/rc.conf
----------------------------------------------------
sshd_enable="YES"  
----------------------------------------------------
root@lsgxbsd:~ #  sh /etc/rc 
root@lsgxfb:~ #  /etc/rc.d/sshd restart
ls: /rc.d/sshd: No such file or directory
ls: restart: No such file or directory
root@lsgxfb:~ # /etc/rc.d/sshd restart
Performing sanity check on sshd configuration.
Stopping sshd.
Waiting for PIDS: 882.
Performing sanity check on sshd configuration.
Starting sshd.
root@lsgxfb:~ #  killall -HUP sshd
更新系统
root@lsgxfb:~ #  freebsd-update fetch
root@lsgxfb:~ #  freebsd-update install
root@lsgxfb:~ #  ee ~/.cshrc
----------------------------------------------
# Beginning of the block added by the lsgx - DO NOT EDIT
setenv PACKAGEROOT " ftp://ftp.freebsdchina.org"
#setenv PACKAGEROOT " ftp://ftp.tw.freebsd.org"
#setenv PACKAGESITE " http://mirrors.aliyun.com/freebsd/releases/amd64/9.3-RELEASE/packages/Latest/"
# End of the block added by the lsgx
----------------------------------------------
2、安装Ports源
root@lsgxfb:~ #   portsnap fetch -s portsnap.cn.freebsd.org     #安装ports
root@lsgxfb:~ #   ee /etc/portsnap.conf   #编辑文件
------------------------------------------------------------------------
#SERVERNAME=portsnap.FreeBSD.org
#SERVERNAME=portsnap.tw.FreeBSD.org 
SERVERNAME=portsnap.cn.FreeBSD.org

------------------------------------------------------------------------
root@lsgxfb:~ #   portsnap fetch extract   #连续下载ports快照
root@lsgxfb:~ #   portsnap update  #更新
root@lsgxfb:~ #   portsnap fetch update  #连续更新
root@lsgxfb:~ #  cp /usr/share/examples/etc/make.conf /etc/
root@lsgxfb:~ #  chmod u+w /etc/make.conf 
root@lsgxfb:~ #   ee /etc/make.conf  #编辑文件,添加下面代码
-------------------------------------------------------------------------------------------
# Beginning of the block added by the lsgx - DO NOT EDIT
MASTER_SITE_BACKUP?=\
ftp://ftp.freebsd.org.cn/pub/FreeBSD/ports/distfiles/${DIST_SUBDIR}\
ftp://ftp.freebsdchina.org/pub/FreeBSD/ports/distfiles/${DIST_SUBDIR}\
ftp://ftp.tw.freebsd.org/pub/FreeBSD/ports/distfiles/${DIST_SUBDIR}\

http://mirrors.aliyun.com/freebsd/distfiles/${DIST_SUBDIR}

MASTER_SITE_OVERRIDE?=${MASTER_SITE_BACKUP}
# End of the block added by the lsgx

-------------------------------------------------------------------------------------------
root@lsgxfb:~ #   cd  /usr/ports
root@lsgxfb:~ #   make search name=nginx    #查找ports中是否有nginx这个软件
root@lsgxfb:~ #   cd  /usr/ports/www/nginx   #进入软件包目录
root@lsgxfb:~ #   make install clean    #安装
root@lsgxfb:~ #   make deinstall clean   #卸载
root@lsgxfb:~ #   make deinstall reinstall clean  #升级
root@lsgxbsd:~ #  ee /etc/pkg/FreeBSD.conf
-------------------------------------------------------------------------------------------------
# $FreeBSD: releng/10.1/etc/pkg/FreeBSD.conf 263938 2014-03-30 15:29:54Z bdrewery $
#
# To disable this repository, instead of modifying or removing this file,
# create a /usr/local/etc/pkg/repos/FreeBSD.conf file:
#
#   mkdir -p /usr/local/etc/pkg/repos
#   echo "FreeBSD: { enabled: no }" > /usr/local/etc/pkg/repos/FreeBSD.conf
#
FreeBSD: {
url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest",
mirror_type: "srv",
signature_type: "fingerprints",
fingerprints: "/usr/share/keys/pkg",
enabled: yes
}
-------------------------------------------------------------------------------------
root@lsgxbsd:~ #  cat /usr/local/etc/pkg.conf.sample
----------------------------------------------------------------
# System-wide configuration file for pkg(8)
# For more information on the file format and
# options please refer to the pkg.conf(5) man page
# Note: you don't need to have a pkg.conf file.  Many installations
# will work well with no pkg.conf at all or with an empty pkg.conf
# (other than comment lines).  You can also override any of these
# settings from the environment.
# Configuration options -- default values.
#PKG_DBDIR = "/var/db/pkg";
#PKG_CACHEDIR = "/var/cache/pkg";
#PORTSDIR = "/usr/ports";
#INDEXDIR = "";
#INDEXFILE = "INDEX-10";        # Autogenerated
#HANDLE_RC_SCRIPTS = false;
#ASSUME_ALWAYS_YES = false;
#REPOS_DIR [
#    "/etc/pkg/",
#    "/usr/local/etc/pkg/repos/",
#]
#PLIST_KEYWORDS_DIR = "";
#SYSLOG = true;
#ABI = "freebsd:10:x86:64";     # Autogenerated
#DEVELOPER_MODE = false;
#VULNXML_SITE = "http://www.vuxml.org/freebsd/vuln.xml.bz2";
#FETCH_RETRY = 3;
#PKG_PLUGINS_DIR = "/usr/local/lib/pkg/";
#PKG_ENABLE_PLUGINS = true;
#PLUGINS [
#]
#DEBUG_SCRIPTS = false;
#PLUGINS_CONF_DIR = "/usr/local/etc/pkg/";
#PERMISSIVE = false;
#REPO_AUTOUPDATE = true;
#NAMESERVER = "";
#EVENT_PIPE = "";
#FETCH_TIMEOUT = 30;
#UNSET_TIMESTAMP = false;
#SSH_RESTRICT_DIR = "";
#PKG_ENV {
#}
#PKG_SSH_ARGS = "";
#DEBUG_LEVEL = 0;
#ALIAS {
#}
#CUDF_SOLVER = "";
#SAT_SOLVER = "";
#RUN_SCRIPTS = true;
#CASE_SENSITIVE_MATCH = false;
#IP_VERSION = 0
# Sample alias settings
ALIAS              : {
all-depends: query %dn-%dv,
annotations: info -A,
build-depends: info -qd,
download: fetch,
iinfo: info -ix,
cinfo: info -Cx,
isearch: search -ix,
csearch: search -Cx,
leaf: query -e "%a == 0" "%n-%v",
list: info -ql,
origin: info -qo,
provided-depends: info -qb,
raw: info -R,
required-depends: info -qr,
shared-depends: info -qB,
show: info -f -k,
size: info -sq,
}
-------------------------------------------------------
查找软件包
# pkg search subversion  // 查找软件包
# pkg search -o subversion // 查找软件包并输出路径名
# whereis lsof  // 查找此名称的文件
# make fetchindex  // 更新port索引
# cd /usr/ports // 进入ports目录
# make search name=lsof  //  在port中搜索软件包
# make quicksearch name=lsof // 在port中快速搜索软件包
安装pkg
1: 安装pkg
# cd /usr/ports/ports-mgmt/pkg
# make
# make install clean
2: 转换port
# pkg2ng
3: 设置兼容port
# vi /etc/make.conf
-------------------------
WITH_PKGNG=yes
-------------------------
安装pkg帮助文档并查看文档
# pkg help install
# man pkg-install
# pkg update      // 更新本地pkg数据库
# pkg info pkg     // pkg安装版本信息
# pkg install packagename     // 安装软件包
# pkg info     // 已安装软件列表信息
# pkg delete curl     // 删除指定的软件包
# pkg audit -F     // 查看日志信息
# pkg autoremove     //  删除已经不需要的依赖包
# pkg backup -d pkgng.db       // 备份软件包
# pkg backup -r /path/to/pkgng.db      // 删除备份软件包
# pkg clean     // 清除多余的软件缓存包
# pkg set -o lang/php5:lang/php53       // 修改软件源
# pkg install -Rf graphics/freeglut     // 安装指定的软件源
# pkg install sudo
# pkg install tree
# pkg install vim
# pkg install emacs
# pkg install xterm
# pkg install xorg
# pkg install wqy
# pkg install tmux
# pkg install moc
# pkg install dbus
# pkg install bash
# pkg install bash-completion
# pkg install zsh
# pkg install gcc
# pkg install gmake
# pkg install cgdb
# pkg install cmake
# pkg install racket
# pkg install perl
# pkg install exfat-utils
# pkg install libiconv
# pkg install valgrind
# pkg install ncurses
# pkg install p7zip
# pkg install vsftpd
# pkg install dmidecode
# pkg install smartmontools
gcc编译器的配置
提示:
To ensure binaries built with this toolchain find appropriate versions
of the necessary run-time libraries, you may want to link using
  -Wl,-rpath=/usr/local/lib/gcc49
For ports leveraging USE_GCC, USES=compiler, or USES=fortran this happens
gcc编译链接动态库时,很有可能编译通过,但是执行时,找不到动态链接库,那是
因为-L选项指定的路径只在编译时有效,编译出来的可执行文件不知道-L选项后面的值,
当然找不到。可以用ldd <your_execute>看看是不有 ‘not found’在你链接的库后面,
解决方法是通过-Wl,rpath=<your_lib_dir>,使得execute记住链接库的位置
-----------------------------------------------------------------------------------
root@lsgxbsd:~ #  ln -s /usr/compat /compat
root@lsgxbsd:~ #  ln -s /usr/local/lib/gcc48 /usr/lib/gcc
root@lsgxbsd:~ #  ln -s /usr/local/bin/g++48 /usr/bin/g++
设置软链接
lrwxr-xr-x   1 root  wheel    20B  4 28 13:21 /usr/bin/g++ -> /usr/local/bin/g++48
lrwxr-xr-x   1 root  wheel    30B  4 28 13:22 /usr/bin/gappletviewer -> /usr/local/bin/gappletviewer48
lrwxr-xr-x   1 root  wheel    27B  4 28 13:22 /usr/bin/gc-analyze -> /usr/local/bin/gc-analyze48
lrwxr-xr-x   1 root  wheel    20B  4 28 13:23 /usr/bin/gcc -> /usr/local/bin/gcc48
lrwxr-xr-x   1 root  wheel    23B  4 28 13:22 /usr/bin/gcc-ar -> /usr/local/bin/gcc-ar48
lrwxr-xr-x   1 root  wheel    23B  4 28 13:23 /usr/bin/gcc-nm -> /usr/local/bin/gcc-nm48
lrwxr-xr-x   1 root  wheel    27B  4 28 13:23 /usr/bin/gcc-ranlib -> /usr/local/bin/gcc-ranlib48
lrwxr-xr-x   1 root  wheel    20B  4 28 13:24 /usr/bin/gcj -> /usr/local/bin/gcj48
lrwxr-xr-x   1 root  wheel    27B  4 28 13:24 /usr/bin/gcj-dbtool -> /usr/local/bin/gcj-dbtool48
lrwxr-xr-x   1 root  wheel    21B  4 28 13:24 /usr/bin/gcjh -> /usr/local/bin/gcjh48
lrwxr-xr-x   1 root  wheel    21B  4 28 13:24 /usr/bin/gcov -> /usr/local/bin/gcov48
lrwxr-xr-x   1 root  wheel    25B  4 28 13:25 /usr/bin/gfortran -> /usr/local/bin/gfortran48
lrwxr-xr-x   1 root  wheel    20B  4 28 13:25 /usr/bin/gij -> /usr/local/bin/gij48
lrwxr-xr-x   1 root  wheel    21B  4 28 13:26 /usr/bin/gjar -> /usr/local/bin/gjar48
lrwxr-xr-x   1 root  wheel    27B  4 28 13:27 /usr/bin/gjarsigner -> /usr/local/bin/gjarsigner48
lrwxr-xr-x   1 root  wheel    23B  4 28 13:27 /usr/bin/gjavah -> /usr/local/bin/gjavah48
lrwxr-xr-x   1 root  wheel    25B  4 28 13:27 /usr/bin/gkeytool -> /usr/local/bin/gkeytool48
lrwxr-xr-x   1 root  wheel    30B  4 28 13:28 /usr/bin/gnative2ascii -> /usr/local/bin/gnative2ascii48
lrwxr-xr-x   1 root  wheel    22B  4 28 13:28 /usr/bin/gorbd -> /usr/local/bin/gorbd48
lrwxr-xr-x   1 root  wheel    22B  4 28 13:28 /usr/bin/grmic -> /usr/local/bin/grmic48
lrwxr-xr-x   1 root  wheel    22B  4 28 13:29 /usr/bin/grmid -> /usr/local/bin/grmid48
lrwxr-xr-x   1 root  wheel    29B  4 28 13:29 /usr/bin/grmiregistry -> /usr/local/bin/grmiregistry48
lrwxr-xr-x   1 root  wheel    27B  4 28 13:29 /usr/bin/gserialver -> /usr/local/bin/gserialver48
lrwxr-xr-x   1 root  wheel    27B  4 28 13:30 /usr/bin/gtnameserv -> /usr/local/bin/gtnameserv48
-----------------------------------------------------------------------------------
root@lsgxbsd:/usr/ports #  cd /usr/ports/
root@lsgxbsd:/usr/ports #  make search key=hald
root@lsgxbsd:/usr/ports #  cd /usr/ports/devel/memcheck
root@lsgxbsd:/usr/ports/devel/memcheck #  make install clean
root@lsgxbsd:~ #  vi /etc/rc.conf
root@lsgxbsd:~ #  cat /etc/rc.conf
----------------------------------------------------------
hostname="lsgxbsd"
#ifconfig_em0="DHCP"
ifconfig_em0="inet 192.168.195.165 netmask 255.255.255.0"
defaultrouter="192.168.195.2"
ifconfig_em0_ipv6="inet6 accept_rtadv"
local_unbound_enable="YES"
sshd_enable="YES"
moused_enable="YES"
ntpd_enable="YES"
powerd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"
# Beginning of the block added by the lsgx - DO NOT EDIT
hald_enable="YES" 
dbus_enable="YES" 
# End of the block added by the lsgx
--------------------------------------------------------------------
root@lsgxbsd:~ #  sh /etc/rc 
root@lsgxbsd:~ #  vi /usr/local/etc/sudoers
root@lsgxbsd:~ #  cat /usr/local/etc/sudoers
--------------------------------------------------------------
##
## User privilege specification
##
root ALL=(ALL) ALL
lsgx ALL=(ALL) ALL
-------------------------------------------------------
root@lsgxbsd:~ #   Xorg -configure
root@lsgxbsd:~ #  vi  xorg.conf.new
------------------------------------------------
Section "Files"
ModulePath   "/usr/local/lib/xorg/modules"
FontPath     "/usr/local/share/fonts/misc/"
FontPath     "/usr/local/share/fonts/TTF/"
FontPath     "/usr/local/share/fonts/OTF/"
FontPath     "/usr/local/share/fonts/Type1/"
FontPath     "/usr/local/share/fonts/100dpi/"
FontPath     "/usr/local/share/fonts/75dpi/"
FontPath     "/usr/local/share/fonts/wqy/"
EndSection

      # 添加文泉驿字体库路径

Section "Monitor"
Identifier "Monitor0"
VendorName "Monitor Vendor"
ModelName "Monitor Model"
HorizSync 30-107
               VertRefresh 48-120
               Option "DPMS"
EndSection
# 在其中加入 HorizSync(水平刷新率)、VertRefresh(垂直刷新率)和 Option(启用能源之星)三项。
Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
 DefaultDepth 24
SubSection "Display"
Viewport 0 0
Depth 24
Modes "1024x768"
EndSubSection
EndSection
# 在其中加入DefaultDepth(缺省颜色深度) 和 Modes(分辨率)。注意,这里你看到有多个SubSection向,不用理会,FreeBSD会自动根据DefaultDepth指定的值去找对应的SubSection项。
# 注意:有一个图形工具xorgcfg,通过它可以选择合适的驱动和设置交互式地定义配置。这个程序可以从控制台通过命名xorgcfg -textmode来直接启动。

------------------------------------------------
root@lsgxbsd:~ #   vi ~/.tmux.conf
-------------------------------------------------------------
#
# author   : lsgx <lsgxthink@gmail.com>
# modified : 2014-11-12
#
#-- base settings --#
set -g default-terminal "screen-256color"  # 设置终端缺省的支持颜色为256色
set -g display-time 3000     # 提示信息的持续时间;设置足够的时间以避免看不清提示,单位为毫秒
set -g escape-time 0    # 等待时间的持续时间;设置越小越好
set -g history-limit 65535    # 历史记录条数的最大限制值
#set -g base-index 1    # 窗口的初始序号;默认为0,这里设置为1
#set -g pane-base-index 1    # 面板的初始序号;默认为0,这里设置为1
#set -sg repeat-time 600    # 控制台激活后的持续时间;设置合适的时间以避免每次操作都要先激活控制台,单位为毫秒
#set -s quiet on
#setw -g xterm-keys on
#-- bindkeys --#
# prefix key (Ctrl+a)    # 将激活控制台的快捷键由Ctrl+b修改为Ctrl+a
set -g prefix ^a
unbind ^b
bind a send-prefix
# split window    # 窗口分割
unbind '"'
bind - splitw -v # vertical split (prefix -)    # 上下分割窗口
unbind %
bind | splitw -h # horizontal split (prefix |)    # 左右分割窗口
# select pane    # 选择面板
bind k selectp -U # above (prefix k)    # 选择上面板
bind j selectp -D # below (prefix j)    # 选择下面板
bind h selectp -L # left (prefix h)    # 选择左面板
bind l selectp -R # right (prefix l)    # 选择右面板
# resize pane
bind -r ^k resizep -U 2 # upward (prefix Ctrl+k)    # 当前面板上移2
bind -r ^j resizep -D 2 # downward (prefix Ctrl+j)    # 当前面板下移2
bind -r ^h resizep -L 2 # to the left (prefix Ctrl+h)    # 当前面板左移2
bind -r ^l resizep -R 2 # to the right (prefix Ctrl+l)    # 当前面板右移2
# swap pane
bind ^u swapp -U # swap with the previous pane (prefix Ctrl+u)    # 与上面板交换
bind ^d swapp -D # swap with the next pane (prefix Ctrl+d)    # 与下面板交换
# create new session
bind C-c new-session    # 创建一个新的会话
# control sessions
bind z kill-session    # 结束当前会话
# find session
bind C-f command-prompt -p find-session 'switch-client -t %%'    # 查找会话
# clear both screen and history
#bind -n C-l send-keys C-l \; run 'tmux clear-history'    # 清空屏幕内容和历史记录
# reload config (prefix r)
bind r source ~/.tmux.conf \; display "Configuration reloaded!"    # 重新加载配置文件
# misc
bind e lastp  # select the last pane (prefix e)    # 选择最后一个面板
bind ^e last  # select the last window (prefix Ctrl+e)    # 选择最后一个窗口
bind q killp  # kill pane (prefix q)    # 关闭当前面板
bind ^q killw # kill window (prefix Ctrl+q)    # 关闭当前窗口
# app
bind ! splitw htop                                     # htop (prefix !)
bind m command-prompt "splitw 'exec man %%'"           # man (prefix m)
bind @ command-prompt "splitw 'exec perldoc -t -f %%'" # perl func (prefix @)
bind * command-prompt "splitw 'exec perldoc -t -v %%'" # perl var (prefix *)
bind % command-prompt "splitw 'exec perldoc -t %%'"    # perl doc (prefix %)
bind / command-prompt "splitw 'exec ri %%'"            # ruby doc (prefix /)
#-- statusbar --#
set -g status-utf8 on    # 开启状态栏的UTF-8支持
set -g status-interval 1    # 状态栏的分辨时间间隔
set -g status-keys vi    # 操作状态栏时的默认键盘布局;可以设置为vi或emacs
set -g visual-activity on    # 开启窗口操作的可视
set -g set-clipboard on    # 开启剪切板
set -g display-panes-time 800 # slightly longer pane indicators display time    # 稍长的窗格中显示的时间指标
set -g display-time 1000      # slightly longer status messages display time    # 稍长的状态消息的显示时间
set -g renumber-windows on    # renumber windows when a window is closed    # 关闭窗口后重新编号
setw -g automatic-rename on    # rename window to reflect current program    # 重命名窗口,以反映当前的程序
setw -g utf8 on    # 开启窗口的UTF-8支持
setw -g monitor-activity on    # 开启窗口活动监视
setw -g mode-keys vi    # 复制模式中的默认键盘布局;可以设置为vi或emacs
setw -g clock-mode-style 24 # 24 hour clock    # 24小时显示方式
#setw -g mode-mouse on    # 开启鼠标模式
# copy mode
bind Enter copy-mode # enter copy mode    # 按Enter进入复制模式
bind b list-buffers  # list paster buffers    # 复制缓冲区列表
bind p paste-buffer  # paste from the top pate buffer    # 粘贴最后复制的缓冲区内容
bind P choose-buffer # choose which buffer to paste from    # 选择粘贴缓冲区
# the following vi-copy bindings match my vim settings
# see https://github.com/gpakosz/.vim.git
bind -t vi-copy v begin-selection    # 复制模式下开始选取
bind -t vi-copy C-v rectangle-toggle    # 复制模式下矩形选取
bind -t vi-copy y copy-selection    # 复制模式下复制选取的内容
bind -t vi-copy Escape cancel    # 复制模式下退出复制模式
bind -t vi-copy H start-of-line    # 复制模式下开始行选取
bind -t vi-copy L end-of-line    # 复制模式下结束行选取
# mouse resize selcet
#setw -g mouse-resize-pane on    # 鼠标调整面板大小
#setw -g mouse-select-pane on    # 鼠标选择面板
#setw -g mouse-select-window on    # 鼠标选择窗口
# move x clipboard into tmux paste buffer
bind C-p run "tmux set-buffer \"$(xclip -o -sel clipbaord)\"; tmux paste-buffer" 
# move tmux copy buffer into x clipboard
bind C-y run "tmux show-buffer | xclip -i -sel clipbaord"
#-- colorscheme --#
# see also: https://github.com/daethorian/conf-tmux/blob/master/colors/zenburn.conf
# modes
setw -g clock-mode-colour colour223
setw -g mode-attr bold
setw -g mode-fg colour223
setw -g mode-bg colour235
# panes
set -g pane-border-bg colour234
set -g pane-border-fg colour234
set -g pane-active-border-bg colour232
set -g pane-active-border-fg colour232
# statusbar
set -g status-justify centre
set -g status-bg colour235
set -g status-fg colour248
set -g status-attr dim
set -g status-left "#[fg=green,bright]Session: #S #[fg=yellow,bright]Window: #I #[fg=cyan,bright]Pane: #P"
set -g status-left-attr bright
set -g status-left-length 30
set -g status-right "#[fg=yellow,bright][ #[fg=cyan,bright]#W #[fg=yellow,bright]]#[default] #[fg=yellow,bright]- %Y.%m.%d #[fg=green,bright]%H:%M #[default]"
set -g status-right-attr bright
set-option -g status-right-length 30
setw -g window-status-current-fg colour223
setw -g window-status-current-bg colour237
setw -g window-status-current-attr bold
#setw -g window-status-current-format "#I:#W#F"
#setw -g window-status-alert-attr bold
#setw -g window-status-alert-fg colour255
#setw -g window-status-alert-bg colour160
# messages
set -g message-attr bold
set -g message-fg colour223
set -g message-bg colour235

--------------------------------------------------------------------

root@lsgxbsd:~ #  chmod u+ws /usr/local/bin/xterm 
root@lsgxbsd:~ #  ls -alh /usr/local/bin/xterm
-rwsr-xr-x  1 root  wheel   525K  4  9 00:55 /usr/local/bin/xterm

root@lsgxbsd:~ #  vi ~/.Xresources 
root@lsgxbsd:~ #  cat ~/.Xresources 
----------------------------------------------------------
!------------------------------------------ 
! XTerm 
!------------------------------------------ 
XTerm*termName:                 xterm-color 
XTerm*visualBell:               false 
XTerm*marginBell:               false 
XTerm*alwaysHighlight:          false 
XTerm*cursorBlink:              true 
XTerm*cursorOffTime:            450 
XTerm*cursorOnTime:             900 
XTerm*highlightSelection:       true 
XTerm*saveLines:                8192 
XTerm*foreground:               rgb:a8/a8/a8 
XTerm*background:               rgb:00/00/00 
XTerm*color0:                   rgb:00/00/00 
XTerm*color1:                   rgb:a8/00/00 
XTerm*color2:                   rgb:00/a8/00 
XTerm*color3:                   rgb:a8/54/00 
XTerm*color4:                   rgb:00/00/a8 
XTerm*color5:                   rgb:a8/00/a8 
XTerm*color6:                   rgb:00/a8/a8 
XTerm*color7:                   rgb:a8/a8/a8 
XTerm*color8:                   rgb:54/54/54 
XTerm*color9:                   rgb:fc/54/54 
XTerm*color10:                  rgb:54/fc/54 
XTerm*color11:                  rgb:fc/fc/54 
XTerm*color12:                  rgb:54/54/fc 
XTerm*color13:                  rgb:fc/54/fc 
XTerm*color14:                  rgb:54/fc/fc 
XTerm*color15:                  rgb:fc/fc/fc 
XTerm*scrollBar:                true 
XTerm*rightScrollBar:           true 
XTerm*scrollKey:                false 
XTerm*scrollTtyOutput:          false 
XTerm*loginShell:               false 
XTerm*locale:                   true 
XTerm*eightBitInput:            false 
XTerm*eightBitOutput:           true 
XTerm*metaSendEscape:           true 
XTerm*faceName:                 Bitstream Vera Sans Mono 
XTerm*faceSize:                 14 
XTerm*faceNameDoublesize:       WenQuanYi Bitmap Song 
XTerm*mkWidth:                  false 
XTerm*charClass: 33:48,36-47:48,58-59:48,61:48,63-64:48,95:48,126:48
----------------------------------------------------------------------------

root@lsgxbsd:~ #  xrdb ~/.Xresources 
root@lsgxbsd:~ #   Xorg -config xorg.conf.new
root@lsgxbsd:~ #  cp xorg.conf.new /etc/X11/xorg.conf
root@lsgxbsd:~ #  startx
root@lsgxbsd:~ #  vi /etc/rc.conf
root@lsgxbsd:~ #  cat /etc/rc.conf
----------------------------------------------------------------------
# Beginning of the block added by the lsgx - DO NOT EDIT
# kldunload linux 
# options COMPAT_LINUX 
linux_enable="YES"

# End of the block added by the lsgx
-------------------------------------------------------------

root@lsgxbsd:~ #  sh /etc/rc 
root@lsgxbsd:~ #  echo "linproc /compat/linux/proc linprocfs rw,late 0 0" >> /etc/fstab 
root@lsgxbsd:~ #  mkdir -p /usr/compat/linux/proc
root@lsgxbsd:~ #  ln -s /usr/compat /compat
root@lsgxbsd:~ #  vi /etc/fstab 
root@lsgxbsd:~ #  cat /etc/fstab 
--------------------------------------------------------------------------
# Device Mountpoint FStype Options Dump Pass#
/dev/da0p2 / ufs rw 1 1
/dev/da0p3 none swap sw 0 0
linproc /compat/linux/proc linprocfs rw 0 0
proc /proc procfs rw 0 0
#localhost:/ /mnt/nfs nfs rw,rsize=1024,wsize=1024 0 0#

--------------------------------------------------------------------------
root@lsgxbsd:~ #  mount linproc
root@lsgxbsd:~ #  mount -a
root@lsgxbsd:~ #  pkg install htop
root@lsgxbsd:~ #  htop
root@lsgxbsd:~ #  pkg install iftop
root@lsgxbsd:~ #  iftop -i em0 -pP
root@lsgxbsd:~ #  pkg install vnstat
root@lsgxbsd:~ #  mkdir -p /var/lib/vnstat
root@lsgxbsd:~ #  vnstat -i em0 --create
root@lsgxbsd:~ #  vi ~/.cshrc
root@lsgxbsd:~ #  cat ~/.cshrc
------------------------------------------
alias vi    vim
------------------------------------------
设置屏保和分辨率
root@lsgxbsd:~ #  vi /boot/loader.conf
root@lsgxbsd:~ #  cat /boot/loader.conf
--------------------------------------------------------------------
# Beginning of the block added by the VMware software - DO NOT EDIT
vmxnet_load="YES"
# End of the block added by the VMware software
# Beginning of the block added by the VMware software - DO NOT EDIT
vmxnet3_load="YES"
# End of the block added by the VMware software
# Beginning of the block added by the lsgx - DO NOT EDIT
splash_bmp_load="YES"
splash_pcx_load="NO"
vesa_load="YES"
daemon_saver_load="YES"
#bitmap_load="YES"
#bitmap_name="/boot/daemon.bmp"
#bitmap_type="splash_image_data"
# End of the block added by the lsgx

------------------------------------------------------
root@lsgxbsd:~ #  vidcontrol -i mode | grep G
root@lsgxbsd:~ #  vi /etc/rc.conf
root@lsgxbsd:~ #  cat /etc/rc.conf
----------------------------------------------------------------------
# Beginning of the block added by the lsgx - DO NOT EDIT
hald_enable="YES" 
dbus_enable="YES" 
allscreens_flags="MODE_332"
blanktime="10"
saver="YES"
# End of the block added by the lsgx
-------------------------------------------------------------
root@lsgxbsd:~ #  sh /etc/rc 
关闭虚拟机,更改配置文件
-----------------------------------------
mks.enable3d = "TRUE"
svga.autodetect = "FALSE"
svga.maxWidth = "1366"
svga.maxHeight = "768"
svga.vramSize = "134217728"
----------------------------------------
本地化
root@lsgxbsd:~ #  locale
LANG=
LC_CTYPE="C"
LC_COLLATE="C"
LC_TIME="C"
LC_NUMERIC="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_ALL=
root@lsgxbsd:~ #  vi ~/.cshrc
root@lsgxbsd:~ #  cat ~/.cshrc
---------------------------------------------------------
# Beginning of the block added by the lsgx - DO NOT EDIT
setenv PACKAGEROOT "ftp://ftp.freebsdchina.org"
#setenv PACKAGEROOT "ftp://ftp.tw.freebsd.org"
#setenv PACKAGESITE "http://mirrors.aliyun.com/freebsd/releases/amd64/9.3-RELEASE/packages/Latest/"
setenv LANG         zh_CN.UTF-8
setenv LC_CTYPE     zh_CN.UTF-8
setenv LC_ALL       zh_CN.UTF-8 
# End of the block added by the lsgx
---------------------------------------------
root@lsgxbsd:~ #  locale
LANG=zh_CN.UTF-8
LC_CTYPE="zh_CN.UTF-8"
LC_COLLATE="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_NUMERIC="zh_CN.UTF-8"
LC_MONETARY="zh_CN.UTF-8"
LC_MESSAGES="zh_CN.UTF-8"
LC_ALL=zh_CN.UTF-8
安装vmtools
需要先安装 perl和 compat6x
root@lsgxbsd:~ #  cd /usr/ports/misc/compat6x/
root@lsgxbsd:/usr/ports/misc/compat6x #  make install clean
root@lsgxbsd:~ #  df -h
Filesystem    Size    Used   Avail Capacity  Mounted on
/dev/da0p2     55G    5.0G     46G    10%    /
devfs         1.0K    1.0K      0B   100%    /dev
linprocfs     4.0K    4.0K      0B   100%    /usr/compat/linux/proc
root@lsgxbsd:~ #  ls -alh /dev/ | grep cd
crw-r-----   1 root  operator   0x5a  4 16 10:33 cd0
root@lsgxbsd:~/work/vmtools #  mkdir -p ~/work/vmtools
root@lsgxbsd:~ #  mount_cd9660  /dev/cd0 /mnt/
root@lsgxbsd:~ #  cp /mnt/vmware-freebsd-tools.tar.gz ~/work/vmtools/
root@lsgxbsd:~ #  umount /mnt/
root@lsgxbsd:~/work/vmtools #  tar -zxvf vmware-freebsd-tools.tar.gz 
root@lsgxbsd:~/work/vmtools #  cd vmware-tools-distrib/
root@lsgxbsd:~/work/vmtools/vmware-tools-distrib #  ./vmware-install.pl 
------------------------------------------------------------------------------
Creating a new VMware Tools installer database using the tar4 format.
Installing VMware Tools.
In which directory do you want to install the binary files? 
[/usr/local/bin] 
In which directory do you want to install the startup script? 
[/usr/local/etc/rc.d] 
In which directory do you want to install the daemon files? 
[/usr/local/sbin] 
In which directory do you want to install the library files? 
[/usr/local/lib/vmware-tools] 
The path "/usr/local/lib/vmware-tools" does not exist currently. This program 
is going to create it, including needed parent directories. Is this what you 
want? [yes] 
In which directory do you want to install the documentation files? 
[/usr/local/share/doc/vmware-tools] 
The path "/usr/local/share/doc/vmware-tools" does not exist currently. This 
program is going to create it, including needed parent directories. Is this 
what you want? [yes] 
The installation of VMware Tools 9.6.2 build-1688356 for FreeBSD completed 
successfully. You can decide to remove this software from your system at any 
time by invoking the following command: 
"/usr/local/bin/vmware-uninstall-tools.pl".
Before running VMware Tools for the first time, you need to configure it by 
invoking the following command: "/usr/local/bin/vmware-config-tools.pl". Do you
want this program to invoke the command for you now? [yes] 
Initializing...
Making sure services for VMware Tools are stopped.
Stopping VMware Tools services in the virtual machine:
Guest operating system daemon:                                      done
The vmblock enables dragging or copying files between host and guest in a 
Fusion or Workstation virtual environment.  Do you wish to enable this feature?
[yes] 
vmblock is not supported for FreeBSD 9.1 and above.
Detected X server version 1.14.7
Distribution provided drivers for Xorg X server are used.
Skipping X configuration because X drivers are not included.
Starting VMware Tools services in the virtual machine:
Switching to guest configuration:                                   done
Guest memory manager:                                              failed
Guest operating system daemon:                                      done
Unable to start services for VMware Tools
Execution aborted.
-----------------------------------------------------------------------
root@lsgxbsd:~/work/vmtools/vmware-tools-distrib #  reboot
root@lsgxbsd:~ #  kldstat 
Id Refs Address            Size     Name
1   21 0xffffffff80200000 1755658  kernel
2    1 0xffffffff81956000 3b00     splash_bmp.ko
3    1 0xffffffff8195a000 b580     vesa.ko
5    1 0xffffffff81a11000 9d37     linprocfs.ko
6    1 0xffffffff81a1b000 43bce    linux.ko
7    1 0xffffffff81a5f000 2b58     uhid.ko
ftp://ftp.freebsd.org/pub/FreeBSD/doc/
ftp://ftp.FreeBSD.org/pub/FreeBSD/releases/
http://www.freebsd.org/doc/zh_CN/books/handbook/
https://www.freebsdchina.org/
https://wiki.freebsdchina.org/
samba的配置
root@lsgxbsd:~ #  pkg install libiconv
root@lsgxbsd:~ #  pkg install samba41
root@lsgxbsd:~ #  vi /etc/rc.conf
---------------------------------------
#inetd_enable="YES"
#samba_enable="YES"
samba_server_enable="YES"
nmbd_enable="YES"
smbd_enable="YES"
winbindd_enable="YES"
------------------------------------------
root@lsgxbsd:~ #  sh /etc/rc 
root@lsgxbsd:~ #  vi /etc/inetd.conf 
-------------------------------------------------
netbios-ssn stream tcp nowait root /usr/local/sbin/smbd smbd
netbios-ns dgram udp wait root /usr/local/sbin/nmbd nmbd
swat stream tcp nowait/400 root /usr/local/sbin/swat swat
--------------------------------------------------
root@lsgxbsd:~ #  vi /usr/local/etc/smb4.conf 
------------------------------------------------------
[global]
netbios name = freebsd
workgroup = WORKGROUP
server string = SambaShare
security = user
# hosts allow = 192.168.195. 127.
log file = /var/log/samba/log.%m
max log size = 1000
passdb backend = tdbsam
[SambaShare]
comment = SambaShare
browseable = yes
path = /
# path = /home
# valid users = @root
public = yes
available = yes
guest ok = no
writable = yes
read only = no
directory mask = 0775
create mask = 0664
------------------------------------------------------
重新启动inetd和samba
root@ lsgxbsd:~ #  killall -HUP inetd
root@lsgxbsd:~ #    cd /usr/local/etc/rc.d
root@lsgxbsd:~ #    ./samba_server restart
设置完成之后在windows中,通过\\freebsd\share访问就可以了,OK :-)
nfs的配置
root@lsgxbsd:~ #   pkg install rpc2
root@lsgxbsd:~ #  pkg install libnfs
root@lsgxbsd:~ #  pkg install unfs3
root@lsgxbsd:~ #  vi /etc/rc.conf
--------------------------------------------------
# nfs server setting
rpcbind_enable="YES"
rpc_statd_enable="YES"
rpc_lockd_enable="YES"
nfs_server_enable="YES"
nfs_server_flags="-u -t -n 4"
mountd_flags="-r"

# nfs client setting
nfs_client_enable="YES" 
nfs_client_flags="-n 4" 

----------------------------------------------
root@lsgxbsd:~ #  sh /etc/rc 
root@lsgxbsd:~ #  vi /etc/exports
--------------------------------------
/ -maproot=0 localhost 192.168.195.165 192.168.195.155 192.168.195.145 192.168.195.135 192.168.195.125 192.168.195.115 192.168.195.105 192.168.195.2 192.168.195.1
--------------------------------------
重新加载export配置文件:
root@lsgxbsd:~ #  killall -HUP mountd  或者   root@lsgxbsd:~ #  /etc/rc.d/mountd onereload   或者   root@lsgxbsd:~ #  kill -HUP `cat /var/run/mountd.pid`
nfs服务器端运行:
root@lsgxbsd:~ #  /etc/rc.d/rpcbind restart
root@lsgxbsd:~ #   nfsd -u -t -n 4 
root@lsgxbsd:~ #  mountd -r
//查看当前共享的目录 
root@lsgxbsd:~ #  showmount -e 192.168.195.165
nfs客户端运行:
root@lsgxbsd:~ #  nfsiod -n 4
nfs加锁服务支持:(一般不使用)
root@lsgxbsd:~ #  /etc/rc.d/lockd restart
root@lsgxbsd:~ #  /etc/rc.d/statd restart

创建一般挂载的路径文件夹
root@lsgxbsd:~ #  mkdir /mnt/nfs
root@lsgxbsd:~ #  mkdir /mnt/image
手动挂载nfs文件夹目录
root@lsgxbsd:~ #  mount -t nfs -o wsize=1024,rsize=1024 192.168.195.165:/ /mnt/nfs/
root@lsgxbsd:~ #  df -h
root@lsgxbsd:~ #  ls -alh /mnt/nfs/
root@lsgxbsd:~ #  umount /mnt/nfs/
开机自动挂载nfs文件夹目录:
root@lsgxbsd:~ #  vi /etc/fstab
----------------------------------------------
# Device Mountpoint FStype Options Dump Pass#
/dev/da0p2 / ufs rw 1 1
/dev/da0p3 none swap sw 0 0
linproc /compat/linux/proc linprocfs rw 0 0
#localhost:/ /mnt/nfs nfs rw,rsize=1024,wsize=1024 0 0#
----------------------------------------------
配置/etc/rc.conf
root@lsgxbsd:/mnt #  cat /etc/rc.conf
--------------------------------------------------------------
hostname="lsgxbsd"
keymap="us.iso"
#ifconfig_em0="DHCP"
ifconfig_em0="inet 192.168.195.165 netmask 255.255.255.0"
defaultrouter="192.168.195.2"
ifconfig_em0_ipv6="inet6 accept_rtadv"
local_unbound_enable="YES"
sshd_enable="YES"
moused_enable="YES"
ntpd_enable="YES"
powerd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"
# Beginning of the block added by the lsgx - DO NOT EDIT
hald_enable="YES" 
dbus_enable="YES" 
allscreens_flags="MODE_332"
blanktime="10"
saver="YES"
# kldunload linux 
# options COMPAT_LINUX 
linux_enable="YES"

#inetd_enable="YES"
#ipfilter_enable="YES"
#ipfilter_rules="/etc/ipf.conf"
#ipmon_enable="YES"
#ipmon_flags="-Ds"
#ipnat_enable="YES"
#ipnat_rules="/etc/ipnat.rules"
#samba_enable="YES"
samba_server_enable="YES"
nmbd_enable="YES"
smbd_enable="YES"
winbindd_enable="YES"
# nfs server setting
rpcbind_enable="YES"
rpc_statd_enable="YES"
rpc_lockd_enable="YES"
nfs_server_enable="YES"
nfs_server_flags="-u -t -n 4"
mountd_enable="YES"
mountd_flags="-r"
# nfs client setting
nfs_client_enable="YES" 
nfs_client_flags="-n 4" 
# End of the block added by the lsgx
------------------------------------------------------
root@lsgxbsd:~ #  sh /etc/rc 
FreeBSD基本目录结构简要说明
/ 文件系统的根目录。
/bin/ 在单个用户和多用户环境下的基本工具目录。
/boot/ 在操作系统在启动加载期间所用的程序和配置。
/boot/defaults/ 默认每步引导启动的配置内容,请查阅loader.conf(5)。
/dev/ 设备节点,请查阅 intro(4)。
/etc/ 系统启动的配置和脚本。
/etc/defaults/ 系统默认的启动配置和脚本,请参考 rc(8) 。
/etc/mail/ 关系到邮件系统运作的配置, 请参考 sendmail(8)。
/etc/namedb/ named 配置文件,请参考 named(8)。
/etc/periodic/ 每天、每星期和每月周期性地运行的脚本, 请通过 cron(8)查阅periodic(8)。
/etc/ppp/ ppp配置文件,请查阅ppp(8)。
/mnt/ 由管理员习惯使用挂接点的临时空目录。
/proc/ 运行中的文件系统,请参阅 procfs(5) 和 mount_procfs(8)。
/rescue/ 用于紧急恢复的一组静态联编的程序; 参见 rescue(8)。
/root/ root用户的Home(主)目录。
/sbin/ 在单个用户和多用户环境下的存放系统程序和管理所需的基本实用目录。
/tmp/ 临时文件。 /tmp 目录中的内容, 一般不会在系统重新启动之后保留。 通常会将基于内存的文件系统挂在 /tmp 上。 这一工作可以用一系列 tmpmfs 相关的 rc.conf(5) 变量来自动完成。 (或者, 也可以在 /etc/fstab 增加对应项; 参见 mdmfs(8))。
/usr/ 存放大多数用户的应用软件。
/usr/bin/ 存放实用命令,程序设计工具,和应用软件。
/usr/include/ 存放标准 C include 文件.
/usr/lib/ 存放库文件。
/usr/libdata/ 存放各种实用工具的数据文件。
/usr/libexec/ 存放系统实用或后台程序 (从另外的程序启动执行)。
/usr/local/ 存放本地执行文件, 库文件等等, 同时也是 FreeBSD ports 安装的默认安装目录。 /usr/local 在 /usr 中的目录布局大体相同, 请查阅 hier(7)。 但 man 目录例外, 它们是直接放在/usr/local 而不是 /usr/local/share 下的, 而 ports 说明文档在share/doc/port。
/usr/obj/ 通过联编 /usr/src 得到的目标文件。
/usr/ports/ 存放 FreeBSD 的 Ports Collection (可选)。
/usr/sbin/ 存放系统后台程序 和 系统工具 (由用户执行)。
/usr/share/ 存放架构独立的文件。
/usr/src/ 存放 BSD 或者本地源码文件。
/usr/X11R6/ 存放 X11R6 可执行文件、 库文件、 配置文件等的目录(可选)。
/var/ 多用途日志、 临时或短期存放的, 以及打印假脱机系统文件。 有时会将基于内存的文件系统挂在 /var 上。 这一工作可以通过在rc.conf(5) 中设置一系列 varmfs 变量 (或在 /etc/fstab 中加入一行配置; 参见 mdmfs(8)) 来完成。
/var/log/ 存放各种的系统记录文件。
/var/mail/ 存放用户mailbox(一种邮件存放格式)文件。
/var/spool/ 各种打印机和邮件系统spooling(回环)的目录。
/var/tmp/ 临时文件。 这些文件在系统重新启动时通常会保留, 除非 /var是一个内存中的文件系统。
/var/yp/ NIS 映射。
FreeBSD /etc/rc.conf文件语法错误导致系统变为readonly
输入以下命令
fsck -y
mount -u /
mount -a -t ufs
swapon -a
就可以编辑了

全局ls高亮设置
root@lsgxbsd:~ #  cat /etc/csh.cshrc
-------------------------------------------------------------------------------------
# $FreeBSD: releng/10.1/etc/csh.cshrc 50472 1999-08-27 23:37:10Z peter $
#
# System-wide .cshrc file for csh(1).
# Beginning of the block added by the lsgx - DO NOT EDIT
setenv LSCOLORS ExGxFxdxCxegedabagExEx
setenv CLICOLOR yes
setenv GREP_OPTIONS --color=auto
# End of the block added by the lsgx
-------------------------------------------------------------------------------------------
root@lsgxbsd:~ #  source /etc/csh.cshrc
bash的设置
root@lsgxbsd:~ #  ln -s /usr/local/bin/bash /bin/bash
root@ lsgxbsd :~ #  vi/etc/shells 
----------------------------------------------------------
# $FreeBSD: releng/10.1/etc/shells 59717 2000-04-27 21:58:46Z ache $
#
# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.
/bin/sh
/bin/csh
/bin/tcsh
/bin/bash
/usr/local/bin/bash
/usr/local/bin/rbash
/usr/local/bin/zsh
/usr/local/bin/rzsh
/usr/local/libexec/git-core/git-shell

--------------------------------------------------------

root@ lsgxbsd :~ #  chsh -s    /bin/bash lsgx
root@lsgxbsd:~ #  ln -s /usr/local/etc/bash_completion.d /etc/bash_completion.d
root@lsgxbsd:~ #  vi /usr/local/etc/bash_completion
-------------------------------------------------------------------
. /usr/local/share/bash-completion/ bash-completion
-------------------------------------------------------------------
root@lsgxbsd:~ #  ln -s /usr/local/etc/bash_completion /etc/bash_completion
root@lsgxbsd:~ #  vi /etc/profile
------------------------------------------------------------------------------------------
# $FreeBSD: releng/10.1/etc/profile 208116 2010-05-15 17:49:56Z jilles $
#
# System-wide .profile file for sh(1).
#
# Uncomment this to give you the default 4.2 behavior, where disk
# information is shown in K-Blocks
# BLOCKSIZE=K; export BLOCKSIZE
#
# For the setting of languages and character sets please see
# login.conf(5) and in particular the charset and lang options.
# For full locales list check /usr/share/locale/*
# You should also read the setlocale(3) man page for information
# on how to achieve more precise control of locale settings.
#
# Check system messages
# msgs -q
# Allow terminal messages
# mesg y
# Beginning of the block added by the lsgx - DO NOT EDIT
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
if [ "$PS1" ]; then
  if [ "$BASH" ] && [ "$BASH" != "/bin/sh" ]; then
    # The file bash.bashrc already sets the default PS1.
    # PS1='\h:\w\$ '
    if [ -f /etc/bash.bashrc ]; then
      . /etc/bash.bashrc
    fi
  else
    if [ "`id -u`" -eq 0 ]; then
      PS1='# '
    else
      PS1='$ '
    fi
  fi
fi
# The default umask is now handled by pam_umask.
# See pam_umask(8) and /etc/login.defs.
if [ -d /etc/profile.d ]; then
  for i in /etc/profile.d/*.sh; do
    if [ -r $i ]; then
      . $i
    fi
  done
  unset i
fi
# End of the block added by the lsgx
----------------------------------------------------------------------------------------
root@lsgxbsd:~ #  mkdir /etc/profile.d
root@lsgxbsd:~ #  vi /etc/profile.d/bash_completion.sh
---------------------------------------------------------------------------------------------
# Check for interactive bash and that we haven't already been sourced.
if [ -n "$BASH_VERSION" -a -n "$PS1" -a -z "$BASH_COMPLETION_COMPAT_DIR" ]; then
# Check for recent enough version of bash.
bash=${BASH_VERSION%.*}; bmajor=${bash%.*}; bminor=${bash#*.}
if [ $bmajor -gt 4 ] || [ $bmajor -eq 4 -a $bminor -ge 1 ]; then
[ -r "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion" ] && \
. "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion"
if shopt -q progcomp && [ -r /usr/local/share/bash-completion/bash_completion ]; then
# Source completion code.
. /usr/local/share/bash-completion/bash_completion
fi
fi
unset bash bmajor bminor
fi
------------------------------------------------------------------------------------------------
root@lsgxbsd:~ #  vi /etc/profile.d/Z97-byobu.sh
---------------------------------------------------------------------------------------------
#!/bin/sh
#    Z97-byobu.sh - allow any user to opt into auto-launching byobu
#    Copyright (C) 2011 Canonical Ltd.
#
#    Authors: Dustin Kirkland <kirkland@byobu.co>
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, version 3 of the License.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
# Allow any user to opt into auto-launching byobu by setting LC_BYOBU=1
# Apologies for borrowing the LC_BYOBU namespace, but:
#  a) it's reasonable to assume that no one else is using LC_BYOBU
#  b) LC_* is sent and receieved by most /etc/ssh/ssh*_config
if [ -n "$LC_BYOBU" ] && [ "$LC_BYOBU" -gt 0 ] && [ -r "/usr /bin/byobu-launch" ]; then
. /usr /bin/byobu-launch
elif [ "$LC_TERMTYPE" = "byobu" ] && [ -r "/usr/bin/byobu-launch" ]; then
. /usr /bin/byobu-launch
elif [ "$LC_TERMTYPE" = "byobu-screen" ] && [ -r "/usr /bin/byobu-launch" ]; then
export BYOBU_BACKEND="screen"
. /usr/ bin/byobu-launch
elif [ "$LC_TERMTYPE" = "byobu-tmux" ] && [ -r "/usr /bin/byobu-launch" ]; then
export BYOBU_BACKEND="tmux"
. /usr /bin/byobu-launch
fi
# vi: syntax=sh ts=4 noexpandtab
---------------------------------------------------------------------------------------------
root@lsgxbsd:~ #  vi /etc/bash.bashrc
-------------------------------------------------------------------------------------
# System-wide .bashrc file for interactive bash(1) shells.
# To enable the settings / commands in this file for login shells as well,
# this file has to be sourced in /etc/profile.
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, overwrite the one in /etc/profile)
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
# Commented out, don't overwrite xterm -T "title" -n "icontitle" by default.
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
;;
*)
;;
esac
# enable bash completion in interactive shells
if ! shopt -oq posix; then
if [ -f /usr/local/share/bash-completion/bash_completion ]; then
. /usr/local/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
# sudo hint
if [ ! -e "$HOME/.sudo_as_admin_successful" ] && [ ! -e "$HOME/.hushlogin" ] ; then
case " $(groups) " in *\ admin\ *)
if [ -x /usr /local /bin/sudo ]; then
cat <<-EOF
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
EOF
fi
esac
fi
# if the command-not-found package is installed, use it
if [ -x /usr /local /lib/command-not-found -o -x /usr /local /share/command-not-found/command-not-found ]; then
function command_not_found_handle {
        # check because c-n-f could've been removed in the meantime
if [ -x /usr /local /lib/command-not-found ]; then
   /usr /local /lib/command-not-found -- "$1"
return $?
elif [ -x /usr /local /share/command-not-found/command-not-found ]; then
   /usr /local /share/command-not-found/command-not-found -- "$1"
return $?
else
   printf "%s: command not found\n" "$1" >&2
   return 127
fi
}
fi

# Beginning of the block added by the lsgx - DO NOT EDIT
export LSCOLORS="ExGxFxdxCxegedabagExEx"
export CLICOLOR="yes"
export GREP_OPTIONS="--color=auto"
# End of the block added by the lsgx

-----------------------------------------------------------------------------------------------------
root@lsgxbsd:~ #  vi .profile
-------------------------------------------------------------------------------------------------------
# $FreeBSD: releng/10.1/etc/root/dot.profile 199243 2009-11-13 05:54:55Z ed $
#
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:~/bin
export PATH
HOME=/root
export HOME
TERM=${TERM:-xterm}
export TERM
PAGER=more
export PAGER
# These are normally set through /etc/login.conf.  You may override them here
# if wanted.
# PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:$HOME/bin; export PATH
# BLOCKSIZE=K; export BLOCKSIZE
# Setting TERM is normally done through /etc/ttys.  Do only override
# if you're sure that you'll never log in via telnet or xterm or a
# serial line.
# TERM=xterm;  export TERM
#EDITOR=vi;    export EDITOR
#PAGER=more;   export PAGER
# set ENV to a file invoked each time sh is started for interactive use.
ENV=$HOME/.shrc; export ENV
if [ -x /usr/games/fortune ] ; then /usr/games/fortune freebsd-tips ; fi

# Beginning of the block added by the lsgx - DO NOT EDIT
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
# Add setting fcitx at 2015-04-08 13:16:26
#export XMODIFIERS="@im=fcitx" 
#export XIM=fcitx
#export XIM_PROGRAM=/usr/bin/fcitx
#export XIM_ARGS=""
#export GTK_IM_MODULE=XIM
#export QT_IM_MODULE=XIM
#export DEPENDS="fcitx"
#/usr/bin/fcitx &
# End of the block added by the lsgx
----------------------------------------------------------------------------
root@lsgxbsd:~ #  vi .bashrc
-----------------------------------------------------------------------------
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
# Add an "alert" alias for long running commands.  Use like so:
#   sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/local/share/bash-completion/bash_completion ]; then
. /usr/local/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
# Beginning of the block added by the lsgx - DO NOT EDIT
# Add setting fbterm at 2015-04-08 13:16:26
#[[ $(tty) == \/dev\/tty[0-9]* ]] && fbterm -- tmux
#xrdb loading xterm color
#alias xterm='xrdb ~/.Xresources && xterm -e tmux'
alias h="history 25"
alias j="jobs -l"
alias la=" ls -aF"
alias lf=" ls -FA"
alias ll=" ls -lAF"
alias vi=" vim"

# A righteous umask
umask 22

#PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:~/bin
#export PATH

export PACKAGEROOT="ftp://ftp.freebsdchina.org"
#export PACKAGEROOT="ftp://ftp.tw.freebsd.org"
#export PACKAGESITE="http://mirrors.aliyun.com/freebsd/releases/amd64/9.3-RELEASE/packages/Latest/"
export LANG="zh_CN.UTF-8"
export LC_CTYPE="zh_CN.UTF-8"
export LC_ALL="zh_CN.UTF-8" 

# End of the block added by the lsgx
------------------------------------------------------------------------------
git设置
lsgx@lsgxbsd:~$  ssh-keygen -t rsa -C "lsgxthink@163.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/home/lsgx/.ssh/id_rsa):  .ssh/id_rsa_oschina
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in .ssh/id_rsa_oschina.
Your public key has been saved in .ssh/id_rsa_oschina.pub.
The key fingerprint is:
e5:a9:f3:34:75:f0:13:7a:8b:85:93:6d:64:25:e5:d1 lsgxthink@163.com
The key's randomart image is:
+--[ RSA 2048]----+
|              .o+|
|               +E|
|          . . + .|
|         o . X . |
|        S o * O  |
|         . . B o |
|        o o . .  |
|         + .     |
|          .      |
+-----------------+
lsgx@lsgxbsd:~$ cat ~/.ssh/id_rsa_oschina.pub 
-------------------------------------------------------------------------------------
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDomBJmpUJzWs3MD2AuEfimP/Hc40Lxk9B+7IZEteUjOe4v/1q/W1uK7FqOvKWRVBfZmHdPZ0FilHvKUY4W+DCQ+O9B5l/y0Qy4om05S8SjQp147b4XSSFiNtei98MW/UX0EHRaT410/aV/NPSt9u2k5g3N0Bn/Rf4N1WeSie9VB9FQEnD5YHNAMK5H5QhxC/F+NE/x6kMEdKhVJ6YDNzEO5sqMPk4ybwttU2W1VjWun/tU8qqRsGqhqaaZeUTNboXlFOmzbPg4AoF/yAe65FAoDkQXVkxLLDM0hMeYYTH9bwB7cGasEq08pt/i2VFdtSNtp0jO+50WtXaUb2pLr55X lsgxthink@163.com
--------------------------------------------------------------------------------------
lsgx@lsgxbsd:~$  ssh -T git@git.oschina.net
-----------------------------------------------------------------------------------------
Welcome to Git@OSC, lsgx!
--------------------------------------------------------------------------------------------
lsgx@lsgxbsd:~$  ssh-keygen -t rsa -C "lsgxthink@gmail.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/home/lsgx/.ssh/id_rsa):  .ssh/id_rsa_github
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in .ssh/id_rsa_github.
Your public key has been saved in .ssh/id_rsa_github.pub.
The key fingerprint is:
bc:4d:26:b0:7b:e5:28:f5:23:98:ec:1d:8e:e6:4b:62 lsgxthink@gmail.com
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
|                 |
|      .          |
|       +         |
|      . S +      |
|     . = @       |
|    E B * =      |
|   . +.* o .     |
|     o=.o        |
+-----------------+
lsgx@lsgxbsd:~$ cat ~/.ssh/id_rsa_github.pub 
-------------------------------------------------------------------------------------
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQClYiH9urgZS/0it8hZWTwTXT8yf5e3fI6AzXsKOchAgueoEOndle8NHfeRP/smfHXmMeq3V6nH2zSTKsltlGInqJS1qBPaEdr0AsBBXVU5HWuHKJ0I/cISt0ZH1qxIqDq4u+mBQm0OQ3EWvYoA71lyFX6AhES9U1OfCp3BZ1aU6Ya9QdEzYYW2LQIL1k5ZgPbG6oKY+40PG9B8gTeRAMkltQmSZAbjzBE6vs/zoEW/pUEOwr8SsXzrX4FNuK/Y+8Gfy1bOxpwESVNDa8bYlKYKY+s4RyHUoCQsO1/O4V9Dr2Zlrul3CCwarQnsVB1YVOmavrXOZzVnGTWo+q4RtUov lsgxthink@gmail.com

--------------------------------------------------------------------------------------
lsgx@lsgxbsd:~$  ssh -T git@github.com
-----------------------------------------------------------------------------------------
Hi lsgxeva! You've successfully authenticated, but GitHub does not provide shell access.

--------------------------------------------------------------------------------------------
root@lsgxbsd:~ #  vi ~/.ssh/config 
root@lsgxbsd:~ #  cat ~/.ssh/config 
-------------------------------------------------
# add git ssh setting
# github git setting
Host github
HostName github.com
User lsgxeva
IdentityFile ~/.ssh/id_rsa_github
# oschina git setting
Host oschina
HostName git.oschina.net
User lsgx
IdentityFile ~/.ssh/id_rsa_oschina

------------------------------------------------------
lsgx@lsgxbsd:~$  ssh-agent bash
lsgx@lsgxbsd:~$  ssh-add ~/.ssh/id_rsa_github
Identity added: /home/lsgx/.ssh/id_rsa_github (/home/lsgx/.ssh/id_rsa_github)
lsgx@lsgxbsd:~$  ssh-add ~/.ssh/id_rsa_oschina
Identity added: /home/lsgx/.ssh/id_rsa_oschina (/home/lsgx/.ssh/id_rsa_oschina)
lsgx@lsgxbsd:~$  ssh -T git@oschina
-----------------------------------------------------------------------------------------
Welcome to Git@OSC, lsgx!

--------------------------------------------------------------------------------------------
lsgx@lsgxbsd:~$  ssh -T git@github
-----------------------------------------------------------------------------------------
Hi lsgxeva! You've successfully authenticated, but GitHub does not provide shell access.

--------------------------------------------------------------------------------------------
root@lsgxbsd:~ #  vi /etc/rc.conf
------------------------------------------------------
git_daemon_enable="YES"
------------------------------------------------------
lsgx@lsgxbsd:~$  cat ~/.gitconfig 
------------------------------------------------------------------------------------
[user]
email = lsgxthink@163.com
name = lsgx
[core]
editor = vim
[color]
status = auto
branch = auto
diff = auto
ui = true
pager = true
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = yellow
changed = green
untracked = cyan
[alias]
co = checkout
ci = commit
br = branch
st = status
unstage = reset HEAD
last = log -1 HEAD
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
--------------------------------------------------------------------------------------------------------------
lsgx@lsgxbsd:~/work/code/demo$  cat .gitignore 
---------------------------------------------------------
# Project files
*.udb
# Object files
*.o
# Libraries
*.lib
*.a
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*_elf
*.elf
# Log files
*.log
---------------------------------------------
vsftp安装设置
讓 vsftp 以 inetd 的方式運作
root@lsgxbsd:~ #  cd /usr/ports/ftp/vsftpd
root@lsgxbsd:/usr/ports/ftp/vsftpd #  make install clean
root@lsgxbsd:/usr/ports/ftp/vsftpd #  vi /etc/rc.conf
------------------------------------
inetd_enable="YES"
-------------------------------------
root@lsgxbsd:/usr/ports/ftp/vsftpd #  vi /etc/inetd.conf
-----------------------------------------------------------------------
#ftp stream tcp nowait root /usr/libexec/ftpd ftpd -l
#ftp stream tcp6 nowait root /usr/libexec/ftpd ftpd -l
ftp stream tcp nowait root /usr/local/libexec/vsftpd vsftpd
ftp stream tcp6 nowait root /usr/local/libexec/vsftpd vsftpd
-----------------------------------------------------------------------------------
root@lsgxbsd:/usr/ports/ftp/vsftpd #  vi /usr/local/etc/vsftpd.conf
------------------------------------------------------------------------------------
# Example config file /usr/local/etc/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=YES
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
# Activate logging of uploads/downloads.
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
#
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
#chown_uploads=YES
#chown_username=whoever
#
# You may override where the log file goes if you like. The default is shown
# below.
xferlog_file=/var/log/vsftpd.log
#
# If you want, you can have your log file in standard ftpd xferlog format.
# Note that the default log file location is /var/log/xferlog in this case.
xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
#ascii_upload_enable=YES
#ascii_download_enable=YES
#
# You may fully customise the login banner string:
ftpd_banner=Welcome to blah FTP service by lsgx at freebsd.
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd.banned_emails
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
# (Warning! chroot'ing can be very dangerous. If using chroot, make sure that
# the user does not have write access to the top level directory within the
# chroot)
#chroot_local_user=YES
#chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd.chroot_list
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
ls_recurse_enable=NO
#
# When "listen" directive is enabled, vsftpd runs in standalone mode and
# listens on IPv4 sockets. This directive cannot be used in conjunction
# with the listen_ipv6 directive.
listen=NO
#
# This directive enables listening on IPv6 sockets. To listen on IPv4 and IPv6
# sockets, you must run two copies of vsftpd with two configuration files.
# Make sure, that one of the listen options is commented !!
#listen_ipv6=YES
secure_chroot_dir=/usr/local/share/vsftpd/empty
# If using vsftpd in standalone mode, uncomment the next two lines:
# listen=YES
# background=YES
-----------------------------------------------------------------------
root@lsgxbsd:/usr/ports/ftp/vsftpd #  vi /etc/ftpusers
-----------------------------------------
#root
-----------------------------------------
重新啟動inted服務,讓配置生效
root@lsgxbsd:/usr/ports/ftp/vsftpd #  /etc/rc.d/inetd restart

vmware FreeBSD安装相关推荐

  1. Windows7 VMware虚拟机安装Apple Mac OSX v10.7 Lion

    2019独角兽企业重金招聘Python工程师标准>>> Windows7 VMware虚拟机安装Apple Mac OSX v10.7 Lion 前 几天突然想起来在虚拟机里装个苹果 ...

  2. Vmware 15 安装 win7 虚拟机 (初学者操作与详解教程)

    文章目录 一.镜像下载 1.什么是镜像 2.常见的系统镜像文件格式 3.下载win7旗舰版镜像 二.VMware Workstation 下载 1.什么是虚拟机 2.VMware 主要功能 3.VMw ...

  3. Red Hat Linux 7.3 +VMWare 虚拟机安装实践

    2019独角兽企业重金招聘Python工程师标准>>> 版权声明:本文为笔记里的蹉跎出品,文章可共享,转载请声明. 本文主要内容:  - 1.Red Hat Linux 7.3  - ...

  4. FreeBSD安装vmtools波折

    FreeBSD安装vmtools 为VMWare虚拟机中的FreeBSD安装vmtools.本来是想按照VMWare说的使用光驱里的pl文件安装,所以需要如下步骤: cd /mntmkdir /cdr ...

  5. 转载:无需刻录DMG光盘,教你在VMWare下安装MAC OS X Snow Leopard 10.6

    自己安装没有成功,不知道是不是服务器上的虚拟化没打开,借别人的拿过来普渡一下众生 无需刻录DMG光盘,教你在VMWare下安装MAC OS X Snow Leopard 10.6 感谢每一个在互联网上 ...

  6. win7 + vmware下安装mac os

    iPhone现在越来越火爆了,很多原本在PC上的互联网应用都纷纷推出了iPhone客户端(比如携程,新浪微博),iPhone的最佳开发环境是mac OS + iphone真机,一般情况下这个有点难满足 ...

  7. VMWARE虚拟机安装系统提示CPU已被客户机操作系统禁用和secureCUT乱码

    错误:VMWARE虚拟机安装系统提示CPU已被客户机操作系统禁用 改正:找到虚拟机的位置找到下图灰色的部分:打开 .vmx后缀的操作系统配置文件,加入以下代码: cpuid.1.eax = :: 2. ...

  8. VMware虚拟机安装之后,打开时找不到启动Centos的界面

    #VMware虚拟机安装之后,打开时找不到启动Centos的界面 只要在VMware中打开查看–自定义–库,之后就看到自己已经创建好的虚拟机系统 我也是因为自己不小心上次关机之前把左边那个窗口关闭了

  9. VMware虚拟机安装黑苹果MacOS Mojave系统详细教程

    更多资源请百度搜索:前端资源网 欢迎关注我的博客:www.w3h5.com 最近遇到一个H5页面的 iPhone X 刘海兼容问题.查到一个 XCode 编辑器,可以模拟 iPhone X 环境运行. ...

最新文章

  1. C++成员变量指针和成员函数指针【The semantics of funcitons】
  2. string find简析
  3. listener.ora--sqlnet.ora--tnsnames.ora的关系以及手工配置举例(转载:http://blog.chinaunix.net/uid-83572-id-5510.ht)
  4. java.lang.NoClassDefFoundError:如何解决–第1部分
  5. python里面的函数
  6. android 栈溢出 检查,安卓源码编译完成后打包时出现栈溢出,求大家解决
  7. hadoop hbase java_Hadoop、Hbase伪分布式安装
  8. 模块化配电系统在高密度数据中心的应用
  9. 从0开始移植冒险岛online,和小伙伴一起在局域网或私服怀旧吧
  10. Typora的历史版本下载地址
  11. RUST开服教程、常用指令及心得
  12. 我的世界java生存命令方块,我的世界命令方块指令大全
  13. ettercap dns投毒
  14. 计算机心得1500字,计算机生产实习报告心得体会1500字
  15. 囧妈 一场不需要“电影院”的电影
  16. 没有水印的夸克免费扫描
  17. 数学建模——规划问题
  18. TCP/IP协议族 总结
  19. Anemometer MySQL 【慢查询日志监控平台】(实战)
  20. 生存之道,每个人都值得尊敬

热门文章

  1. pytorch中的学习率与优化器【lr_scheduler与optimizer】
  2. 9月生日会|共喜共庆,潮玩中秋!
  3. 新建小程序项目提示:登录用户不是该小程序的开发者
  4. MacbookPro 15硬盘升级踩坑记
  5. 计算机技术专业面试英语翻译,面试英文翻译:你为什么选择这个专业
  6. JAVA多线程模仿站台三个窗口同时出售20张票
  7. 初学者如何查阅自然语言处理领域学术资料(转)
  8. 写给新人的Python书籍推荐(必读)
  9. MDT/UML2/Getting Started with UML2及我自己的一些理解
  10. 无需代码,极简5步大屏可视化教程,3分钟就能轻松做出酷炫报表