FreeBSD10.1安装过程

2016-07-30 10:52:45来源:oschina作者:LSGX人点击

FreeBSD10.1安装过程时间:
2015-02-28 21:37
作者:
lsgxeva
分类:
工作学习>>FreeBSD>>server

摘要:
用vmware安装
FreeBSD10.1
系统
标签:
Freebsd 系统 vmware
提示:
文章均来自网络,版权为原作者所有,如有侵犯权益,请联络我们.
ftp://ftp.freebsd.org/http://pkg.tw.freebsd.org/ https://svnweb.freebsd.org/base/release/10.2.0/ ftp://ftp.cn.freebsd.org/pub/FreeBSD/development/tarballs/ http://mirrors.aliyun.com/freebsd/releases/amd64/10.2-RELEASE/
一:安装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 lsgxlsgx@lsgxbsd:~ %
id
uid=1001(lsgx) gid=0(wheel) groups=0(wheel)lsgx@lsgxbsd:~ %
exit
logoutroot@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 metric 0 mtu 16384
options=600003
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
inet 127.0.0.1 netmask 0xff000000
nd6 options=21
em0: flags=8843 metric 0 mtu 1500
options=9b
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
media: Ethernet autoselect (1000baseT )
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
search localdomain
# nameserver 192.168.195.2
# nameserver fe80::861b:5eff:fe6a:58fe%em0


nameserver 127.0.0.1
nameserver 192.168.195.2nameserver 192.168.1.1 nameserver 192.168.2.1 nameserver 192.168.185.201 nameserver 8.8.8.8 nameserver 8.8.4.4 search localdomain options edns0
------------------------------------
root@lsgxbsd:~ #
hostname -flsebsd.lsgxeva root@lsgxbsd:~ #
ee /etc/hosts----------------------------------------------------------
::1localhost localhost.my.domain
127.0.0.1 localhost localhost.my.domain

# Beginning of the block added by the lsgx - DO NOT EDIT

::1lsebsd.lsgxeva lsebsd
127.0.0.1 lsebsd.lsgxeva lsebsd

192.168.195.165 lsebsd.lsgxeva lsebsd

# End of the block added by the lsgx
---------------------------------------------------------- root@lsgxbsd:~ #
ee /etc/rc.conf
----------------------------------------------------------------
hostname="lsebsd.lsgxeva"

keymap="us.iso"

#ifconfig_em0="DHCP"


ifconfig_em0="inet 192.168.195.166 netmask 255.255.255.0"


ifconfig_em0_ipv6="inet6 accept_rtadv"


#ifconfig_em1="DHCP"


ifconfig_em1="inet 192.168.1.166 netmask 255.255.255.0"


ifconfig_em1_ipv6="inet6 accept_rtadv"


#ifconfig_em2="DHCP"


ifconfig_em2="inet 192.168.2.166 netmask 255.255.255.0"


ifconfig_em2_ipv6="inet6 accept_rtadv"


#ifconfig_em3="DHCP"


ifconfig_em3="inet 192.168.185.166 netmask 255.255.255.0"


ifconfig_em3_ipv6="inet6 accept_rtadv"


defaultrouter="192.168.195.2"


static_routes="net1 net2 net3 net4"


route_net1="-net 192.168.195.0/24 192.168.195.2"


route_net2="-net 192.168.1.0/24 192.168.1.1"


route_net3="-net 192.168.2.0/24 192.168.2.1"


route_net4="-net 192.168.185.0/24 192.168.185.201"local_unbound_enable="YES"
sshd_enable="YES"
moused_enable="YES"
ntpd_enable="YES"
powerd_enable="YES"
snd_hda_load="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable dumpdev="AUTO" zfs_enable="YES" ------------------------------------------------------------------------------------- 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 EDITserver 61.129.42.44 prefer server 218.75.4.130 iburst server 115.181.34.4 iburst server 127.127.1.0 iburst fudge 127.127.0.1 stratum 5restrict 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 61.129.42.44 noquery restrict 218.75.4.130 noquery restrict 115.181.34.4 noquerydriftfile /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 installroot@lsgxfb:~ #
ee ~/.cshrc
----------------------------------------------
# Beginning of the block added by the lsgx - DO NOT EDIT setenv PACKAGEROOT "ftp://ftp.freebsd.org" #setenv PACKAGEROOT "ftp://ftp.freebsdchina.org" #setenv PACKAGEROOT "ftp://ftp.tw.freebsd.org" #setenv PACKAGEROOT "ftp://ftp.cn.freebsd.org"


# End of the block added by the lsgx
----------------------------------------------
2、安装Ports源
root@lsgxfb:~ #portsnap fetch -s portsnap.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.confroot@lsgxfb:~ #ee /etc/make.conf #编辑文件,添加下面代码
-------------------------------------------------------------------------------------------# Beginning of the block added by the lsgx - DO NOT EDIT

MASTER_SITE_BACKUP?=/


ftp://ftp.freebsd.org/pub/FreeBSD/ports/distfiles/${DIST_SUBDIR}/


ftp://ftp.tw.freebsd.org/pub/FreeBSD/ports/distfiles/${DIST_SUBDIR}/


ftp://ftp.cn.freebsd.org/pub/FreeBSD/ports/distfiles/${DIST_SUBDIR}/


ftp://ftp.freebsdchina.org/pub/FreeBSD/ports/distfiles/${DIST_SUBDIR}



MASTER_SITE_OVERRIDE?=${MASTER_SITE_BACKUP}



WITH_PKGNG=YES
# End of the block added by the lsgx


-------------------------------------------------------------------------------------------
root@lsgxfb:~ #cd /usr/ports
root@lsgxfb:~ #make fetchindex
root@lsgxfb:~ #make search name=tree#查找ports中是否有tree这个软件
root@lsgxfb:~ #cd /
usr/ports/sysutils/tree
#进入软件包目录
root@lsgxfb:~ #make install clean#安装
root@lsgxfb:~ #make deinstall clean#卸载
root@lsgxfb:~ #make deinstall reinstall clean #升级

利用 ports 來安裝軟體FreeBSD 的 ports 就是別人已經編譯過,安裝測試沒問題了,他們將軟體編譯時所需的組態設定、編譯程序及安裝程序,都依照固定的格式擺在一起,當這些東西經由維護小組認可後即加入軟體蒐集中,對一般使用者而言, 我們只要先將某個軟體 ports 目錄下的檔案抓回來,然後很輕鬆的下:


make

make install
即可自動完成軟體的編譯和安裝 (也可以只用一行 make all install 來代替)。
用過 FreeBSD 的 ports 後,大部份的人都會被它這個完美的機制給吸引了, 這也是很多人喜歡用 FreeBSD 的主因之一哦。

一般 ports 在編譯時的運作流程:


fetch
抓取軟體的原始碼(source code),它會依下面的順序搜尋:


先找 /usr/ports/distfiles


找 /etc/make.conf 中設定的網站


找 Makefile 中 MASTER_SITES 設定的網站


checksum
檢查原始檔的 checksum 吻不吻合


depends
檢查並自動安裝須先安裝的相關軟體


extract
檢查 source,並將它解開到 works 的目錄中


patch
對 source 做 patch,修改以符合 FreeBSD 的環境需求


configure
產生設定檔


build
開始編譯


install
將編譯好的東西安裝到系統中



