- 论坛徽章:
- 13
|
本帖最后由 ulovko 于 2013-04-06 11:14 编辑
官方简体中文安装手册:http://www.freebsd.org/doc/zh_CN/books/handbook/
官方en_US安装手册:http://www.freebsd.org/doc/en_US ... handbook/index.html
官方简体中文安装手册 下载: ftp://ftp.freebsd.org/pub/FreeBSD/doc/zh_CN/books/handbook/
FROM: http://blog.chinaunix.net/uid-25256412-id-2939430.html
1: 使用 USB 安装 FreeBSD(设备编号自行修改)- # dd if=9.1-RELEASE-amd64-memstick.img of=/dev/da1 bs=10240 conv=sync
复制代码 Tips: Windows环境下如何将 *.img 写入USB ?
Image Writer for Windows: https://launchpad.net/win32-image-writer/+download
:
win32diskimager-binary.zip
(5.4 MB, 下载次数: 6987)
安装过程中会询问关于网络配置,会许有的人配置不正确导致无法连接internet!
给出兄弟我的配置:
- > more /etc/rc.conf
- hostname="ko.kotzu.org"
- defaultrouter="192.168.1.1"
- ifconfig_alc0="inet 192.168.1.5 netmask 255.255.255.0"
- ifconfig_alc0_ipv6="inet6 accept_rtadv"
- # Wireless
- #wlans_ath0="wlan0"
- #ifconfig_wlan0="WPA DHCP"
- #ifconfig_wlan0="WPA inet 192.168.1.5 netmask 255.255.255.0"
- #ifconfig_wlan0_ipv6="inet6 accept_rtadv"
复制代码 还有一点关于WIFI !
着个其实不用写什么了!
官方文档有简体中文,写的非常详细!
下载页面:ftp://ftp.freebsd.org/pub/FreeBS ... 312/books/handbook/
在线观看:http://docs.freebsd.org/doc/9.0- ... twork-wireless.html
安装source 和 ports
等待重启完成 ...- # vi /boot/loader.conf
- loader_logo="beastie" (boot menu logo)
- autoboot_delay="3" (boot delay)
- :wq
- # vi /etc/rc.conf
- blanktime="600"
- saver="daemon"
- hald_enable="YES"
- dbus_enable="YES"
- powerd_enable="YES"
- powerd_flags="-a adaptive -b adaptive -n adaptive" # 保持温度不会过高就是了
- :wq
- # kldload coretemp
- # sysctl -a | grep temper
- hw.acpi.thermal.tz0.temperature: 60.0C
- dev.cpu.0.temperature: 59.0C
- dev.cpu.1.temperature: 59.0C
- dev.cpu.2.temperature: 59.0C
- dev.cpu.3.temperature: 59.0C
- dev.cpu.4.temperature: 61.0C
- dev.cpu.5.temperature: 62.0C
- dev.cpu.6.temperature: 59.0C
- dev.cpu.7.temperature: 59.0C
复制代码 检查一下硬件信息- # dmesg | grep attached (列出没有被驱动的硬件)
- # pciconf -lv (更加详细) /var/run/dmesg.boot (see also)
- (找到声卡 和 显卡加载相应驱动)
- # dmidecode (DMI table decoder)
复制代码 声卡 驱动- # kldload snd_driver (加载所有声卡驱动自动匹配)
- # cat /dev/sndstat (查看声卡驱动信息)
- # dmesg | grep hdac
- # cat filename > /dev/dsp (测试声卡,filename为任意文件产生噪音说明正常工作)
- # vi /boot/device.hints
- hint.pcm.0.vol="50" (pcm Module加载时,音量默认为50)
- :wq
- # Microphone (话筒)
- # mixer
- # sysctl dev.pcm.0.play.vchans=4
- # sysctl dev.pcm.0.rec.vchans=4 ( 虚拟声道(Virtual Sound Channels)4个音源能够同时播放)
- # sysctl hw.snd.maxautovchans=4
- # less /boot/defaults/loader.conf
- /snd (找到所有声卡驱动支持项)
- # pciconf -lv | egrep -i -A3 -B5 'audio|multimedia' (查看device 类型)
- # vi /boot/loader.conf
- snd_hda_load="YES" (启动时加载 声卡驱动/添加自己的声卡驱动)
- :wq
复制代码 2: 时间校准 (很重要)- # tzsetup (时区设置 CST)
- # ntpdate cn.pool.ntp.org (校准)
- # vi /etc/rc.conf
- ntpd_enable="YES" (配置开机启动 ntpd)
- ntpd_sync_on_start="YES"
- :wq
- # /etc/rc.d/ntpd start
- # vi /etc/ntp.conf
- server 1.cn.pool.ntp.org
- server 1.asia.pool.ntp.org
- server 2.asia.pool.ntp.org (配置time server)
- :wq
- # /etc/rc.d/ntpd restart
复制代码 3:更新 source 和 doc- # cp /usr/share/examples/cvsup/standard-supfile /etc
- # cd /etc/; vi standard-supfile
- *default host=cvsup.tw.freebsd.org (修改此项)
- *default base=/var/db
- *default prefix=/usr
- *default release=cvs tag=RELENG_9_0
- *default delete use-rel-suffix
- *default compress
- src-all
- doc-all tag=. (添加此项)
- :wq
- # csup /etc/standard-supfile
复制代码 4:ports 和 package 文件下载地址设置
- # vi /etc/make.conf (详情:man make.conf)
- MASTER_SITE_BACKUP?= \
- ftp://ftp.hk.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
- ftp://ftp.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
- ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/ (注意这里没换行了)
- MASTER_SITE_OVERRIDE?= ${MASTER_SITE_BACKUP}
- CPUTYPE?=core2 (根据情况调整,起到优化作用:me -> i7)
- # sysctl hw.model (more /usr/share/example/etc/make.conf)
- INSTALL=install -C (比对已安装文件与最新文件 版本号,低于新版本才安装)
- :wq
- 查看CPU支持指令集合:
- # grep -i features /var/run/dmesg.boot
- Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
- Features2=0x98e3fd<SSE3,DTES64,MON,DS_CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,SSE4.2,POPCNT>
- AMD Features=0x28100800<SYSCALL,NX,RDTSCP,LM>
- AMD Features2=0x1<LAHF>
- 查看当前操作系统开启的指令集合:
- # cd /usr/share/mk
- # make -V CPUTYPE
- core2
- # make -V MACHINE_CPU
- ssse3 sse3 amd64 sse2 sse mmx
- tcsh/csh:
- # vi ~/.cshrc
- setenv PACKAGEROOT ftp://ftp.tw.freebsd.org
- setenv PKG_TMPDIR /var/garbage (package安装后来这里看看:/var/db/pkg)
- :wq
- # exit (注销生效)
- sh/bash:
- $ vi ~/.profile
- export PACKAGEROOT=ftp://ftp.tw.freebsd.org
- export PKG_TMPDIR=/var/garbage
- :wq
- # exit (注销生效)
- #
- # pkg_add -r vim (使用远程服务器安装)
- # pkg_version -v (list outdated ports that have a newer version available in the Ports)
- # pkg_version -v |grep vim (首先查出版本号)
- # pkg_delete vim-7.3.81
- 或者:
- # pkg_delete /var/db/pkg/vim-7.3.81
- # pkg_delete xchat\* (使用通配符)
- # pkg_info |grep -i vim (首先查出版本号)
- # pkg_info -L vim-7.3.81 |less (显示这个软件包安装的所有文件)
- # pkg_info vim-7.3.81
-
复制代码 5: 更新 ports ( portmaster)- # portsnap fetch extract (首次更新port使用此命令)
- # portsnap fetch update (日后更新port使用此命令)
- vi /etc/crontab
- 0 5 * * * root /usr/sbin/portsnap cron update (自动更新port)
- :wq
复制代码 安装 portmaster 用于更新 软件包:
- # cd /usr/ports/ports-mgmt/portmaster && make install clean
- ----------------------------------------------------------------------
- # ls /usr/local/etc/portmaster.rc.sample
- # vim /usr/local/etc/portmaster.rc
- # Do not create temporary backup packages before pkg_delete (-B)
- NO_BACKUP=Bopt
- # Always delete stale distfiles without prompting (-d)
- ALWAYS_SCRUB_DISTFILES=dopt
- # Do not run 'make config' for ports that need updating (-G)
- PM_NO_MAKE_CONFIG=Gopt
- # Be verbose (-v)
- PM_VERBOSE=vopt
- # Save copies of old shared libraries (recommended) (-w)
- SAVE_SHARED=wopt
- :wq
- ----------------------------------------------------------------------
- # /usr/local/sbin/portmaster -L > portmaster.out (列出可更新的软件)
- ===>>> linux_base-fc-4_8
- ===>>> New version available: linux_base-fc-4_9
- # /usr/local/sbin/portmaster linux_base-fc-4_8 (更新 某软件)
- # /usr/local/sbin/portmaster -e openoffice.org-2.2.0 (卸载某软件与其依赖)
- #
- # portmaster -a (升级所有已安装的 ports)
- # portmaster -af (always rebuild ports overrides -i)
- # portmaster -r
- [-R] -r name/glob of port directory in /var/db/pkg
- rebuild the specified port, and all ports that depend on it. The
- list of dependent ports is built according to origin (i.e.,
- category/portname) not by the version number of the installed port.
- So if you do portmaster -r fooport-1.23 and it is necessary to
- restart using -R but the newly installed port is now fooport-1.24 you
- can do portmaster -R -r fooport-1.24 and it should pick up where you
- left off. The -r option can be specified more than once.
- # cd /usr/ports/sysutils/bsdadminscripts/ && make install clean
- > pkg_libchk (检查缺失的动态库,找出有问题的 ports)
- Thunar-1.3.0: /usr/local/lib/thunarx-2/thunar-sbr.so misses libpng.so.6
- Thunar-1.3.0: /usr/local/lib/thunarx-2/thunar-sbr.so misses libpng.so.6
- Thunar-1.3.0: /usr/local/lib/thunarx-2/thunar-uca.so misses libpng.so.6
- Thunar-1.3.0: /usr/local/lib/thunarx-2/thunar-uca.so misses libpng.so.6
- Thunar-1.3.0: /usr/local/lib/thunarx-2/thunar-uca.so misses libpng.so.6
- Thunar-1.3.0: /usr/local/lib/thunarx-2/thunar-uca.so misses libpng.so.6
- Thunar-1.3.0: /usr/local/lib/thunarx-2/thunar-wallpaper-plugin.so misses libpng.so.6
- Thunar-1.3.0: /usr/local/lib/thunarx-2/thunar-wallpaper-plugin.so misses libpng.so.6
- Thunar-1.3.0: /usr/local/lib/thunarx-2/thunar-wallpaper-plugin.so misses libpng.so.6
- Thunar-1.3.0: /usr/local/lib/xfce4/panel/plugins/libthunar-tpa.so misses libpng.so.6
- Thunar-1.3.0: /usr/local/lib/xfce4/panel/plugins/libthunar-tpa.so misses libpng.so.6
- Thunar-1.3.0: /usr/local/lib/xfce4/panel/plugins/libthunar-tpa.so misses libpng.so.6
- ...
- ...
- 另一种更新 软件包 的方法:
- # make deinstall && make install clean (前提是你的ports 已经更新!)
- 下面方法多用于 测试不同版本软件:
- # make install (注意没有:clean ,保留下载的源码!)
- # make deinstall && make reinstall (前提是下载的源码没有被清理!)
- # make PREFIX=/usr/pkg install clean (Changing the Install Path)
- Cleaning Up Ports:
- # make install clean (clean a port immediately upon install)
- You might also want to remove the original distfiles, stored in /usr/ports/distfiles.
- # make distclean (removes the distfiles for the current port and all dependencies)
- OR:
- # portmaster --clean-distfiles
- To clean the entire ports tree:
- # make clean -DNOCLEANDEPENDS ( run directly under /usr/ports)
- Building Packages:
- # make package
- This installs the program on the local machine and creates a package in the port’s directory.
- Simply copy this package to other systems and run pkg_add(1) to install it.
- If you create the directory /usr/ports/packages, the Ports Collection will
- create a packages tree in that location. Instead of placing the new package
- in the port’s directory, the port will place the package in the appropriate
- category under /usr/ports/packages.
- --------------------------------------------------------------------------------
- LOCAL PACKAGE REPOSITORIES
- Remember the PACKAGESITE environment variable? Set that to a path on your local
- anonymous FTP server (Chapter 17) or an NFS share (Chapter 8) and put your custom
- packages there. You can then use pkg_add -r on your other machines, and they will
- automatically grab packages from your local repository.
复制代码 6:Binary Updates ( only provides patches to the GENERIC kernel)
- # freebsd-update fetch (download the latest updates to your errata branch)
- ( files stored in /var/db/freebsd-update)
- # freebsd-update install (install the downloaded files)
- #
- # vi /etc/crontab
- 0 5 * * * root /usr/sbin/freebsd-update cron (自动更新至 errata-branch)
- :wq
- Reboot your system ..
复制代码 7:安装 Vim- # cd /usr/ports/editors/vim/
- # make WITHOUT_X11=yes install clean
- # exit (注销)
- # vim ~/.vimrc
- set nomodeline (这个一定要写,目前有这个安装漏洞)
- set nocp
- set hls is
- set ic
- set cindent
- set autoindent
- set backspace=2
- set nobackup
- set noswapfile
- set shiftwidth=2 ( 缩进为2个空格)
- set tabstop=2 (TAB 为2个空格)
- set softtabstop=2 (软制表符 为2个空格)
- set expandtab (缩进 和 制表符用空格代替)
- set ruler
- set mouse=v
- syntax on
- "set bg=dark (更改背景色调/默认为light, " 为注释!)
- :wq (详情:vimtutor)
- # vim ~/.cshrc
- setenv EDITOR vim
- :wq
复制代码 8:使用本地化语言- 方法一:Class Definitions
- # vim /etc/login.conf
- chinese:Chinese Users Account:\
- :charset=UTF-8:\
- :lang=zh_CN.UTF-8:\
- :tc=default:
- :wq
- # cap_mkdb /etc/login.conf (rebuilds the database file /etc/login.conf.db)
- pw usermod jacky -L chinese (修改 jacky 的 语言环境)
- pw useradd jacky -L chinese (添加 jacky 并使用中文)
- # pw usershow jacky
- jacky:*:1001:1001:chinese:0:0:jacky:/home/jacky:/bin/tcsh
- # su - jacky
- > 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=
- 方法二:User Definitions
- # vim ~/.login_conf
- me:\
- :lang=zh_CN.UTF-8:\
- :setenv=LC_CTYPE=zh_CN.UTF-8:\ (字符类型)
- :setenv=LC_COLLATE=zh_CN.UTF-8:\ (字符对比规则)
- :setenv=LC_TIME=zh_CN.UTF-8:\ (时间类型)
- :setenv=LC_NUMERIC=zh_CN.UTF-8:\ (数字类型)
- :setenv=LC_MONETARY=zh_CN.UTF-8:\ (货币类型)
- :setenv=LC_MESSAGES=zh_CN.UTF-8:\ (消息/提示类型)
- :setenv=LC_ALL=zh_CN.UTF-8:\
- :charset=UTF-8:
- :wq
- PS: 自定义 prompt 和 alias
- 方法一:全局设置
- vim /etc/csh.cshrc
- set prompt = "%B%n@%m [%/] $ " (详情:man csh /%m)
- set autolist (TAB命令补全功能)
- 方法二:自定义设置
- vim ~/.cshrc
- set prompt = "%B%n@%m [%/] # " (注意空格)
- set autolist (TAB 命令补全功能)
- alias cl clear
- alias vi vim
- alias df df -h
-
- History: (默认记录文件:~/.history)
- # history -c (清理当前历史记录)
- # history -S (保存当前历史记录)
复制代码 9: Axel / Aria2下载大文件利器 (MP3、影片、软件等) wget- # cd /usr/ports/ftp/axel && make install clean
- # axel -a -n 3 ftp://ftp.kernel.org/pub/linux/kernel/v2.4/linux-2.4.17.tar.bz2 (详情:man axel)
- # axel -S4 ftp://ftp.kernel.org/pub/linux/kernel/v2.4/linux-2.4.17.tar.bz2 (自动寻找 4 个最快mirror进行下载)
- 通常我用 wget 下网站 (找到资料就下吧!说不准那天站点没了,还是弄下来方便!)
- # wget -r -np -p -k --level=2 http://tldp.org/HOWTO/Linux+IPv6-HOWTO/ (wget默认安装)
- Aria2 :多链接下载,轻量,平均4-9MB内存使用量,BitTorrent下载速度2.8MiB/s时CPU占用约6%
- # cd /usr/ports/www/aria2 && make install clean
- (详情:man aria2c)
- # aria2c "http://example.org/mylinux.iso" (直接下载)
- # aria2c "http://host/file.zip" "ftp://host2/file.zip" (同时从 2 个不同源下载 某文件)
- # aria2c -x2 -k1M "http://host/file.zip" (-x2:一个server只建立 2 个连接 -k1M:man很详细)
- # aria2c -s4 http://host/file.zip (-s:总共启用多少个连接)
- # aria2c http://example.org/mylinux.torrent (BT 下载)
- # aria2c 'magnet:?xt=urn:btih:248D0A1CD08284299DE78D5C1ED359BB46717D8C' (BT Magent URI)
- # aria2c http://example.org/mylinux.metalink (Metalink)
- # aria2c -i files.txt -j2 (Download URIs found in text file -j:同时进行任务数)
- Resuming Download:
- Usually, you can resume transfer by just issuing same command (aria2c URI)
- if the previous transfer is made by aria2.
- If the previous transfer is made by a browser or wget like sequential download manager,
- then use -c option to continue the transfer (aria2c -c URI)
- BitTorrent Download:
- # aria2c --follow-torrent=mem "http://host/file.torrent" (download files from remote BT file)
- # aria2c --max-upload-limit=40k file.torrent (download using a local torrent file)
- Using Proxy:
- For HTTP
- aria2c --http-proxy="http://proxy:8080" "http://host/file"
- aria2c --http-proxy="http://proxy:8080" \
- --no-proxy="localhost,127.0.0.1,192.168.0.0/16" "http://host/file"
- For FTP
- aria2c --ftp-proxy="http://proxy:8080" "ftp://host/file"
- Proxy with Authorization
- aria2c --http-proxy="http://username:password@proxy:8080" "http://host/file"
- aria2c --http-proxy="http://proxy:8080" \
- --http-proxy-user="username" --http-proxy-passwd="password" "http://host/file"
- -------------------------------------------------------------------------------------------------------
- 也可以应用到ports下载中!(非必需,一般来说FreeBSD的 fetch够用了)
- # vim /etc/make.conf
- FETCH_CMD=/usr/local/bin/axel -a -S4 (-a:显示每个线程状态信息 -n:连接数)
- DISABLE_SIZE=yes (开启 此功能!)
- :wq
- 穿越模式:
- FETCH_ENV=http_proxy=ur address
- FETCH_ENV=ftp_proxy=ur address
- 或者 使用其他工具: (proxychains / runsocks)
- FETCH_CMD=proxychains axel
- FETCH_CMD=runsocks axel
- PS:wget axel aria2 配置均一样!
- FETCH_CMD=/usr/local/bin/wget -c -t 3 (-c:继续以前的下载 -t:默认tries =20)
- DISABLE_SIZE=yes (开启 此功能!)
- FETCH_CMD=/usr/local/bin/aria2c -s 4 (-s:开启4 个连接)
- DISABLE_SIZE=yes (开启 此功能!)
- (在Aria2速度不行的时候,我发现Axel速度确实可以!正常情况匹敌!)
复制代码 10:Scim-pinyin (fcitx-sunpinyin) (ibus-pinyin)输入法- # cd /usr/ports/chinese/scim-pinyin && make install clean
- > vim ~/.cshrc
- # set scim as the XIM input server
- setenv XMODIFIERS @im=SCIM
- :wq
- # xfce环境下,支持中文默认用英文情况下(Terminal内右键 Input Methods -SCIM)
- # cd /usr/ports/chinese/fcitx-sunpinyin && make install clean
- > vim ~/.cshrc
- setenv XMODIFIERS @im=fcitx
- setenv GTK_IM_MODULE xim
- setenv QT_IM_MODULE xim
- :wq
- > vim ~/.xinitrc
- #!/bin/sh
- /usr/local/bin/fcitx & # 确保比xfce提前运行!
- /usr/local/bin/startxfce4
- /usr/home/ko/start-compiz
- :wq
- # cd /usr/ports/chinese/ibus-pinyin && make install clean
- # more /usr/ports/textproc/ibus/pkg-message
- -------------------------------------------------------------------
- ibus installation finished. To use ibus, please do the following:
- If you are using bash, please add following lines to your $HOME/.bashrc:
- export XIM=ibus
- export GTK_IM_MODULE=ibus
- export QT_IM_MODULE=xim
- export XMODIFIERS=@im=ibus
- export XIM_PROGRAM="ibus-daemon"
- export XIM_ARGS="--daemonize --xim"
- If you are using tcsh, please add following lines to your $HOME/.cshrc:
- setenv XIM ibus
- setenv GTK_IM_MODULE ibus
- setenv QT_IM_MODULE xim
- setenv XMODIFIERS @im=ibus
- setenv XIM_PROGRAM ibus-daemon
- setenv XIM_ARGS "--daemonize --xim"
- If you are using KDE4, you may create a shell script in $HOME/.kde4/env,
- and add following lines:
- #!/bin/sh
- export XIM=ibus
- export GTK_IM_MODULE=ibus
- export QT_IM_MODULE=xim
- export XMODIFIERS=@im=ibus
- export XIM_PROGRAM="ibus-daemon"
- export XIM_ARGS="--daemonize --xim"
- Following input methods/engines are available in ports:
- chinese/ibus-chewing Chewing engine for IBus
- chinese/ibus-pinyin The PinYin input method
- japanese/ibus-anthy Anthy engine for IBus
- japanese/ibus-mozc Mozc engine for IBus
- japanese/ibus-skk SKK engine for IBus
- korean/ibus-hangul Hangul engine for IBus
- textproc/ibus-kmfl KMFL IMEngine for IBus framework
- textproc/ibus-m17n The m17n IMEngine for IBus framework
- textproc/ibus-table Table based IM framework for IBus
- and QT4 input method module, textproc/ibus-qt.
- If ibus cannot start or the panel does not appear, please ensure
- that you are using up-to-date python.
- There's a bug in python 2.5, which may prevent the panel from appearing.
- -------------------------------------------------------------------
- # vim ~/.xinitrc
- #!/bin/sh
- /usr/local/bin/ibus-daemon --xim -d # 确保比xfce提前运行!
- /usr/local/bin/startxfce4
- :wq
- # vim ~/.cshrc
- setenv XIM ibus
- setenv GTK_IM_MODULE ibus
- setenv QT_IM_MODULE xim
- setenv XMODIFIERS @im=ibus
- setenv XIM_PROGRAM ibus-daemon
- setenv XIM_ARGS "--daemonize --xim"
- :wq
复制代码 PS:
目前运行fcitx总是时不时的无法使用,切换到scim或者ibus没有任何问题!
这里所说不能使用是,无法进行输入操作! 悲剧。。O_o |
|