1> 准备工作 (本次安装使用amd64) 镜像下载地址: amd64: (242MB) i386: (238MB) 官方文档: 官方教程有详细图解: (2.94 MB, 下载次数: 2) 官方教程关于pkgsrc: (1.27 MB, 下载次数: 3)
2> 安装NetBSD5.1.2 3> NetBSD 基本配置- NetBSD/amd64 (Amnesiac) (console)
- login: root
- password:
- We recommend creating a non-root account and using su(1) for
- root access.
- # useradd -m -G wheel ko (添加普通用户ko 并将其加入wheel组)
- PS: 非wheel组用户 将无法使用su命令!
- # passwd ko (修改用户密码)
- Changing password for ko.
- New Password:
- Retype New Password:
- # grep ko /etc/master.passwd /etc/passwd /etc/group (检查一下成果)
- /etc/master.passwd:ko:$2s$07$dzN7dcbauWrbfrXoEIU1L.JckSJ16BipQAf5Qkuz67RY4EWQZkb.i:1000:100: :0:0: :/home/ko:/bin/sh
- /etc/passwd:ko:*:1000:100: : /home/ko:/bin/sh
- /etc/group:wheel:*:0:root,ko
复制代码- 时间调整 :
- # echo rtclocaltime=YES >> /etc/rc.conf
- # sh /etc/rc.d/rtclocaltime restart
- Setting RTC offset to -480.
- # sysctl kern.rtc_offset
- kern.rtc_offset = -480
- # ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
- # date (试试看是不是搞定了^_^)
复制代码- 网络配置 DHCP :
- # vi /etc/rc.conf
- hostname=netbsd.kotzu.org
- dhclient=YES
- auto_ifconfig=YES
- sshd=YES
- :wq
- 静态IP (单配置文件):
- # dmesg | grep -i ether (查看网卡信息)
- wm0 at pci0 dev 3 function 0: Intel i82540EM 1000BASE-T Ethernet, rev. 2
- wm0: Ethernet address 08:00:27:b1:13:d3
- # ifconfig -a (查看网卡详细信息)
- wm0: flags=8843 mtu 1500
- capabilities=2bf80
- 4CSUM_Tx,UDP4CSUM_Rx,UDP4CSUM_Tx,TCP6CSUM_Tx,UDP6CSUM_Tx>
- enabled=0
- address: 08:00:27:b1:13:d3
- media: Ethernet autoselect (1000baseT full-duplex)
- status: active
- # vi /etc/rc.conf
- hostname=netbsd.kotzu.org
- auto_ifconfig=YES
- defaultroute="192.168.1.1"
- ifconfig_wm0="inet 192.168.1.77 netmask 255.255.255.0"
- sshd=YES
- :wq
- 静态IP (多配置文件):
- # echo 'route add default 192.168.1.1' > /etc/mygate (网关)
- # echo 'inet 192.168.1.77 netmask 255.255.255.0' > /etc/ifconfig_wm0 (静态IP)
- # echo 'netbsd.kotzu.org' > /etc/myname (主机名)
- # echo 'auto_ifconfig=YES' >> /etc/rc.conf (# config all avail. interfaces)
- # echo 'sshd=YES' >> /etc/rc.conf (开机运行ssh服务)
- DNS :
- # vi /etc/resolv.conf
- nameserver 202.106.0.20
- nameserver 202.106.196.115
- :wq
- # reboot
复制代码 PS: 修改任何配置文件都需要重启相应服务,由于配置主机名,必须reboot... ^_^
4> PKG_ADD & PKGSRC- NetBSD/amd64 (netbsd.kotzu.org) (console)
- login: ko
- Password:
- NetBSD 5.1.2 (GENERIC) #0: Thu Feb 2 12:12:28 UTC 2012
- Welcome to NetBSD!
- netbsd$ su -
- password:
复制代码 配置binary 下载路径 :- csh/tcsh:
- netbsd# vi ~/.cshrc
- setenv PKG_PATH ftp://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/`uname -m`/5.1/All
- :wq!
- netbsd# source ~/.cshrc
- sh/ksh:
- netbsd# vi ~/.profile
- export PKG_PATH=ftp://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/$(uname -m)/5.1/All
- :wq!
复制代码 下载安装pkgsrc包 (相当于ports):- netbsd# wget ftp://ftp.netbsd.org/pub/pkgsrc/stable/pkgsrc.tar.bz2
- netbsd# cd /usr
- netbsd# tar -jxpvf ~/pkgsrc.tar.bz2
- netbsd# vi /etc/mk.conf
- FETCH_CMD=/usr/pkg/bin/wget -c -t3 -T10
- FETCH_BEFORE_ARGS=--passive-ftp
- FETCH_RESUME_ARGS=-c
- FETCH_OUTPUT_ARGS=-o
- :wq
- netbsd# cd /usr/pkgsrc/shells/bash/ && make install clean (安装bash)
- PS: 这里注意,设置了PKG_PATH就不能源码安装软件。。
- 建议: 源码安装su root, 非源码直接sudo ^_^
- 注意给普通用户.cshrc .profile 设置PKG_PATH, root就不要设置了!
复制代码 5> 安装 VIM/ tcsh/ wget/ pkgin/ sudo- netbsd# pkg_add -v vim
- netbsd# vim --version|head
- VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Apr 10 2012 07:16:09)
- Included patches: 1-446
- Modified by pkgsrc-users@NetBSD.org
- Compiled by cheusov@asrock.chizhovka.net
- ...
- ...
- netbsd# vim ~/.vimrc
- set nomodeline (这个一定要写,目前有这个安装漏洞)
- set nocp
- set hls is
- set ic
- set autoindent
- set backspace=2
- syntax on
- "set bg=dark (更改背景色调/默认为light, " 为注释!)
- :wq (详情:vimtutor)
- netbsd# pkg_add -v tcsh
- netbsd# which tcsh
- /usr/pkg/bin/tcsh
- netbsd# vipw (个人喜欢tcsh, 不喜勿改!)
- root:$2a$07$yTPbdv01yUA5YYDMuEBwye2zIPKjQzWfUq2UHUHnBs5BPHGQlnf6m:0:0: :0:0:Charlie &:/root:/usr/pkg/bin/tcsh
- ko:$2s$07$dzN7dcbauWrbfrXoEIU1L.JckSJ16BipQAf5Qkuz67RY4EWQZkb.i:1000:100: :0:0: :/home/ko:/usr/pkg/bin/tcsh
- netbsd# echo >> .cshrc set autolist (开启TAB键自动补全)
- netbsd# echo >> .profile set autolist (开启TAB键自动补全)
- netbsd# pkg_add -v wget
- netbsd# rehash
- netbsd# wget --version|head
- GNU Wget 1.13.4 built on netbsd.
- ...
- ...
- netbsd# pkg_add -v pkgin (如同yum/aptitude一样,自动解决依赖!)
- =======================================================
- $NetBSD: MESSAGE,v 1.3 2010/06/10 08:05:00 is Exp $
- First steps before using pkin.
- .Modify /usr/pkg/etc/pkgin/repositories.conf to suit your platform
- .Initialize the database :
- # pkgin update
- =======================================================
- netbsd# vim /usr/pkg/etc/pkgin/repositories.conf
- ftp://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/amd64/5.1/All
- :wq
- netbsd# rehash
- netbsd# pkgin update
- =======================================================
- netbsd# pkgin update (创建初始化packages数据库)
- netbsd# pkgin install (安装)
- netbsd# pkgin remove (删除)
- netbsd# pkgin upgrade (请 man pkgin)
- netbsd# pkgin full-upgrade (全部更新)
- netbsd# pkgin clean (清除package遗留的缓存 /var/db/pkgin/cache/)
- netbsd# pkgin search (搜索package信息)
- netbsd# pkgin avail | more (列出当前所有可用的package)
- netbsd# pkg_info (列出当前安装的package)
- =======================================================
- netbsd# pkgin install sudo
- netbsd# rehash
- netbsd# visudo
- /wheel
- ## Same thing without a password
- %wheel ALL=(ALL) NOPASSWD: ALL
- :wq
复制代码 6> 使用本地化语言(简体中文)- netbsd# vim ~/.cshrc
- export LANG="zh_CN.UTF-8"
- export LC_CTYPE="zh_CN.UTF-8" (字符类型)
- export LC_COLLATE="zh_CN.UTF-8" (字符对比规则)
- export LC_TIME="zh_CN.UTF-8" (时间类型)
- export LC_NUMERIC="zh_CN.UTF-8" (数字类型)
- export LC_MONETARY="zh_CN.UTF-8" (货币类型)
- export LC_MESSAGES="zh_CN.UTF-8" (消息/提示类型)
- export LC_ALL="zh_CN.UTF-8"
- :wq!
- netbsd# vim ~/.profile
- export LANG="zh_CN.UTF-8"
- export LC_CTYPE="zh_CN.UTF-8" (字符类型)
- export LC_COLLATE="zh_CN.UTF-8" (字符对比规则)
- export LC_TIME="zh_CN.UTF-8" (时间类型)
- export LC_NUMERIC="zh_CN.UTF-8" (数字类型)
- export LC_MONETARY="zh_CN.UTF-8" (货币类型)
- export LC_MESSAGES="zh_CN.UTF-8" (消息/提示类型)
- export LC_ALL="zh_CN.UTF-8"
- :wq!
复制代码 7> Xorg / Xfce / WQY 关于Xorg配置 : http://blog.chinaunix.net/uid-25256412-id-2939430.html- netbsd# pkgin install xfce4 gdm dejavu-ttf (安装xfce4)
- 根据提示把/usr/pkg/share/examples/rc.d下famd gdm hal dbus脚本cp 至/etc/rc.d/
- netbsd# vim /etc/rc.conf
- famd=YES
- rpcbind=YES
- dbus=YES
- hal=YES
- gdm=YES
- :wq
- netbsd# vim ~/.xinitrc
- exec xfce4-session
- :wq
- netbsd# wget ''
- netbsd# tar -jxvf wqy-zenhei-0.9.46-May.tar.bz2
- netbsd# mv wqy-zenhei /usr/X11R7/lib/X11/fonts/
- netbsd# cd /usr/X11R7/lib/X11/fonts/wqy-zenhei/
- netbsd# fc-cache -f -v
- netbsd# mkfontscale .
- netbsd# mkfontdir
复制代码 8> ibus-pinyin/ firefox- netbsd# pkgin install ibus ibus-pinyin ibus-table-chinese
- netbsd# vim ~/.xinitrc
- export XMODIFIERS=@im=ibus
- export GTK_IM_MODULE=ibus
- export QT_IM_MODULE=ibus
- ibus-daemon -d -r -x
- :wq
- netbsd# pkgin install firefox
复制代码 9> NetBSD市场占有率0.2% 10> Reserved for future use.... |