1.生成配置文件
make config
2.删除配置文件
make rmconfig
3.抓取源码包
make fetch
4.抓取所有源码包(包括需要到的所有包)
make fetch-recursive
5.校验源码包
make checksum
6.编译、安装并删除临时文件
make install clean
7.编译、安装、将所有需要的port打包、安装、并删除临时文件
make depends_target=package package clean
mkdir -p /usr/ports/packages/All/
生成的package会自动放到里面,否则放在port的当前目录
8.仅解开源码包
make extract
9.仅解开并打上patch
make patch
10.删除临时文件及源码包
make distclean
11.查询port的依赖关系
make all-depends-list #显示所有相关的套件
make pretty-print-build-depends-list #显示编译期间所需要的套件
make pretty-print-run-depends-list #显示此套件要执行时所需要的套件
12.删除已经安装的port
make deinstall
13.删除已经安装的port及其依赖
make deinstall-depends
14.重新安装port
make reinstall
15.搜索port
make search key=keyword
make search name=nameword
16.指定port安装目录
make PREFIX=path install
17.更新port MK
cd /usr/src/share/mk
make install
18.解决安装时的sed -i 错误
make -DUSE_REINPLACE install
19.更新port index对照表
cd /usr/ports/
make index
20.更新index html
cd /usr/ports/
make readmes
port的make命令参数信息
fetch - Retrieves $ (and $ if defined) into $ as necessary.
fetch-list - Show list of files that would be retrieved by fetch.
fetch-recursive - Retrieves $ (and $ if defined), for port and dependencies into $ as necessary.
fetch-recursive-list - Show list of files that would be retrieved by fetch-recursive.
fetch-required-list - Show list of files that would be retrieved by fetch-required.
fetch-required - Retrieves $ (and $ if defined), for port and dependencies that are not already installed into $.
all-depends-list - Show all directories which are dependencies for this port.
build-depends-list - Show all directories which are build-dependencies for this port.
package-depends-list - Show all directories which are package-dependencies for this port.
run-depends-list - Show all directories which are run-dependencies for this port. extract - Unpacks $ into $.
patch - Apply any provided patches to the source.
configure - Runs either GNU configure, one or more local configure scripts or nothing, depending on what's available.
build - Actually compile the sources.
install - Install the results of a build.
reinstall - Install the results of a build, ignoring "already installed" flag.
deinstall - Remove the installation.
deinstall-all - Remove all installations with the same PKGORIGIN. package - Create a package from an _installed_ port.
package-recursive - Create a package for a port and _all_ of its dependancies.
describe - Try to generate a one-line description for each port for use in INDEX files and the like.
checkpatch - Do a "patch -C" instead of a "patch". Note that it may give incorrect results if multiple patches deal with the same file.
checksum - Use distinfo to ensure that your distfiles are valid.
checksum-recursive - Run checksum in this port and all dependencies.
makesum - Generate distinfo (only do this for your own ports!).
clean - Remove $ and other temporary files used for building.
clean-depends - Do a "make clean" for all dependencies.
config - Configure options for this port (using $). Automatically run prior to extract, patch, configure, build, install, and package.
showconfig - Display options config for this port
rmconfig - Remove the options config for this port
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}/quarterly",url: "pkg+http://pkg.tw.FreeBSD.org/${ABI}/quarterly",#url: "pkg+http://pkg.cn.FreeBSD.org/${ABI}/quarterly",mirror_type: "srv",signature_type: "fingerprints",fingerprints: "/usr/share/keys/pkg",enabled: yes } ------------------------------------------------------------------------------------- root@lsgxbsd:~ # mkdir -p /usr/local/etc/pkg/repos
root@lsgxbsd:~ # cat /etc/pkg/FreeBSD.conf > /usr/local/etc/pkg/repos/FreeBSD.confroot@lsgxbsd:~ #
cat /usr/local/etc/pkg.conf
----------------------------------------------------------------# 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; #DEFAULT_ALWAYS_YES = 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://vuxml.freebsd.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 = ""; #HTTP_USER_AGENT = "Custom_User_Manager"; #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,cinfo: info -Cx,comment: query -i "%c",csearch: search -Cx,desc: query -i "%e",download: fetch,iinfo: info -ix,isearch: search -ix,prime-list: "query -e '%a = 0' '%n'",leaf: "query -e '%#r == 0' '%n-%v'",list: info -ql,noauto = "query -e '%a == 0' '%n-%v'",options: query -i "%n - %Ok: %Ov",origin: info -qo,provided-depends: info -qb,raw: info -R,required-depends: info -qr,roptions: rquery -i "%n - %Ok: %Ov",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 search// 搜索软件包

# 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 emacs24 # pkg install xterm # pkg install xorg #
pkg install wqy #
pkg installubuntu-font # pkg install tmux # pkg install moc # pkg install dbus # pkg install bash # pkg installbash-completion # pkg install zsh
# pkg install gcc48
# pkg install gmake
# pkg install gdb
# pkg install cgdb # pkg install cmake
# pkg install automake# pkg install autoconf #pkg install m4 #pkg install gawk #pkg install bison# pkg install nano #pkg installperl5.20 # pkg install exfat-utils # pkg
install
fusefs-exfat # pkg
install
fusefs-ext4fuse # pkg install libiconv # pkg install valgrind #pkg install ncurses # pkg install p7zip # pkg install
vsftpd-ssl-3.0.2 # pkg installdmidecode
# pkg installsmartmontools
# pkg install openjdk6 # pkg install curl
# pkg install wget # pkg install racket
# pkg install mit-scheme
# pkg install git
# pkg install svn
# pkg install expect
# pkg install xf86-video-fbdev mate-desktop mate xorg # pkg install slim
Linux兼容性设置
# pkg install linux-c6
# pkg install nspluginwrapper

root@lsebsd:~ # vi /etc/rc.conf
------------------------------------------
# kldunload linux
# options COMPAT_LINUX
linux_enable="YES"
------------------------------------------

root@lsebsd:~ #
vi /etc/fstab

----------------------------------------------------------------------proc/procprocfs rw00 linproc /compat/linux/proc linprocfsrw 00
----------------------------------------------------------------------



root@lsebsd:~ #vi /etc/sysctl.conf
------------------------------------------------------------------------------# Beginning of the block added by the lsgx - DO NOT EDIT

compat.linux.osrelease=2.6.18
# End of the block added by the lsgx ------------------------------------------------------------------------------


root@lsebsd:~ #vi /etc/devfs.conf

------------------------------------------------------------------------------
# Beginning of the block added by the lsgx - DO NOT EDIT


#link /tmp shm


# End of the block added by the lsgx

------------------------------------------------------------------------------
安装adobe flash插件1.
pkg install nspluginwrapper nspluginwrapper 是一个辅助安装配置 NetScape Plugin的工具。 可以为NetScape家族的浏览器安装在其它系统上构建的插件,比如安装在Linux上编译的flash plugin。2.通过ports安装 linux-f10-flashplugin11。 f10表示Fedora 10。 # cd /usr/ports/www/linux-c6-flashplugin11/

# make install clean
3.安装flash plugin. nspluginwrapper -v -a -i,-v表示输出详细信息, -a表示自动探测可用插件, -i表示安装。 这将会把 flash-player-plugin.so 安装到 ~/.mozilla/plugins 目录下。 如果你日后更新了flash player的插件,要执行一次
nspluginwrapper -v -a -u, -u表示update。4.测试是否安装成功: 在firefox地址栏输入 about:plugins,回车,会看见flash player在插件列表中,并且是enabled。5.如果插件不能激活,应该是没有加载linux模块,sudo kldload linux。 如果想让系统开机自动加载linux模块,编辑 /etc/rc.conf,加入
linux_enable="YES"。

构建 NanoBSD 映像所需的命令是:
# cd /usr/src/tools/tools/nanobsd
# sh nanobsd.sh
# cd /usr/obj/nanobsd.full
# sysctl kern.geom.debugflags=16

# dd if=_.disk.full of=/dev/da0 bs=64k
进入 NanoBSD 构建脚本的主目录。
开始构建过程。
进入构建好的映像文件所在的目录。
在存储介质上安装 NanoBSD。
烧写启动镜像到可移动设备
准备记忆棒
警告:
下面的例子中, 目标记忆棒对应的设备名是 /dev/da0。
请小心地确认这是希望覆盖的设备, 否则可能会损坏您的现有数据。
设置 kern.geom.debugflags sysctl 为允许写入目标设备的主引导记录。
# sysctl kern.geom.debugflags=16
3. 将映像文件写入记忆棒
.img 文件 不是 直接复制到记忆棒中的那种普通文件。 这个映像是一份包含启
动盘全部内容的映像。 这意味着简单地从一个地方复制到另一个地方是 不能
赋予其引导系统的能力的。 您必须使用 dd(1) 将映像文件直接写入磁盘:
# dd if=FreeBSD-10.1-RELEASE-i386-memstick.img of=/dev/da0 bs=64k
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/gcc48

For ports leveraging USE_GCC, USES=compiler, or USES=fortran this happens

gcc编译链接动态库时,很有可能编译通过,但是执行时,找不到动态链接库,那是
因为-L选项指定的路径只在编译时有效,编译出来的可执行文件不知道-L选项后面的值,
当然找不到。可以用ldd 看看是不有 ‘not found’在你链接的库后面,
解决方法是通过-Wl,rpath=,使得execute记住链接库的位置
-----------------------------------------------------------------------------------
root@lsgxbsd:~ #
ln -s /usr/local/lib/gcc48 /usr/lib/gcc
ln -s /usr/local/bin/g++48 /usr/bin/g++ ln -s /usr/local/bin/gappletviewer48 /usr/bin/gappletviewer ln -s /usr/local/bin/gc-analyze48 /usr/bin/gc-analyze ln -s /usr/local/bin/gcc48 /usr/bin/gcc ln -s /usr/local/bin/gcc-ar48 /usr/bin/gcc-ar ln -s /usr/local/bin/gcc-nm48 /usr/bin/gcc-nm ln -s /usr/local/bin/gcc-ranlib48 /usr/bin/gcc-ranlib ln -s /usr/local/bin/gcj48 /usr/bin/gcj48 ln -s /usr/local/bin/gcj-dbtool48 /usr/bin/gcj-dbtool ln -s /usr/local/bin/gcjh48 /usr/bin/gcjh ln -s /usr/local/bin/gcov48 /usr/bin/gcov ln -s /usr/local/bin/gfortran48 /usr/bin/gfortran ln -s /usr/local/bin/gij48 /usr/bin/gij ln -s /usr/local/bin/gjar48 /usr/bin/gjar ln -s /usr/local/bin/gjarsigner48 /usr/bin/gjarsigner ln -s /usr/local/bin/gjavah48 /usr/bin/gjavah ln -s /usr/local/bin/gkeytool48 /usr/bin/gkeytool ln -s /usr/local/bin/gnative2ascii48 /usr/bin/gnative2ascii ln -s /usr/local/bin/gorbd48 /usr/bin/gorbd ln -s /usr/local/bin/grmic48 /usr/bin/grmic ln -s /usr/local/bin/grmid48 /usr/bin/grmid ln -s /usr/local/bin/grmiregistry48 /usr/bin/grmiregistry ln -s /usr/local/bin/gserialver48 /usr/bin/gserialver ln -s /usr/local/bin/gtnameserv48 /usr/bin/gtnameserv



