FreeBSD
Links
- http://www.freebsd.org/
- 現在はFreeBSD 11.2&12.0-RELEASEが最新
- ftp://ftp.jp.freebsd.org/pub/FreeBSD/releases/ISO-IMAGES/
Virtual Machine Images
- https://download.freebsd.org/ftp/releases/VM-IMAGES/
- https://download.freebsd.org/ftp/releases/VM-IMAGES/README.txt
FreeBSD virtual machine disk images are available in various formats for several hypervisors. Disk image formats and the supported hypervisors are: vhd: VirtualPC, Hyper-V, Xen, VirtualBox vmdk: VMWare qcow2: Qemu, KVM raw: bhyve, other hypervisors that support unformatted raw disk image
cvsup -> csup / portsnap
現在ではcvsupは使う必要は無くなった.
- kernel関係: csup へ移行
- ports関係: portsnap へ移行
OS update
ソースアップデート (using subversion)
(メモ作成中)
- Appendix A. Obtaining FreeBSD
- A.4. Using Subversion
- アップデート手順例
(初回)
svn co svn://svn0.us-west.freebsd.org/base/stable/10 /usr/src
(2回目以降)
cd /usr/src svn update
- OS更新作業例
cd /usr/src make buildworld make buildkernel KERNCONF=??? make installkernel KERNCONF=??? shutdown -r now cd /usr/src make installworld mergemaster shutdown -r now
標準そのままの場合 KERNCONF=GENERIC
(obsolete) ソースアップデート (using csup, cvsup)
ソースからコンパイルする方法.
昔は cvsup で /usr/src を更新していたが,現在は csup を用いるようになった.
csup は FreeBSD 6 以降 base system に含まれている.使い方は cvsup と同じ.
-> 現在はこの方法もobsoleteとなり,subversionを使う方法に変更となった.
- csupのソースレポジトリ
- cvsupの使い方
- メジャーバージョンを2つ以上上げたい場合
- 基本的に,一気にメジャーバージョンを2つ以上上げようとすると失敗する.例えば,Version 6.x -> 8.x と更新したい場合は,6.x -> 7.x -> 8.x の順に更新する.
- http://www.mail-archive.com/freebsd-questions@freebsd.org/msg225203.html
- Now, directly updating from 6.2 to 8.0 may not work. You may find it necessary to do the update in stages: 6.2 -> 7.0 -> 8.0. Since about 5.4-RELEASE it has generally been the case that you can update pretty freely within a major version level (eg. 6.2 -> 6.4) and that you can update to the next highest major version level (eg 7.2 -> 8.0) by simply csup'ing and doing a normal buildworld cycle. It should be possible to do as you want and jump several major versions at once in the same way, but this is not tested anything like as much and may not work.
- csup実行手順例
cp /usr/share/examples/cvsup/stable-supfile . vi stable-supfile (tag書き換え) *default release=cvs tag=RELENG_7 (サーバ書き換え) csup stable-supfile
7-STABLE -> RELENG_7
バイナリアップデート (using freebsd-update)
バイナリアップデートの方法.
基本パターン
freebsd-update -r 11.2-RELEASE upgrade freebsd-update install shutdown -r now freebsd-update install (これ以降は検討の余地あり) portsnap fetch portsnap update portupgrade -afP --batch --results-file /tmp/ports.results.txt
- 参考:FreeBSD 7.0 へようこそ:第3回 freebsd-updateで楽々リリースサーフィン|gihyo.jp … 技術評論社
- 最後にパッケージ全入れ替えが必須になるので注意.
/etc/rc.conf
keymap="jp.106x" sendmail_enable="NO" saver="logo"
wlan
kldload wlan_wep ifconfig wi0 authmode open wepmode on ssid xxx wepkey xxx weptxkey 1 dhclient wi0
ports
更新作業 (using portsnap)
- portsnapの利用
portsnap fetch portsnap update
- References
設定 (/etc/make.conf)
- /etc/make.conf
MASTER_SITE_BACKUP?=ftp://ftp.jp.FreeBSD.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/ MASTER_SITE_OVERRIDE?=ftp://ftp.jp.FreeBSD.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/
- この作業をしておかないとダウンロード先が近場にならず,時間がかかるようになる.
最初にインストールするもの
- sudo, sysutils/{screen,tmux}, unzip, shells/{zsh,fd}
- japanese/kterm, x11/{mlterm,rxvt,rxvt-unicode}, ports-mgmt/{pkg_replace,portupgrade}, ftp/{wget,ncftp3,fget}
- japanese/lynx, japanese/ng
- emacs, japanese/{ddskk,dbskkd-cdb,skk-jisyo}, mail/mew, www/emacs-w3m (w3m-m17n が依存で入る)
- rdesktop, tightvnc
- net/xrdp
- x11-wm/icewm, japanese/tgif, graphics/xfig
- japanese/less, misc/lv
- print/texlive-full (LaTeX一式)
- print/{auctex,yatex}, editors/{texmacs,texmaker,texworks}, print/lyx, print/tgif2tex, japanese/dvi2tty, print/gv
- japanese/plain2
- sysutils/pdumpfs
- screenはpackageにできないのでportsからインストール
Apache
apache の更新は apr まわりでトラブルが発生しやすいように思われる.
- apr の更新
cd /usr/ports/devel/apr1 make config (LDAPまわりでエラーが出るときなどはLDAPのオプションを有効にする) make pkg_deinstall <古いapr> (パッケージ名の変更により make deinstall できない場合あり) make install clean
- mod_ldap
(in httpd.conf) LoadModule ldap_module libexec/apache22/mod_ldap.so
phpPgAdmin
PHPのバージョンとphpPgAdminが想定しているPHPのバージョンの違いによるトラブルあり.
rdesktop
うまくportupgradeできない場合下記のようにする
portupgrade -M 'CPPFLAGS=-I/usr/local/include' rdesktop
portaudit (security)
- ttt: (FreeBSD) portauditでportsのセキュリティチェック (obsolete)
- excerpts
- portauditをインストールすると、/usr/local/etc/periodic/security/410.portaudit というファイルが作られ、これにより、cronでdailyが実行されるときに、ついでにportauditも実行されるようになります。
- portauditでプロキシーサーバを指定する
- excerpts
- portauditの警告を無視してportsをインストールする (obsolete)
- make -DDISABLE_VULNERABILITIES
- pkg_replace -m -DDISABLE_VULNERABILITIES foo
memo
- Speed up installing from ports (howto) | FreeBSD - the unknown Giant
- checksum無視
- make NO_CHECKSUM=yes
- ftp/ftpcube (FTP client with GUI)
- graphics/zphoto (写真一覧WWWページ作成)
- deskutils/alexandria (ISBN等で図書管理)
- devel/ruby-zoom (http://ruby-zoom.rubyforge.org/ ) に依存しているが Makefile に記述されていないようなので手動で別途インストールする必要あり
- multimedia/vlc (Video LAN client)
- 依存関係たくさんあり
- www/youtube_dl
X Window customization
xorg.conf
- Swap CTRL-CAPS
- Option "XkbOptions" "ctrl:swapcaps"
- Japanese keyboard
- Option "XkbModel" "jp106"
- Option "XkbLayout" "jp"
- wheel mouse
Section "InputDevice" Identifier "Mouse0" Driver "mouse" Option "Protocol" "auto" Option "Device" "/dev/sysmouse" Option "ZAxisMapping" "4 5 6 7" EndSection
- 【FreeBSD】Matrox Millennium G550をX.org 7.2で利用する
- /usr/local/lib/modules/drivers/{mga_drv.so,mga_hal_drv.so}
- /usr/local/lib/xorg/modules/drivers
xmodmap (keyboard)
Setup
UEFI
- 2面目のFreeBSD領域からの起動方法 (https://www.starlink.jp/freebsd/ )
gdm
/etc/rc.conf:
gdm-enable=YES
clips
[FreeBSD-users-jp 89010] 無線 LAN 接続不可
/etc/rc.conf の ifconfig_wi0 の指定で ifconfig の起動時指定ができるの
で,/etc/rc.conf で
ifconfig_wi0="inet 192.168.0.100/24 ssid ESSID weptxkey 1 wepkey 1:WEPKEY wepmode on"
とした方が設定が分散せずメンテしやすいかと思います.
LaTeX
- 基本的に print/texlive-full を入れるだけでよい
admin
lsof
swap file
インストール後にswap領域を追加したくなった場合など
Disk copy
故障したハードディスクのデータをコピー
- recoverdisk (/sbin/recoverdisk)
- FreeBSD LiveCDから利用可能
- ddrescue (sysutils/ddrescue)
- dd_rescue(sysutils/dd_rescue)
Disk backup
# /sbin/dump -0uan -f - /usr | gzip -2 | ssh1 -c blowfish \ targetuser@targetmachine.example.com dd of=/mybigfiles/dump-usr-l0.gz
- ports/sysutils/ufs_copy + Freesbie
Disk replacement
- FreeBSD QandA 1859
- Q. FreeBSDのインストールが終った HDD を まるごとコピーしたいのですが、具体的な手順を教えてください。
CPU調査・管理
- sysutils/cpuburn
- sysutils/fvcool (i386 only)
- sysutils/x86info
- misc/cpuid
- man cpufreq (sysutils/est)
Linux上でFreeBSDのパーティションをマウント
- LinuxでFreeBSDのパーティションをマウントする
要点:
# mount -t ufs -r -o ufstype=ufs2 /dev/sdb9 /mnt/freebsd_usr
using USB-Serial cable (ELECOM UC-SGT)
/boot/loader.conf
ucom_load="YES" uplcom_load="YES"
dmesg
ucom0: <vendor 0x056e product 0x5003, class 0/0, rev 1.10/0.01, addr 2> on uhub0 ucom0: vendor 0x056e product 0x5003, rev 1.10/0.01, addr 2
access
% sudo cu -l /dev/cuaU0
- cuの終了: ~.
References
Japanese
xpdf
- japanese/xpdf
- print/adobe-cmaps
/usr/local/etc/xpdfrc に下記を追加しないと日本語表示ができない
cMapDir Adobe-Japan1 /usr/local/share/fonts/adobe-cmaps/aj16/CMap/ cMapDir Adobe-Japan1 /usr/local/share/fonts/adobe-cmaps/aj20/CMap/
- 参考
- pdftotext
Misc.
xz trouble
portsでコンパイルするとxzのメモリ制限関係のエラーが出ることがある.xzのオプション設定で対処可能だが,setenv XZ_OPT ではなぜかうまくいかないので, /usr/ports/Mk/bsd.commands.mk を直接編集するのがとりあえずの対処.
(http://forums.freebsd.org/showthread.php?t=15522 から抜粋)
- /usr/ports/Mk/bsd.commands.mk
... .if exists(/usr/bin/xz) XZ_CMD?= /usr/bin/xz -Mmax .else XZ_CMD?= ${LOCALBASE}/bin/xz -Mmax .endif ...
trace tools
- truss
- ktrace
- strace (ports)
pkgdel
echo sudo pkg_delete -f `pkg_info | awk '{print $1}' | egrep $1`
pkgver
pkg_version -v | egrep -v up-to-date
awk 'BEGIN {print "sudo portupgrade -pO \\"} \!/^#/ {print $1 " \\"}' awk 'BEGIN {print "sudo portupgrade -pO \\"} \!/^#/ {if ($1 != "") {print $1 " \\"}}'
dmesg
/var/run/dmesg.boot
Xinput
- http://xjman.dsl.gr.jp/XF32/RELNOTE-3.html
- http://www2.tky.3web.ne.jp/~mizk/xinput/XInput-HOWTO-3.html
- http://www.gtk.org/~otaylor/xinput/
- http://ftp.x.org/pub/X11R7.1/doc/RELNOTES3.html#7
USB Camera
sendmail
- /etc/mail/freebsd.mc をコピー
- cp freebsd.mc foo.mc
- dnl define(`SMART_HOST', `your.isp.mail.server') の行を有効化,SMTPサーバ名記入
- make foo.cf
- cp foo.cf sendmail.cf
- /etc/rc.d/sendmail stop
- /etc/rc.d/sendmail start
- /etc/hosts, /etc/mail/local-host-names を適宜修正
- esmtpの利用も検討 (flexibility)
USB-serial
- ELECOM UC-SGT
updating gnome
/usr/X11R6/lib/libgtk-x11-2.0.la: No such file or directory
/usr/ports/UPDATING 見て下さい。 gnome 2.16 になって、/usr/X11R6 から/usr/local と GNOME components が移動しています。 真っ当な対処法は時間はかかりますが pkgdb -Ff portupgrade -rf pkg-config\* ===================================== 20061014: AFFECTS: All GTK+2 and GNOME users AUTHOR: gnome@FreeBSD.org GNOME has been updated to 2.16. All GTK+2 and GNOME components have been moved from X11BASE (/usr/X11R6) to LOCALBASE (/usr/local). To upgrade your GNOME desktop or/and other applications you will need to use either sysutils/portupgrade or sysutils/portmaster. To use portmaster, make sure you have least 1.9 version to have the upgrade succeed. Portupgrade users: pkgdb -Ff portupgrade -rf pkg-config\* Portmaster users: portmaster -r pkg-config\*
ezjail
時計問題
/boot/loader.conf
hint.apic.0.disabled="1"
/etc/sysctl.conf
kern.timecounter.hardware=i8254
FIVA102S + FreeBSD-6.2-RELEASE では時計が進む問題があったが,上記2点とも設定しないと改善しなかった(sysctl.confのみのケースは試していない).
FIVA206 + FreeBSD-7.0-CURRENT でも同様の問題があったが,sysctl.confのみ設定してみたところ症状が治まった.102Sでもloader.confの設定は無くても大丈夫かもしれない.
PPTP client
http://seclan.dll.jp/ccilmyip.htm
screen
.screenrc
escape ^z^z
- 最近はtmuxらしい
tmux (sysutils/tmux)
IPv6 related
- FreeBSD で IPv6
- /etc/rc.conf
ipv6_enable="YES" ipv6_network_interfaces="fxp0"
- Invalid argument or cannot assign requested address
- keywords: Java, IPv6, JDBC
-Djava.net.preferIPv4Stack=true
Linux watch command
/usr/ports/sysutils/cmdwatch
が同じ機能
gio-fam-backend problem
Firefox, Chrome 等起動時にエラーが出るときの対処
/usr/local/lib/gio/modules/libgiofam.so: Undefined symbol "g_local_directory_monitor_get_type"
対処法:
% sudo pkg delete gio-fam-backend
BSDカーネルの設計と実装―FreeBSD詳解
[os]