设置软链接lrwxr-xr-x1 root wheel20B 4 28 13:21 /usr/bin/g++ -> /usr/local/bin/g++48
lrwxr-xr-x1 root wheel30B 4 28 13:22 /usr/bin/gappletviewer -> /usr/local/bin/gappletviewer48
lrwxr-xr-x1 root wheel27B 4 28 13:22 /usr/bin/gc-analyze -> /usr/local/bin/gc-analyze48
lrwxr-xr-x1 root wheel20B 4 28 13:23 /usr/bin/gcc -> /usr/local/bin/gcc48
lrwxr-xr-x1 root wheel23B 4 28 13:22 /usr/bin/gcc-ar -> /usr/local/bin/gcc-ar48
lrwxr-xr-x1 root wheel23B 4 28 13:23 /usr/bin/gcc-nm -> /usr/local/bin/gcc-nm48
lrwxr-xr-x1 root wheel27B 4 28 13:23 /usr/bin/gcc-ranlib -> /usr/local/bin/gcc-ranlib48
lrwxr-xr-x1 root wheel20B 4 28 13:24 /usr/bin/gcj -> /usr/local/bin/gcj48
lrwxr-xr-x1 root wheel27B 4 28 13:24 /usr/bin/gcj-dbtool -> /usr/local/bin/gcj-dbtool48
lrwxr-xr-x1 root wheel21B 4 28 13:24 /usr/bin/gcjh -> /usr/local/bin/gcjh48
lrwxr-xr-x1 root wheel21B 4 28 13:24 /usr/bin/gcov -> /usr/local/bin/gcov48
lrwxr-xr-x1 root wheel25B 4 28 13:25 /usr/bin/gfortran -> /usr/local/bin/gfortran48
lrwxr-xr-x1 root wheel20B 4 28 13:25 /usr/bin/gij -> /usr/local/bin/gij48
lrwxr-xr-x1 root wheel21B 4 28 13:26 /usr/bin/gjar -> /usr/local/bin/gjar48
lrwxr-xr-x1 root wheel27B 4 28 13:27 /usr/bin/gjarsigner -> /usr/local/bin/gjarsigner48
lrwxr-xr-x1 root wheel23B 4 28 13:27 /usr/bin/gjavah -> /usr/local/bin/gjavah48
lrwxr-xr-x1 root wheel25B 4 28 13:27 /usr/bin/gkeytool -> /usr/local/bin/gkeytool48
lrwxr-xr-x1 root wheel30B 4 28 13:28 /usr/bin/gnative2ascii -> /usr/local/bin/gnative2ascii48
lrwxr-xr-x1 root wheel22B 4 28 13:28 /usr/bin/gorbd -> /usr/local/bin/gorbd48
lrwxr-xr-x1 root wheel22B 4 28 13:28 /usr/bin/grmic -> /usr/local/bin/grmic48
lrwxr-xr-x1 root wheel22B 4 28 13:29 /usr/bin/grmid -> /usr/local/bin/grmid48
lrwxr-xr-x1 root wheel29B 4 28 13:29 /usr/bin/grmiregistry -> /usr/local/bin/grmiregistry48
lrwxr-xr-x1 root wheel27B 4 28 13:29 /usr/bin/gserialver -> /usr/local/bin/gserialver48
lrwxr-xr-x1 root wheel27B 4 28 13:30 /usr/bin/gtnameserv -> /usr/local/bin/gtnameserv48
-----------------------------------------------------------------------------------gmake相关的软链接设置
ln -s /usr/local/bin/gmake /usr/bin/gmakeln -s /usr/local/bin/automake /usr/bin/automake
ln -s /usr/local/bin/autoconf /usr/bin/autoconf
gdb相关软链接设置
cp /usr/bin/gdb /usr/bin/gdb611
cp /usr/bin/gdbtui /usr/bin/gdbtui611
rm -rf /usr/bin/gdb
rm -rf /usr/bin/gdbtui
ln -s /usr/local/bin/gdb791 /usr/bin/gdb
ln -s /usr/local/bin/gdbtui791 /usr/bin/gdbtui
perl相关的软链接设置
ln -s /usr/local/bin/perl /usr/bin/perl
ln -s /usr/local/bin/perl5 /usr/bin/perl5
ln -s /usr/local/bin/perl5.20.2 /usr/bin/perl5.20.2
ln -s /usr/local/bin/perlbug /usr/bin/perlbug
ln -s /usr/local/bin/perldoc /usr/bin/perldoc
ln -s /usr/local/bin/perlivp /usr/bin/perlivp
ln -s /usr/local/bin/perlthanks /usr/bin/perlthanks
openjdk环境变量设置 # vi .profile 或者 # vi .bashrc 或者 # vi .cshrc ------------------------------------------------------
# openjdk env setting by bash
export JAVA_HOME=/usr/local/openjdk6
export JRE_HOME=/usr/local/openjdk6/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib/rt.jar:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH


# openjdk env setting by csh
setenv JAVA_HOME /usr/local/openjdk6
setenv JRE_HOME /usr/local/openjdk6/jre
setenv CLASSPATH .:$JAVA_HOME/lib:$JRE_HOME/lib:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib/rt.jar
set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin $HOME/bin $JAVA_HOME/bin $JRE_HOME/bin)
------------------------------------------------------------
root@lsebsd:~ #
vi /etc/fstab
----------------------------------------------------------------------
fdesc /dev/fd fdescfs rw 0 0


proc /proc procfs rw 0 0
---------------------------------------------------------------------- openjdk软链接设置 ln -s /usr/local/bin/java/usr/bin/java ln -s /usr/local/bin/caja /usr/bin/caja ln -s /usr/local/bin/caja-autorun-software/usr/bin/caja-autorun-software ln -s /usr/local/bin/caja-connect-server/usr/bin/caja-connect-server ln -s /usr/local/bin/caja-file-management-properties/usr/bin/caja-file-management-properties ln -s /usr/local/bin/jar/usr/bin/jar ln -s /usr/local/bin/jasper/usr/bin/jasper ln -s /usr/local/bin/javac/usr/bin/javac ln -s /usr/local/bin/javadoc/usr/bin/javadoc ln -s /usr/local/bin/javah/usr/bin/javah ln -s /usr/local/bin/javap/usr/bin/javap ln -s /usr/local/bin/javavm/usr/bin/javavm # java -version// 显示openjdk版本 # javac // 显示javac是否可用 root@lsgxbsd:~ #
vi /usr/local/etc/sudoers
root@lsgxbsd:~ #
cat /usr/local/etc/sudoers
--------------------------------------------------------------
## Uncomment to allow members of group wheel to execute any command
%wheel ALL=(ALL) ALL
-------------------------------------------------------libgtop相关设置vim /etc/devfs.conf
-------------------------------------------------------------------
# Beginning of the block added by the lsgx - DO NOT EDIT

#link /tmp shm
permdevstat 0444

# End of the block added by the lsgx
-----------------------------------------------------------------
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/"
FontPath "/usr/local/share/fonts/ubuntu-font/"

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" EndSubSectionEndSection# 在其中加入DefaultDepth(缺省颜色深度) 和 Modes(分辨率)。注意,这里你看到有多个SubSection向,不用理会,FreeBSD会自动根据DefaultDepth指定的值去找对应的SubSection项。 # 注意:有一个图形工具xorgcfg,通过它可以选择合适的驱动和设置交互式地定义配置。这个程序可以从控制台通过命名xorgcfg -textmode来直接启动。

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

root@lsebsd:~ # Xorg -config /root/xorg.conf.new -retro
root@lsebsd:~ # cp /root/xorg.conf.new /etc/X11/xorg.confroot@lsgxbsd:~ #
vi /etc/rc.conf


-----------------------------------------hald_enable="YES" dbus_enable="YES" avahi_daemon_enable="YES" avahi_dnsconfd_enable="YES" slim_enable="YES"

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

root@lsebsd:~ #
vi ~/.xinitrc
-----------------------------------------


#exec ck-launch-session dbus-launch mate-session


exec mate-session

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

root@lsebsd:~ #
xinit mate-session rc.conf文件配置状况
root@lsgxbsd:~ #
cat /etc/rc.conf


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

hostname="lsebsd.lsgxeva" keymap="us.iso" #ifconfig_em0="DHCP" ifconfig_em0="inet 192.168.195.166 netmask 255.255.255.0" ifconfig_em0_ipv6="inet6 accept_rtadv" #ifconfig_em1="DHCP" ifconfig_em1="inet 192.168.1.166 netmask 255.255.255.0" ifconfig_em1_ipv6="inet6 accept_rtadv" #ifconfig_em2="DHCP" ifconfig_em2="inet 192.168.2.166 netmask 255.255.255.0" ifconfig_em2_ipv6="inet6 accept_rtadv" #ifconfig_em3="DHCP" ifconfig_em3="inet 192.168.185.166 netmask 255.255.255.0" ifconfig_em3_ipv6="inet6 accept_rtadv" defaultrouter="192.168.195.2" static_routes="net1 net2 net3 net4" route_net1="-net 192.168.195.0/24 192.168.195.2" route_net2="-net 192.168.1.0/24 192.168.1.1" route_net3="-net 192.168.2.0/24 192.168.2.1" route_net4="-net 192.168.185.0/24 192.168.185.201" local_unbound_enable="YES" sshd_enable="YES" moused_enable="YES" ntpd_enable="YES" powerd_enable="YES" snd_hda_load="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable dumpdev="AUTO" zfs_enable="YES"# Beginning of the block added by the lsgx - DO NOT EDIThald_enable="YES" dbus_enable="YES" avahi_daemon_enable="YES" avahi_dnsconfd_enable="YES" slim_enable="YES"saver="YES" allscreens_flags="MODE_332" blanktime="10"# kldunload linux # options COMPAT_LINUX linux_enable="YES"
# smartmontools configure


smartd_enable="YES"
# End of the block added by the lsgx


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


root@lsgxbsd:~ #
sh /etc/rc



root@lsgxbsd:~ #

vi ~/.tmux.conf
-------------------------------------------------------------
#


# author: lsgx


# 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 wheel525K 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

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 csh
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 git_daemon_enable="YES"


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

lsgx@lsgxbsd:~$
cat ~/.gitconfig ------------------------------------------------------------------------------------ [user]email = lsgxthink@163.comname = lsgx[core]editor = vim[color]status = autobranch = autodiff = autoui = truepager = true [color "branch"]current = yellow reverselocal = yellowremote = green [color "diff"]meta = yellow boldfrag = magenta boldold = red boldnew = green bold [color "status"]added = yellowchanged = greenuntracked = cyan[alias]co = checkoutci = commitbr = branchst = statusunstage = reset HEADlast = log -1 HEADlg = 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



# Core dump files


*.core



# swap files


*.swp


*.gmon



---------------------------------------------
root@lsgxbsd:~ #
pkg install htop
root@lsgxbsd:~ #
htop
root@lsgxbsd:~ #
pkg install iftop
root@lsgxbsd:~ #
iftop -i em0 -pP
root@lsgxbsd:~ #
pkg install bsdinfo

root@lsgxbsd:~ #
vi ~/.cshrc

root@lsgxbsd:~ #
cat ~/.cshrc
------------------------------------------
# $FreeBSD: releng/10.2/etc/root/dot.cshrc 243893 2012-12-05 13:56:39Z eadler $
#
# .cshrc - csh resource script, read at beginning of execution by each shell
#
# see also csh(1), environ(7).
# more examples available at /usr/share/examples/csh/
#

alias h
history 25
alias j
jobs -l
alias la
ls -aF
alias lf
ls -FA
alias ll
ls -lAF
alias vivim

# A righteous umask
umask 22

#set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin $HOME/bin)

setenv
EDITOR
vi
setenv
PAGER
more
setenv
BLOCKSIZE
K

if ($?prompt) then
# An interactive shell -- set some stuff up
set prompt = "%N@%m:%~ %# "
set promptchars = "%#"

set filec
set history = 1000
set savehist = (1000 merge)
set autolist = ambiguous
# Use history to aid expansion
set autoexpand
set autorehash
set mail = (/var/mail/$USER)
if ( $?tcsh ) then
bindkey "^W" backward-delete-word
bindkey -k up history-search-backward
bindkey -k down history-search-forward
endif

endif

# 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 PACKAGEROOT "ftp://ftp.cn.freebsd.org"
#setenv PACKAGESITE "http://mirrors.aliyun.com/freebsd/releases/amd64/10.2-RELEASE/packages/Latest/"

# openjdk env setting by csh
setenv JAVA_HOME /usr/local/openjdk6
setenv JRE_HOME /usr/local/openjdk6/jre
setenv CLASSPATH .:$JAVA_HOME/lib:$JRE_HOME/lib:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib/rt.jar
set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin $HOME/bin $JAVA_HOME/bin $JRE_HOME/bin)

# End of the block added by the lsgx
------------------------------------------
设置屏保和分辨率
root@lsgxbsd:~ #
vi /boot/loader.conf
root@lsgxbsd:~ #
cat /boot/loader.conf --------------------------------------------------------------------
kern.geom.label.gptid.enable="0"


zfs_load="YES"



# 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 EDIThald_enable="YES" dbus_enable="YES" avahi_daemon_enable="YES" avahi_dnsconfd_enable="YES" slim_enable="YES"saver="YES" allscreens_flags="MODE_332" blanktime="10"# kldunload linux # options COMPAT_LINUX linux_enable="YES"# smartmontools configure smartd_enable="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 PACKAGEROOT "ftp://ftp.cn.freebsd.org" #setenv PACKAGESITE "http://mirrors.aliyun.com/freebsd/releases/amd64/10.2-RELEASE/packages/Latest/"setenv LANG zh_CN.UTF-8 setenv LC_CTYPE zh_CN.UTF-8 setenv LC_ALLzh_CN.UTF-8# openjdk env setting by csh setenv JAVA_HOME /usr/local/openjdk6 setenv JRE_HOME /usr/local/openjdk6/jre setenv CLASSPATH .:$JAVA_HOME/lib:$JRE_HOME/lib:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools. jar:$JRE_HOME/lib/rt.jar set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin $HOME/b in $JAVA_HOME/bin $JRE_HOME/bin)# End of the block added by the lsgx ---------------------------------------------
全局ls高亮设置root@lsgxbsd:~ #
cat /etc/csh.cshrc ------------------------------------------------------------------------------------- # Beginning of the block added by the lsgx - DO NOT EDITsetenv LSCOLORS ExGxFxdxCxegedabagExEx setenv CLICOLOR yessetenv GREP_OPTIONS --color=auto# End of the block added by the lsgx

-------------------------------------------------------------------------------------------
root@lsgxbsd:~ #
source /etc/csh.cshrc



安装fcitx输入法
# pkg install zh-fcitx-googlepinyin
Updating FreeBSD repository catalogue... FreeBSD repository is up-to-date. All repositories are up-to-date. pkg: linux-c6 has a missing dependency: linux-c6-flashplugin The following 9 package(s) will be affected (of 0 checked):New packages to be INSTALLED:zh-fcitx-googlepinyin: 0.1.6zh-libgooglepinyin: 0.1.2zh-fcitx: 4.2.8.6_1qt4-inputmethods: 4.8.6qt4-gui: 4.8.6_5xdg-utils: 1.0.2.20130919_1qt4-corelib: 4.8.6_5qt4-dbus: 4.8.6_1qt4-xml: 4.8.6_1The process will require 59 MiB more space. 13 MiB to be downloaded.

Message for qt4-corelib-4.8.6_5: ======================================================================Qt 4 can be built with optional support for: - Common UNIX Printing System (CUPS) (enabled by default) - Network Audio System (NAS) - Qt style that renders using GTK (QGTKSTYLE)In order to enable them, you have to addQT4_OPTIONS= CUPS NAS QGTKSTYLE to your /etc/make.conf and compile devel/qt4-corelib and x11-toolkits/qt4-gui ports.Attention! Whenever you change the QT4_OPTIONS both devel/qt4-corelib and x11-toolkits/qt4-gui ports must be rebuilt!====================================================================== Message for qt4-gui-4.8.6_5: ======================================================================Qt paint engine makes common use of shared memory. To avoid MIT-SHM errors (i.e., blank windows), you probably need to raise shared memory limits in loader.conf(5). The following should be safe values for the KDE Plasma Desktop:kern.ipc.shmall=32768 kern.ipc.shmmni=1024 kern.ipc.shmseg=1024====================================================================== Message for zh-fcitx-4.2.8.6_1: ************************************************************************Remember to set the environment variable XMODIFIERS: csh/tcsh: setenv XMODIFIERS @im=fcitxsh/bash: export XMODIFIERS='@im=fcitx'For GTK+ programs, you may want to set: csh/tcsh: setenv GTK_IM_MODULE fcitxsetenv GTK3_IM_MODULE ximsh/bash: export GTK_IM_MODULE=fcitxexport GTK3_IM_MODULE=ximFor Qt4 programs, we recommend you to use qtconfig-qt4: /usr/ports/misc/qt4-qtconfiginstead of to manually set QT4_IM_MODULE.To start fcitx with your desktop, just cp /usr/local/share/applications/fcitx.desktop /~/.config/autostart/************************************************************************


# vi ~/.cshrc

-----------------------------------------------------------------
# fcitx environment variable XMODIFIERS


setenv XMODIFIERS @im=fcitx


setenv GTK_IM_MODULE fcitx


setenv GTK3_IM_MODULE xim


-----------------------------------------------------------------
# vi ~/.xinitrc


-----------------------------------------------------------------exec fcitx &

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


安装vmtools 需要先安装
perl和
compat6x root@lsgxbsd:~ #
cd /usr/ports/misc/compat6x/
root@lsgxbsd:/usr/ports/misc/compat6x #
make install clean

root@lsgxbsd:~ #
df -h

lsgx@lsebsd:~ % df -h FilesystemSizeUsedAvail Capacity Mounted on zroot/ROOT/default151G3.1G147G 2%/ devfs1.0K1.0K 0B100%/dev procfs 4.0K4.0K 0B100%/proc linprocfs4.0K4.0K 0B100%/compat/linux/proc fdescfs 1.0K1.0K 0B100%/dev/fd procfs 4.0K4.0K 0B100%/proc zroot/tmp147G172K147G 0%/tmp zroot/usr/home147G160K147G 0%/usr/home zroot/usr/ports148G1.0G147G 1%/usr/ports zroot/usr/src 148G545M147G 0%/usr/src zroot/var/audit147G 96K147G 0%/var/audit zroot/var/crash147G 96K147G 0%/var/crash zroot/var/log 147G284K147G 0%/var/log zroot/var/mail147G128K147G 0%/var/mail zroot/var/tmp 147G 96K147G 0%/var/tmp zroot147G 96K147G 0%/zroot


root@lsgxbsd:~ #
ls -alh /dev/ | grep cd
crw-r-----1 root operator0x5a 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.7Distribution 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:doneGuest memory manager:failedGuest operating system daemon: done Unable to start services for VMware ToolsExecution aborted. ----------------------------------------------------------------------- root@lsgxbsd:~/work/vmtools/vmware-tools-distrib #
reboot

root@lsgxbsd:~ #
kldstat


Id Refs AddressSize Name


121 0xffffffff80200000 1755658 kernel


21 0xffffffff81956000 3b00 splash_bmp.ko


31 0xffffffff8195a000 b580 vesa.ko


51 0xffffffff81a11000 9d37 linprocfs.ko


61 0xffffffff81a1b000 43bcelinux.ko


71 0xffffffff81a5f000 2b58 uhid.ko

Run pkg_add open-vm-tools


Run cp /etc/pkg/share/examples/rc.d/vmtools /etc/rc.d


And add following lines to /etc/rc.conf



vmtools="YES"


vmware_guest_vmblock_enable="YES"


#vmware_guest_vmhgfs_enable="YES"


vmware_guest_vmmemctl_enable="YES"


vmware_guest_vmxnet_enable="YES"


vmware_guestd_enable="YES"
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/
配置Emacs https://github.com/redguardtoo/emacs.d
https://github.com/redguardtoo/emacs.d/archive/2.0.zip

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


就可以编辑了


界面效果预览图

FreeBSD_10.2-2015-09-17-15-32-08.png


FreeBSD_10.2-2015-09-17-15-43-20.png



bash的设置root@lsgxbsd:~ #
ln -s /usr/local/bin/bash /bin/bash
root@
lsgxbsd
:~ #
vi/etc/shells ----------------------------------------------------------
# $FreeBSD: releng/10.2/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


--------------------------------------------------------
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" ]; thenif [ "$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 fielse if [ "`id -u`" -eq 0 ]; thenPS1='# ' elsePS1='$ ' fifi fi# The default umask is now handled by pam_umask. # See pam_umask(8) and /etc/login.defs.if [ -d /etc/profile.d ]; thenfor i in /etc/profile.d/*.sh; do if [ -r $i ]; then. $i fidoneunset 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 bminorfi

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

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 # #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 .# 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" ]; thenexport BYOBU_BACKEND="screen". /usr/
bin/byobu-launch elif [ "$LC_TERMTYPE" = "byobu-tmux" ] && [ -r "/usr
/bin/byobu-launch" ]; thenexport 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 ".


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"


exportCLICOLOR="yes"



exportGREP_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=yesif [ -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 elsecolor_prompt= fi fiif [ "$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; thenif [ -f /usr/local/share/bash-completion/bash_completion ]; then . /usr/local/share/bash-completion/bash_completionelif [ -f /etc/bash_completion ]; then . /etc/bash_completionfi fi # Beginning of the block added by the lsgx - DO NOT EDIT#
bash-completion
configure
#[[ $PS1 && -f /usr/local/share/bash-completion/bash_completion.sh ]] && /


#
source /usr/local/share/bash-completion/bash_completion.sh
# 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

exportPACKAGEROOT="ftp://ftp.freebsdchina.org"


#exportPACKAGEROOT="ftp://ftp.tw.freebsd.org"


#exportPACKAGESITE="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


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

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
samba的配置 root@lsgxbsd:~ #
pkg install libiconv
root@lsgxbsd:~ #
pkg install samba42Message for openldap-client-2.4.40_1:
************************************************************

The OpenLDAP client package has been successfully installed.

Edit
/usr/local/etc/openldap/ldap.conf
to change the system-wide client defaults.

Try `man ldap.conf' and visit the OpenLDAP FAQ-O-Matic at
http://www.OpenLDAP.org/faq/index.cgi?file=3
for more information.

************************************************************
Message for cyrus-sasl-2.1.26_9:
You can use sasldb2 for authentication, to add users use:


saslpasswd2 -c username

If you want to enable SMTP AUTH with the system Sendmail, read
Sendmail.README

NOTE: This port has been compiled with a default pwcheck_method of
auxprop. If you want to authenticate your user by /etc/passwd,
PAM or LDAP, install ports/security/cyrus-sasl2-saslauthd and
set sasl_pwcheck_method to saslauthd after installing the
Cyrus-IMAPd 2.X port. You should also check the
/usr/local/lib/sasl2/*.conf files for the correct
pwcheck_method.
If you want to use GSSAPI mechanism, install
ports/security/cyrus-sasl2-gssapi.
If you want to use LDAP auxprop plugin, install
ports/security/cyrus-sasl2-ldapdb.
Message for libinotify-20150516:
============================================================================
You might want to consider increasing the kern.maxfiles tunable if you plan
to use this library for applications that need to monitor activity of a lot
of files.

For a typical desktop, add the following line to /boot/loader.conf, then
reboot the system:
kern.maxfiles="25000"
=============================================================================
Message for gamin-0.1.10_8:
===============================================================================

Gamin will only provide realtime notification of changes for at most n files,
where n is the minimum value between (kern.maxfiles * 0.7) and
(kern.maxfilesperproc - 200). Beyond that limit, files will be polled.

If you often open several large folders with Nautilus, you might want to
increase the kern.maxfiles tunable (you do not need to set
kern.maxfilesperproc, since it is computed at boot time from kern.maxfiles).

For a typical desktop, add the following line to /boot/loader.conf, then
reboot the system:
kern.maxfiles="25000"

The behavior of gamin can be controlled via the various gaminrc files.
See http://www.gnome.org/~veillard/gamin/config.html on how to create
these files. In particular, if you find gam_server is taking up too much
CPU time polling for changes, something like the following may help
in one of the gaminrc files:

# reduce polling frequency to once per 10 seconds
# for UFS file systems in order to lower CPU load
fsset ufs poll 10

===============================================================================
Message for samba42-4.2.2_1:
===============================================================================

How to start: http://wiki.samba.org/index.php/Samba4/HOWTO

* Your configuration is:
/usr/local/etc/smb4.conf

* All the relevant databases are under:
/var/db/samba4

* All the logs are under:
/var/log/samba4

* Provisioning script is:
/usr/local/bin/samba-tool

%25%25NSUPDATE%25%25You will need to specify location of the 'nsupdate' command in the
%25%25NSUPDATE%25%25smb4.conf file:
%25%25NSUPDATE%25%25
%25%25NSUPDATE%25%25 nsupdate command = /usr/local/bin/samba-nsupdate -g
%25%25NSUPDATE%25%25
For additional documentation check: http://wiki.samba.org/index.php/Samba4

Bug reports should go to the: https://bugzilla.samba.org/

===============================================================================
root@lsgxbsd:~ #
vi /etc/rc.conf
---------------------------------------
inetd_enable="YES"


# samba configure
#samba_enable="YES"
samba_server_enable="YES"
nmbd_enable="YES"
smbd_enable="YES"
winbindd_enable="YES"
------------------------------------------ root@lsgxbsd:~ #
sh /etc/rc

# vi /boot/loader.conf
------------------------------------------ # samba configure kern.maxfiles="25000"------------------------------------------ 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 = lsebsd.lsgxeva
#workgroup = WORKGROUP
workgroup = lsgxeva
server string = SambaShare
security = user
# hosts allow = 192.168.195. 127.
log file = /var/log/samba4/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
------------------------------------------------------

#
smbpasswd -a lsgx
New SMB password:
Retype new SMB password:
Added user lsgx.

#
smbpasswd -a root
New SMB password:
Retype new SMB password:
Added user root.

#
pdbedit -L
lsgx:1001:lsgx
root:0:Charlie &

重新启动inetd和samba
root@lsgxbsd:~ #
killall -HUPinetd

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"

#rpc_lockd_enable="YES" #rpc_statd_enable="YES"


# nfs client settingnfs_client_enable="YES" nfs_client_flags="-n 4"---------------------------------------------- root@lsgxbsd:~ #
sh /etc/rc

etc/exports文件指定了哪个文件系统 NFS应该输出(有时被称为“共享”)。 /etc/exports里面每行指定一个输出的文件系统和哪些机器可以访问该文件系统。在指定机器访问权限的同时,访问选项开关也可以被指定。

格式:

[共享的目录] [主机名1或IP1(参数1,参数2)] [主机名2或IP2(参数3,参数4)]

下面是一些NFS共享的常用参数:

ro只读访问
rw读写访问
sync 所有数据在请求时写入共享
async NFS在写入数据前可以相应请求
secureNFS通过1024以下的安全TCP/IP端口发送
insecure NFS通过1024以上的端口发送
wdelay如果多个用户要写入NFS目录,则归组写入(默认)
no_wdelay 如果多个用户要写入NFS目录,则立即写入,当使用async时,无需此设置。
hide 在NFS共享目录中不共享其子目录
no_hide共享NFS目录的子目录
subtree_check如果共享/usr/bin之类的子目录时,强制NFS检查父目录的权限(默认)
no_subtree_check和上面相对,不检查父目录权限
all_squash共享文件的UID和GID映射匿名用户anonymous,适合公用目录。
no_all_squash保留共享文件的UID和GID(默认)
root_squashroot用户的所有请求映射成如anonymous用户一样的权限(默认)
no_root_squasroot用户具有根目录的完全管理访问权限
anonuid=xxx指定NFS服务器/etc/passwd文件中匿名用户的UID
anongid=xxx指定NFS服务器/etc/passwd文件中匿名用户的GID

配置文件/etc/exports内容如下:

$ cat /etc/exports
/home/share 192.168.1.15(rw,sync) *(ro)
配置说明: 对192.168.1.15赋予读写权限,其他机器仅有只读权限。

Use the file /etc/exports to configure your shares. Example:

/mnt/sda2192.168.1.2,192.168.1.3,192.168.1.4(ro,sync,no_subtree_check)
/mnt/sda3192.168.1.2(rw,sync,no_subtree_check)
/mnt/sda4192.168.1.0/255.255.255.0(rw,sync,no_root_squas)
root@lsgxbsd:~ #
vi /etc/exports
-------------------------------------- /-maproot=0 -network 192.168.195.0 -mask 255.255.255.0 -------------------------------------- 重新加载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.166
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
root@lsgxbsd:~ #
chmod 777 /mnt/
nfs
root@lsgxbsd:~ #
chmod 777 /mnt/
image
手动挂载nfs文件夹目录
root@lsgxbsd:~ #
mount -t nfs -o wsize=1024,rsize=1024 192.168.195.166:/ /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
none
swap
sw
0
0
proc
/proc
procfs
rw
0
0
linproc
/compat/linux/proc
linprocfs
rw
0
0
fdesc
/dev/fd
fdescfs
rw
0
0
proc
/proc
procfs
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="lsebsd.lsgxeva" keymap="us.iso" #ifconfig_em0="DHCP" ifconfig_em0="inet 192.168.195.166 netmask 255.255.255.0" ifconfig_em0_ipv6="inet6 accept_rtadv" #ifconfig_em1="DHCP" ifconfig_em1="inet 192.168.1.166 netmask 255.255.255.0" ifconfig_em1_ipv6="inet6 accept_rtadv" #ifconfig_em2="DHCP" ifconfig_em2="inet 192.168.2.166 netmask 255.255.255.0" ifconfig_em2_ipv6="inet6 accept_rtadv" #ifconfig_em3="DHCP" ifconfig_em3="inet 192.168.185.166 netmask 255.255.255.0" ifconfig_em3_ipv6="inet6 accept_rtadv" defaultrouter="192.168.195.2" static_routes="net1 net2 net3 net4" route_net1="-net 192.168.195.0/24 192.168.195.2" route_net2="-net 192.168.1.0/24 192.168.1.1" route_net3="-net 192.168.2.0/24 192.168.2.1" route_net4="-net 192.168.185.0/24 192.168.185.201" local_unbound_enable="YES" sshd_enable="YES" moused_enable="YES" ntpd_enable="YES" powerd_enable="YES" snd_hda_load="YES" # Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable dumpdev="AUTO" zfs_enable="YES"# Beginning of the block added by the lsgx - DO NOT EDIThald_enable="YES" dbus_enable="YES" avahi_daemon_enable="YES" avahi_dnsconfd_enable="YES" #slim_enable="YES"saver="YES" allscreens_flags="MODE_332" blanktime="10"# kldunload linux # options COMPAT_LINUX linux_enable="YES"# git daemon git_daemon_enable="YES"# smartmontools configure smartd_enable="YES"inetd_enable="YES"# samba configure #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_flags="-r"#rpc_lockd_enable="YES" #rpc_statd_enable="YES"# 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
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-----------------------------------------------------------------------#ftpstream tcp nowait root/usr/libexec/ftpdftpd -l #ftpstream tcp6nowait root/usr/libexec/ftpdftpd -l ftp stream tcp nowait root/usr/local/libexec/vsftpdvsftpd ftp stream tcp6nowait root/usr/local/libexec/vsftpdvsftpd ssh stream tcp nowait root/usr/sbin/sshd sshd -i -4 ssh stream tcp6nowait root/usr/sbin/sshd sshd -i -6 -----------------------------------------------------------------------------------
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
配置多个网卡和多个网关
root@lsgxbsd:~ #
vi /etc/resolv.conf
-----------------------------------------------------# Generated by resolvconf search localdomain # nameserver 192.168.195.2 # nameserver fe80::861b:5eff:fe6a:58fe%em0nameserver 127.0.0.1 nameserver 192.168.195.2 nameserver 192.168.1.1 nameserver 192.168.2.1 nameserver 192.168.185.201 nameserver 8.8.8.8 nameserver 8.8.4.4 search localdomain options edns0


-----------------------------------------------------------------
root@lsgxbsd:~ #
vim /etc/rc.conf -----------------------------------------------------------------------
#ifconfig_em0="DHCP"
ifconfig_em0="inet 192.168.195.166 netmask 255.255.255.0"
ifconfig_em0_ipv6="inet6 accept_rtadv"
#ifconfig_em1="DHCP"
ifconfig_em1="inet 192.168.1.166 netmask 255.255.255.0"
ifconfig_em1_ipv6="inet6 accept_rtadv"
#ifconfig_em2="DHCP"
ifconfig_em2="inet 192.168.2.166 netmask 255.255.255.0"
ifconfig_em2_ipv6="inet6 accept_rtadv"
#ifconfig_em3="DHCP"
ifconfig_em3="inet 192.168.185.166 netmask 255.255.255.0"
ifconfig_em3_ipv6="inet6 accept_rtadv"
defaultrouter="192.168.195.2"
static_routes="net1 net2 net3 net4"
route_net1="-net 192.168.195.0/24 192.168.195.2"
route_net2="-net 192.168.1.0/24 192.168.1.1"
route_net3="-net 192.168.2.0/24 192.168.2.1"
route_net4="-net 192.168.185.0/24 192.168.185.201"
-----------------------------------------------------------------------
root@lsgxbsd:~ #
sh /etc/rc


root@lsgxbsd:~ #
/etc/rc.d/routing restart

root@lsgxbsd:~ #
/etc/rc.d/netif restart

root@lsgxbsd:~ #
/etc/netstart restart
支持挂载exfat文件系统 $ cd /usr/ports/sysutils/
exfat-utils/
$ sudo make install clean$ cd /usr/ports/sysutils/
fusefs-exfat/

$ sudo make install clean
$ sudo vim /etc/rc.conf
----------------------------------------
# fuse configure
fuse_enable="YES"
---------------------------------------- $ sudo vim /boot/loader.conf
------------------------------------------
# fuse configure
fuse_load="YES"
------------------------------------------ $ sudo camcontrol devlist $ sudo mount.exfat /dev/da1s4 /mnt/
# pkg
install
nmap# pkg install mysql55-server
Message for mysql55-client-5.5.43_1:
* * * * * * * * * * * * * * * * * * * * * * * *

Please be aware the database client is vulnerable
to CVE-2015-3152 - SSL Downgrade aka "BACKRONYM".
You may find more information at the following URL:

http://www.vuxml.org/freebsd/36bd352d-299b-11e5-86ff-14dae9d210b8.html

Although this database client is not listed as
"affected", it is vulnerable and will not be
receiving a patch. Please take note of this when
deploying this software.

* * * * * * * * * * * * * * * * * * * * * * * *
Message for mysql55-server-5.5.43:
************************************************************************

Remember to run mysql_upgrade the first time you start the MySQL server
after an upgrade from an earlier version.

************************************************************************
# pkg install apache24
Message for apache24-2.4.16:
To run apache www server from startup, add apache24_enable="yes"
in your /etc/rc.conf. Extra options can be found in startup script.

Your hostname must be resolvable using at least 1 mechanism in
/etc/nsswitch.conf typically DNS or /etc/hosts or apache might
have issues starting depending on the modules you are using.

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

- apache24 default build changed from static MPM to modular MPM
- more modules are now enabled per default in the port
- icons and error pages moved from WWWDIR to DATADIR

If build with modular MPM and no MPM is activated in
httpd.conf, then mpm_prefork will be activated as default
MPM in etc/apache24/modules.d to keep compatibility with
existing php/perl/python modules!

Please compare the existing httpd.conf with httpd.conf.sample
and merge missing modules/instructions into httpd.conf!

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# pkg install p5-Apache2-SOAP
Message for ap24-mod_perl2-2.0.9,3:
===================================================================
Simple config:

LoadModule perl_module libexec/apache24/mod_perl.so
#PerlModule Apache::compat
# your config comes here

For a more detailed version (including more options) refer to:

docs/user/intro/start_fast.pod

or online:

http://perl.apache.org/docs/2.0/user/intro/start_fast.html

The module can be enabled in
etc/apache24/modules.d/260_mod_perl.conf

===================================================================
# pkg install ap24-mod_auth_pam2 # pkg install ap24-mod_authnz_external24# pkg
install
php56 # pkg install php56-extensions# pkg install php56-soap
# pkg install nusoap # pkg install gsoap # pkg install p5-SOAP-WSDL# pkg install mod_php56
Message for mod_php56-5.6.13:
***************************************************************

Make sure index.php is part of your DirectoryIndex.

You should add the following to your Apache configuration file:


SetHandler application/x-httpd-php


SetHandler application/x-httpd-php-source


***************************************************************
# pkg
install
phpmyadmin
Message for phpMyAdmin-4.4.14.1:
phpMyAdmin-4.4.14.1 has been installed into:

/usr/local/www/phpMyAdmin

Please edit config.inc.php to suit your needs.

To make phpMyAdmin available through your web site, I suggest
that you add something like the following to httpd.conf:

For Apache versions earlier than 2.4:

Alias /phpmyadmin/ "/usr/local/www/phpMyAdmin/"


Options none
AllowOverride LimitOrder Deny,Allow
Deny from all
Allow from 127.0.0.1 .example.com


For Apache version 2.4.x or above:

Alias /phpmyadmin/ "/usr/local/www/phpMyAdmin/"


Options None
AllowOverride Limit

Require localRequire host .example.com


SECURITY NOTE: phpMyAdmin is an administrative tool that has had several
remote vulnerabilities discovered in the past, some allowing remote
attackers to execute arbitrary code with the web server's user credential.
All known problems have been fixed, but the FreeBSD Security Team strongly
advises that any instance be protected with an additional protection layer,
e.g. a different access control mechanism implemented by the web server
as shown in the example. Do consider enabling phpMyAdmin only when it
is in use.
# vi /etc/rc.conf
--------------------------------------------
# mysql configure
mysql_enable="YES"

# apache24 configure
apache24_enable="YES"

# php fpm configure
php_fpm_enable="YES"
---------------------------------------------- gsoap源码编译
(会和使用pkg安装的gsoap造成冲突: pkg install gsoap) http://www.cs.fsu.edu/~engelen/soap.html http://sourceforge.net/projects/gsoap2/files/
================================================================================
INSTALLATION
================================================================================

See README.txt for an overview of the gSOAP software and more details on the
installation in case of a problem.

This part explains how gSOAP is built on your platform.

Using Autoconf/Automake
-----------------------

Requirements to configure and build the package with autoconf/automake:

1.
Automake tools (make and GNU m4) to configure and build
2.
Bison http://www.gnu.org/software/bison or the alternative Yacc
3.
Flex http://flex.sourceforge.net
4a. either
OpenSSL (for optional HTTPS) http://www.openssl.org
4b. or GNUTLS (for optional HTTPS) http://www.gnu.org/software/gnutls/
4c. or disable SSL support (./configure --disable-ssl)
5.
Zlib (optional, to support compression) http://www.zlib.net
6. Pthreads or win32 threads (optional)

See Installation Instructions below.

I do not have/want Automake! What should I do?
----------------------------------------------

No problem.

If autoconf/automake are not available or if 'configure' and 'make' fail for
some reason, you can still build the 'soapcpp2' and 'wsdl2h' tools with the
provided generic makefiles.

To do so, use the command line to run 'make' with generic makefiles:


$ cd gsoap/src
$ make -f MakefileManual
$ cd gsoap/wsdl
$ make -f MakefileManual

This builds 'soapcpp' with 'gcc' and 'wsdl2h' with 'g++' and installs the
binaries in gsoap/bin. Move them to a bin directory or include them in your
executable path.

To build 'wsdl2h' with HTTPS enabled (assuming OpenSSL is installed), use:


$ cd gsoap/wsdl
$ make -f MakefileManual secure

To compile with a different compiler instead of GCC, for example 'clang', use:


$ cd gsoap/src
$ make CC=clang -f MakefileManual
$ cd gsoap/wsdl
$ make CC=clang CPP=clang++ -f MakefileManual secure

Some systems may require additional libraries to build 'wsdl2h', for example
Sun OS:


$ cd gsoap/wsdl
$ make CC=CC CPP=CC SOCKLIB='-lsocket -lnsl -lxnet' -f MakefileManual secure

The above commands to build 'soapcpp2' assume you have Bison and Flex
installed. To use Yacc instead, please use:


$ cd gsoap/src
$ make YACC='yacc -d -v -s soapcpp2_yacc' CMFLAGS='-DWITH_YACC -DWITH_FLEX' -f MakefileManual

If you do not have the Bison tool, please download and install it from here:

http://www.gnu.org/software/bison/

If you do not have the Flex tool, please download and install it from here:


http://flex.sourceforge.net

For your project builds, use the stdsoap2.c and stdsoap2.cpp sources rather
than the libgsoap libs, as the libs are not built. To enable SSL, GZIP, HTTP
cookies, IPv6 support, and/or force C locale usage, use the compiler flags:


-DWITH_OPENSSL to enable SSL, link with OpenSSL
-DWITH_GNUTLS to enable SSL, link with GNUTLS
-DWITH_GZIP to enable compression, link with Zlib
-DWITH_COOKIES to enable HTTP cookies
-DWITH_IPV6 to enable IPv6
-DWITH_C_LOCALE to force C locale

Note: these flags when set must be used to compile ALL your sources to ensure
consistency.

What if I cannot install Bison and Flex?
----------------------------------------

Included in gsoap/src are the flex-generated file 'lex.yy.c' and
bison-generated files 'soapcpp2_yacc.tab.h' and 'soapcpp2_yacc.tab.c'. These
files may suffice (no guarantee however) to build 'soapcpp2' as follows:


$ cd gsoap/src
$ make -f MakefileManual soapcpp2

In case the files 'lex.yy.c', 'soapcpp2_yacc.tab.h', and 'soapcpp2_yacc.tab.c'
were deleted in a prior build run, please unarchive the gSOAP package again
to retrieve these original files.

Windows Users
-------------

Win32 binaries and project code is included in this package. Win32 users can
start right away without autoconf/automake. The 'soapcpp2.exe' binary compiler
and 'wsdl2h.exe' WSDL parser are included in 'gsoap/bin/win32', see also the
'gsoap/VisualStudio2005' folder for the tool project files. The 'soapcpp2.exe'
and 'wsdl2h.exe' tools are command-line based and should be invoked from within
the IDE to process WSDL, XSD, and gSOAP service specification header files:

.wsdl .xsd --> wsdl2h.exe --> .h (special .h formatted with gSOAP annotations)
.h --> soapcpp2.exe --> .h .c .cpp .xml ...

Win32 build needs "ws2_32.lib". To do this in Visual Studio C++ 6.0, go to
"Project", "settings", select the "Link" tab (the project file needs to be
selected in the file view) and add "ws2_32.lib" to the "Object/library modules"
entry

Visual Studio 2005: you must install the Platform SDK (R2)

Dependences (stdsoap2.h and stdsoap2.c/.cpp include specific comments on this):

winsock2.h
ws2tcpip.h
ws2spi.h
Ws2_32.lib

Please note that the package includes mvc makefiles to build 'soapcpp2.exe' and
'wsdl2h.exe':

gsoap/src/Make_mvc.mak
gsoap/wsdl/Make_mvc.mak

Symbian
-------

Symbian instructions and example code is located in 'gsoap/Symbian'.

Palm
----

Palm OS support is no longer available for this release. The latest stable
release with Palm OS support is gSOAP 2.7.8c.

Tandem NonStop
--------------

See gsoap/TandemNonStop for instructions.

Installation Instructions
-------------------------

To build gSOAP on your platform using autoconf/automake, please enter the
following commands:


$ ./configure
$ make
$ make install

This will install the executables and libraries on your system (and you need
root access to do so).

To build without the default OpenSSL SSL/TLS support, use:

$ ./configure --disable-ssl
$ make
$ make install

To build with GNUTLS SSL/TLS support, use:

$ ./configure --enable-gnutls
$ make
$ make install

IMPORTANT: the WS-Security WSSE plugin requires OpenSSL and will not build with
GNUTLS. This limitation is being addressed, so please check future 2.8.x
releases.

To configure and build the examples, use the --enable-samples option:

$ ./configure --enable-samples

To configure and build the libraries in DEBUG mode, which produces 'SENT.log',
'RECV.log' and 'TEST.log' files for message logs and gSOAP engine event logs,
use:


$ ./configure --enable-debug

To enable IPV6 support, use:

$ ./configure --enable-ipv6

If you do not want the libraries to depend on a global namespace table (.nsmap
file content), use:

$ ./configure --disable-namespaces

However, you MUST set a namespace table at runtime with soap_set_namespaces()
right after initialization with soap_init() or soap_new() to ensure that a
namespace mapping table is used by the engine context.

If you want to install the executables in your local folder, enter:


$ ./configure
$ make
$ make install exec_prefix=$HOME

Summary
-------

To build your projects, you need the following executables:

wsdl2h
the gSOAP WSDL/schema parser and code generator
soapcpp2
the gSOAP stub/skeleton/serialization generator

Pre-built executables of these for select platforms can be found in gsoap/bin.

You also need the following libraries (built from stdsoap2.c[pp]):

libgsoap++.a
C++ runtime
libgsoapck++.a
C++ runtime with HTTP cookie support
libgsoapssl++.a
C++ runtime with cookies, zlib, and SSL
libgsoap.a
C runtime
libgsoapck.a
C runtime with HTTP cookie support
libgsoapssl.a
C runtime with cookies, zlib, and SSL

Or you can use the stdsoap2.c and stdsoap2.cpp source directly, but you need to use the propoer -DWITH_X flags to enable support for 'X' (see above).

This version of gSOAP requires SSL support with OpenSSL 0.9.6 or later.$ ./configure --enable-debug
$ gmake
$ gmake install exec_prefix=$HOME
编译 apache2 mod_soap.so 动态链接库模块
# cd ~/work/gsoap-2.8/gsoap/mod_gsoap/mod_gsoap-0.9/apache_20/
# ln -s ../../../stdsoap2.h .
# apxs -a -i -c mod_gsoap.c
修改MySql的密码为123456 /usr/local/bin/mysqladmin -u root -p password 123456
mysql设置root远程访问
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;
# service mysql-server restart

3种方法修改PHP时区
PHP5.2.4之前的版本无需设置时区。下面是修改PHP时区的三个办法。
1、修改PHP.ini这个文件
找到date.timezone这行,去掉前面的分号,改成:
date.timezone = Asia/Shanghai

2、修改 .htaccess文件
修改.htaccess文件有两种办法,下面的两条语句只要有一条即可
php_value date.timezone Asia/Shanghai
SetEnv TZ Asia/Shanghai

3、修改PHP代码
也是下面的两条语句只要其中的一句即可
date_default_timezone_set('Asia/Shanghai');
ini_set('date.timezone','Asia/Shanghai');
例如: <?php date_default_timezone_set('Asia/Shanghai'); ?>
phpinfo.php ----------------------------------------------------
<?php
date_default_timezone_set('Asia/Shanghai');

ob_start();
phpinfo();
$body = ob_get_contents();
$body = str_replace("
","
",$body);
ob_end_clean();
echo $body;
?>
----------------------------------------------------root@lsebsd:/usr/local/www/phpMyAdmin # ls -alh config.inc.php
-rw-r--r-- 1 root wheel6.5K 10 8 23:11 config.inc.php

root@lsebsd:/usr/local/www/phpMyAdmin # ls -alh config-db.php
-rw-r--r-- 1 root wheel543B 10 8 23:11 config-db.php

root@lsebsd:/usr/local/www/phpMyAdmin # cat config.inc.php
--------------------------------------------------------------------

<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* phpMyAdmin sample configuration, you can use it as base for
* manual configuration. For easier setup you can use setup/
*
* All directives are explained in documentation in the doc/ folder
* or at .
*
* @package PhpMyAdmin
*/

/*
* This is needed for cookie based authentication to encrypt password in
* cookie
*/
$cfg['blowfish_secret'] = 'lsebsdmyphpmyadmin'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

/**
* Server(s) configuration
*/
$i = 0;
// The $cfg['Servers'] array starts with $cfg['Servers'][1]. Do not use $cfg['Servers'][0].
// You can disable a server config entry by setting host to ''.
$i++;

/**
* Read configuration from dbconfig-common
* You can regenerate it using: dpkg-reconfigure -plow phpmyadmin
*/
/*if (check_file_access('/usr/local/www/phpMyAdmin/config-db.php')) {
require('/usr/local/www/phpMyAdmin/config-db.php');
}*/
require('/usr/local/www/phpMyAdmin/config-db.php');

/* Configure according to dbconfig-common if enabled */
if (!empty($dbname)) {
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
if (empty($dbserver)) $dbserver = 'localhost';
$cfg['Servers'][$i]['host'] = $dbserver;

if (!empty($dbport) || $dbserver != 'localhost') {
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['port'] = $dbport;
}
//$cfg['Servers'][$i]['compress'] = false;
/* Select mysqli if your server has it */
$cfg['Servers'][$i]['extension'] = 'mysqli';
/* Optional: User for advanced features */
$cfg['Servers'][$i]['controluser'] = $dbuser;
$cfg['Servers'][$i]['controlpass'] = $dbpass;
/* Optional: Advanced phpMyAdmin features */
$cfg['Servers'][$i]['pmadb'] = $dbname;
$cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark';
$cfg['Servers'][$i]['relation'] = 'pma_relation';
$cfg['Servers'][$i]['table_info'] = 'pma_table_info';
$cfg['Servers'][$i]['table_coords'] = 'pma_table_coords';
$cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages';
$cfg['Servers'][$i]['column_info'] = 'pma_column_info';
$cfg['Servers'][$i]['history'] = 'pma_history';
$cfg['Servers'][$i]['table_uiprefs'] = 'pma_table_uiprefs';
$cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords';
$cfg['Servers'][$i]['tracking'] = 'pma_tracking';
$cfg['Servers'][$i]['userconfig'] = 'pma_userconfig';
$cfg['Servers'][$i]['recent'] = 'pma_recent';

/* Uncomment the following to enable logging in to passwordless accounts,
* after taking note of the associated security risks. */
// $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;

/* Advance to next server for rest of config */
$i++;
}

/*
* Servers configuration
*/
//$i = 0;

/*
* First server
*/
//$i++;
/* Authentication type */
//$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
//$cfg['Servers'][$i]['host'] = 'localhost';
//$cfg['Servers'][$i]['connect_type'] = 'tcp';
//$cfg['Servers'][$i]['compress'] = false;
//$cfg['Servers'][$i]['AllowNoPassword'] = false;

/*
* phpMyAdmin configuration storage settings.
*/

/* User used to manipulate with storage */
// $cfg['Servers'][$i]['controlhost'] = '';
// $cfg['Servers'][$i]['controlport'] = '';
// $cfg['Servers'][$i]['controluser'] = 'pma';
// $cfg['Servers'][$i]['controlpass'] = 'pmapass';

/* Storage database and tables */
// $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
// $cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
// $cfg['Servers'][$i]['relation'] = 'pma__relation';
// $cfg['Servers'][$i]['table_info'] = 'pma__table_info';
// $cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
// $cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
// $cfg['Servers'][$i]['column_info'] = 'pma__column_info';
// $cfg['Servers'][$i]['history'] = 'pma__history';
// $cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
// $cfg['Servers'][$i]['tracking'] = 'pma__tracking';
// $cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
// $cfg['Servers'][$i]['recent'] = 'pma__recent';
// $cfg['Servers'][$i]['favorite'] = 'pma__favorite';
// $cfg['Servers'][$i]['users'] = 'pma__users';
// $cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
// $cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';
// $cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches';
// $cfg['Servers'][$i]['central_columns'] = 'pma__central_columns';
/* Contrib / Swekey authentication */
// $cfg['Servers'][$i]['auth_swekey_config'] = '/etc/swekey-pma.conf';

/*
* End of servers configuration
*/

/*
* Directories for saving/loading files from server
*/
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';

/**
* Whether to display icons or text or both icons and text in table row
* action segment. Value can be either of 'icons', 'text' or 'both'.
*/
//$cfg['RowActionType'] = 'both';

/**
* Defines whether a user should be displayed a "show all (records)"
* button in browse mode or not.
* default = false
*/
//$cfg['ShowAll'] = true;

/**
* Number of rows displayed when browsing a result set. If the result
* set contains more rows, "Previous" and "Next".
* default = 30
*/
//$cfg['MaxRows'] = 50;

/**
* disallow editing of binary fields
* valid values are:
*falseallow editing
*'blob'allow editing except for BLOB fields
*'noblob' disallow editing except for BLOB fields
*'all'disallow editing
* default = blob
*/
//$cfg['ProtectBinary'] = 'false';

/**
* Default language to use, if not browser-defined or user-defined
* (you find all languages in the locale folder)
* uncomment the desired line:
* default = 'en'
*/
//$cfg['DefaultLang'] = 'en';
//$cfg['DefaultLang'] = 'de';

/**
* How many columns should be used for table display of a database?
* (a value larger than 1 results in some information being hidden)
* default = 1
*/
//$cfg['PropertiesNumColumns'] = 2;

/**
* Set to true if you want DB-based query history.If false, this utilizes
* JS-routines to display query history (lost by window close)
*
* This requires configuration storage enabled, see above.
* default = false
*/
//$cfg['QueryHistoryDB'] = true;

/**
* When using DB-based query history, how many entries should be kept?
*
* default = 25
*/
//$cfg['QueryHistoryMax'] = 100;

/**
* Should error reporting be enabled for JavaScript errors
*
* default = 'ask'
*/
//$cfg['SendErrorReports'] = 'ask';

/*
* You can find more configuration options in the documentation
* in the doc/ folder or at .
*/
?>
--------------------------------------------------------------------
root@lsebsd:/usr/local/www/phpMyAdmin # cat config-db.php
--------------------------------------------------------------------

<?php
##
## database access settings in php format
## automatically generated from /etc/dbconfig-common/phpmyadmin.conf
## by /usr/sbin/dbconfig-generate-include
## Sat, 18 Jul 2015 09:53:22 +0800
##
## by default this file is managed via ucf, so you shouldn't have to
## worry about manual changes being silently discarded. *however*,
## you'll probably also want to edit the configuration file mentioned
## above too.
##
$dbuser='phpmyadmin';
$dbpass='123456';
$basepath='';
$dbname='phpmyadmin';
$dbserver='';
$dbport='';
$dbtype='mysql';
--------------------------------------------------------------------

来自为知笔记(Wiz)
附件列表

最新文章

123

最新摄影

微信扫一扫

第七城市微信公众平台