系統環境:openbsd 3.5
依下面操作後,openbsd中能使用中文,創作sgml文檔,能使用apache, mysql, php.娛樂方面是使用xmms聽歌,看電影,但只能觀看mpeg格式的影片.以後我會保持對此文檔的維護.
一、編譯新內核
依據dmesg的信息對/usr/src/sys/arch/i386/conf/GENERIC文件進行注釋, 做完這一個後, 再修改/usr/src/sys/conf/GENERIC文件, 需要注意一定要打開這個選項:
options COMPAT_LINUX
二、安裝程序
以下是我安裝的程序列表:
ORBit-0.5.13 aalib-1.2 atk-1.4.1 aumix-2.8 bash-2.05b bzip-0.21 bzip2-1.0.2 cdparanoia-3.a9.8 cvsup-16.1g-no_x11 docbook-4.2p1 docbook-dsssl-1.72 docbook-guide-2.0.8 esound-0.2.28 fvwm2-2.4.16 gawk-3.1.3 gettext-0.10.40p1 ghostscript-7.05p2 ghostscript-fonts-6.0 35 gimp-1.2.5 gkrellm-2.1.27 glib-1.2.10 glib2-2.2.3 gnuls-4.1 gtk+-1.2.10p1 gtk+2-2.2.4 imlib-1.9.14p2 iso8879-1986 ispell-3.2.06 jadetex-3.11 jpeg-6b libao-0.8.4 libaudiofile-0.2.5 libiconv-1.9.1 libid3tag-0.15.1b libmad-0.15.1b libungif-4.1.0b1 libxml-2.6.5 libxml1-1.8.17 linuxdoc-1.1 mozilla-firefox-0.8 mpeg_lib-1.3.1 mpg321-0.2.10 mysql-client-4.0.18 mysql-server-4.0.18 openjade-1.3 openmotif-2.1.30.5 p5-DBD-mysql-2.90.03 p5-DBI-1.38 p5-Net-Daemon-0.38 p5-PlRPC-0.2017 pango-1.2.5 php4-core-4.3.8 php4-mysql-4.3.8 png-1.2.5p2 popt-1.7 python-2.1.3p2 python-2.3.3 recode-3.6p1 redhat_base-8.0p4 sdl-1.2.6p0-sun sgmlformat-1.7 smpeg-0.4.4 t1lib-5.0.0 teTeX_base-2.0.2 teTeX_texmf-2.0.2p0 texi2html-1.64 tiff-3.6.1 unzip-5.50p2 wget-1.8.2 xdaliclock-2.18 xmms-1.2.7 xmms-esd-1.2.7 xmms-mp3-1.2.7 xmms-smpeg-0.3.5 xpdf-3.00 xv-3.10a zh-fonts-taipei-1.01 zh-rxvt-big5-2.7.8p0 zope-2.6.1 zope-cmf-1.3.3 zope-zwiki-0.27.1 zopebook-2.6
這些程序我都是下載tgz包安裝的.我將這些程序放在我的另一台機上, 這樣可以在每次重裝openbsd3.5後,可以快速的建立使用環境.你可以不安裝php, mysql, zope這幾個程序, 因為我是建立一個桌面環境外帶一個apache + php + mysql, 而且還想學學zope.
安裝mysql:
# pkg_add mysql-server-4.0.18.tgz
安裝後操作:
mysql=YES
修改/etc/rc.local, 加入:
if [ X”${mysql}” == X”YES” –a –x /usr/local/bin/mysqld_safe ]; then
fi
執行命令:
重啟系統.
# /usr/local/bin/mysqladmin –u root password setpassword
以後使用mysql:
# /usr/local/bin/mysql –u root –p
httpd_flags=””
也可以手工啟動:
/usr/sbin/apachectl start | restart | stop
安裝php:
# pkg_add php4-core-4.3.8.tgz
# /usr/local/sbin/phpxs –s
# cp /usr/local/share/doc/php4/php.ini-recommended /var/www/conf/php.ini
# pkg_add php4-mysql-4.3.8.tgz
# /usr/local/sbin/phpxs –a mysql
三、環境變量設置
需要在.cshrc中加入如下幾行:
set TERM=xterm set SGML_CATALOG_FILES=/usr/local/share/sgml/catalog set XML_CATALOG_FILES=/usr/local/share/xml/catalog setenv LC_CTYPE zh_CN.GB2312 setenv XMODIFIERS "@im=fcitx" alias jj openjade -E 0 -t sgml -V nochunks –d /usr/local/share/sgml/docbook/dsssl/modular/html/docbook.dsl alias mm mount_msdos /dev/wd1i /mnt
另外還在 set path行未加入 /usr/local/emul/redhat/usr/bin 保存.解壓我保存的fvwm配置文件:
tar xvfz fvwm.tar.gz or unzip fvwm.zip
另外修建.xinitrc文件, 文件內容:
fcitx & exec /usr/X11R6/bin/fvwm -f ~/.fvwm/.fvwm2rc
下面是關於 .fvwm2rc文件說明:
# be sure to customize these paths for your installation:
ModulePath /usr/X11R6/lib/X11/fvwm模塊的路徑名
PixmapPath /usr/X11R6/include/X11/pixmapsfvwm使用圖片的路徑, 桌面背景圖片就是放在這裡, 我使用的桌面背景圖片是:openbsddesktop.xpm
IconPath /usr/X11R6/include/X11/bitmaps
EdgeResistance 250 100
EdgeScroll 50 50當mouse移到桌面邊緣時, 桌面的移動情況
ClickTime 750
# make sure these fonts exist on your system:
WindowFont -adobe-times-bold-r-*-*-14-*-*-*-*-*-*-*窗口使用的字體
IconFont -adobe-helvetica-bold-r-*-*-10-*-*-*-*-*-*-*
HilightColor blue #898e84 窗口的高亮顯示時的顏色
MenuStyle #b0d5fc gray40 #49c671 -adobe-times-bold-r-*-*-12-*-*-*-*-*-*-* fvwm菜單使用的前景色, 背景色,陰影色, 字體類型
DeskTopSize 3x3 每一個虛擬桌面的大小
ColormapFocus FollowsMouse
# default Styles:
Style "*" BorderWidth 5, HandleWidth 5, NoHandles 在這裡我加了一個NoHandles, 也就是窗口不要柄
Style "*" Icon unknown1.xpm, Color green/#698593 定義窗口顏色
Style "*" MWMFunctions, MWMDecor, HintOverride
Style "*" DecorateTransient, NoPPosition
Style "*" IconBox -0 -1 +1 -1
Style "*" SloppyFocus, FocusFollowsMouse
Style "*" RandomPlacement, SmartPlacement
# Styles for various Fvwm modules:
Style "Fvwm*" NoTitle, Sticky, WindowListSkip
Style "Fvwm*" BorderWidth 2, CirculateSkipIcon, CirculateSkip
Style "FvwmPager" StaysOnTop
Style "FvwmBanner" StaysOnTop
Style "FvwmButtons" Icon toolbox.xpm, ClickToFocus
Style "FvwmButtons" BorderWidth 1, NoHandles
# Styles for your common terminal emulator programs:
AddToDecor terms
+ ButtonStyle 1 Pixmap mini.xterm.xpm
+ HilightColor blue #898e84
Style "XTerm" UseDecor terms
Style "XTerm" Icon xterm.xpm, SloppyFocus, IconBox -70 1 -1 -140
Style "rxvt" UseDecor terms
Style "rxvt" Icon term.xpm, SloppyFocus, IconBox -70 1 -1 -140
Style "rxvt" MWMBorder, MWMButtons
# Styles for various common programs:
Style "xcalc" Icon xcalc.xpm, NoButton 2,RandomPlacement,ClickToFocus
Style "xmh" Icon mail1.xpm, NoIconTitle,StickyIcon
Style "xmh" RandomPlacement, NoButton 2
Style "xman" Icon xman.xpm, RandomPlacement, ClickToFocus
Style "xmag" Icon mag_glass.xpm, RandomPlacement, ClickToFocus
Style "xgraph" Icon graphs.xpm, RandomPlacement, ClickToFocus
Style "xmosaic" Color Green/Yellow, ClickToFocus
Style "xdaliclock" NoTitle, NoHandles, Sticky, WindowListSkip, ClickToFocus你看到, 我的桌面上有一個電子鐘, 在這裡定義它的顯示類型, 這樣我就可以在每一個虛擬桌面上都看到它了。
在這裡定義的是應用程序圖標化後在桌面的顯示, 圖標文件要用絕對路徑.
Style "firefox" Icon /root/.fvwm/48/firefox48.xpm
Style "emacs" Icon /root/.fvwm/48/emacs.xpm
Style "gimp" Icon /root/.fvwm/48/gimp.xpm
Style "xpdf" Icon /root/.fvwm/48/xpdf.xpm
Style "xv" Icon /root/.fvwm/xv.xpm
Style "xmms" Icon /root/.fvwm/48/xmms.xpm
# some simple default key bindings:
Key Next A SCM Next
Focus
Key Prior A SCM Prev Focus
# some simple default mouse bindings:
# for the root window:
Mouse 1 R A Menu RootMenu Nop
Mouse 2 R A Menu Window-Ops Nop
Mouse 3 R A WindowList
窗口title上的各按鍵的定義說明
# for the title bar buttons:
Mouse 0 1 A Menu Window-Ops2 Close
Mouse 0 2 A Close
Mouse 0 4 A Maximize-Func
Mouse 1 6 A Iconify
# for other parts of the window/borders/icons:
Mouse 1 F A Resize-or-Raise
Mouse 1 TS A Move-or-Raise
Mouse 1 I A Move-or-Iconify
Mouse 2 I A Iconify
Mouse 2 FST A Menu Window-Ops2 Nop
Mouse 3 TSIF A RaiseLower
fvwm啟動時的初始函數,配置文件中使用的模塊要在這裡啟動
######################## Initialization Functions ############################
AddToFunc InitFunction "I" Module FvwmPager 0 3 虛擬桌面的啟動情況
+ "I" Module FvwmButtons
+ "I" Module FvwmAuto 500 Raise Nop
+ "I" Exec exec /usr/X11R6/bin/xpmroot /usr/X11R6/lib/X11/xdm/pixmaps/openbsd.xpm設置桌面背景圖片
fvwm重啟時的操作
AddToFunc RestartFunction "I" Module FvwmPager 0 3
+ "I" Module FvwmButtons
+ "I" Module FvwmAuto 500 Raise Nop
+ "I" Exec exec /usr/X11R6/bin/xpmroot /usr/X11R6/lib/X11/xdm/pixmaps/openbsd.xpm
下面是菜單的配置情況, 當你安裝了新的軟件時, 可以在這裡將它們加到菜單中去。
######################## Menus ###################
AddToMenu RootMenu "Root Menu%root.xpm%" Title
+ "XTerm%xconsole.xpm%" Exec exec xterm
#+ "" Nop
+ "Rxvt%rxvt.xpm%" Exec exec rxvt
#+ "" Nop
+ "Mozilla-Firefox%firefox.xpm%" Exec exec firefox
#+ "" Nop
+ "Gimp%gimp.xpm%" Exec exec gimp
#+ "" Nop
+ "XMMS%emacs.xpm%" Exec exec xmms
+ "Xpdf%pdf.xpm%" Exec exec xpdf
+ "Xv%xv-2.xpm%" Exec exec xv
+ "" Nop
#+ "Remote Logins" Popup Remote-Logins
#+ "" Nop
+ "Utilities%pkg.xpm%" Popup Utilities
+ "" Nop
+ "Fvwm Modules%module.xpm%" Popup Module-Popup
+ "Fvwm Window Ops%setting.xpm%" Popup Window-Ops
+ "Fvwm Simple Config Ops%config.xpm%" Popup Misc-Ops
+ "" Nop
+ "Refresh Screen%mypic2.xpm%" Refresh
+ "Recapture Screen%mypic1.xpm%" Recapture
+ "(Re)Start%restart.xpm%" Popup Quit-Verify
+ "" Nop
+ "Exit%exit-2.xpm%" Module FvwmForm QuitVerify
AddToMenu Misc-Ops "Misc Config Opts" Title
+ "Sloppy Focus" ChangeDefaultFocus SloppyFocus
+ "Click To Focus" ChangeDefaultFocus ClickToFocus
+ "Focus Follows Mouse" ChangeDefaultFocus FocusFollowsMouse
+ "" Nop
+ "Colormap Follows Mouse" ColormapFocus FollowsMouse
+ "Colormap Follows Focus" ColormapFocus FollowsFocus
+ "" Nop
+ "Full Paging ON" EdgeScroll 100 100
+ "All Paging OFF" EdgeScroll 0 0
+ "Horizontal Paging Only" EdgeScroll 100 0
+ "Vertical Paging Only" EdgeScroll 0 100
+ "Partial Paging" EdgeScroll 50 50
+ "Full Paging && Edge Wrap" EdgeScroll 100000 100000
AddToMenu Window-Ops "Window Ops" Title
+ "Move%mini.move.xpm%" Move
+ "Resize%mini.resize.xpm%" Resize
+ "Raise%mini.raise.xpm%" Raise
+ "Lower%mini.lower.xpm%" Lower
+ "(De)Iconify%mini.iconify.xpm%" Iconify
+ "(Un)Stick%mini.stick2.xpm%" Stick
+ "(Un)Maximize%mini.maximize.xpm%" Maximize
+ "" Nop
+ "Delete%mini.excl.xpm%" Delete
+ "Close%mini.cut.xpm%" Close
+ "Destroy%mini.destroy.xpm%" Destroy
+ "" Nop
+ "Refresh Window%mini.refresh.xpm%" RefreshWindow
AddToMenu Window-Ops2 "&Move%mini.move.xpm%" Move
+ "&Resize%mini.resize.xpm%" Resize
+ "R&aise%mini.raise.xpm%" Raise
+ "&Lower%mini.lower.xpm%" Lower
+ "(De)&Iconify%mini.iconify.xpm%" Iconify
+ "(Un)&Stick%mini.stick2.xpm%" Stick
+ "(Un)Ma&ximize%mini.maximize.xpm%" Maximize
+ "" Nop
+ "&Delete%mini.excl.xpm%" Delete
+ "&Close%mini.cut.xpm%" Close
+ "Destroy%mini.destroy.xpm%" Destroy
+ "" Nop
+ "ScrollBar" Module FvwmScroll 2 2
+ "Print" PrintFunction
#+ "Print Reverse" PrintReverseFunction
AddToMenu Module-Popup "FvwmModules" Title
+ "Identify" Module FvwmIdent
+ "Talk" Module FvwmTalk
+ "" Nop
+ "Button-Bar" Module FvwmButtons
+ "Pager" Module FvwmPager 0 0
+ "Pager (2 desks)" Module FvwmPager 0 1
+ "WinList" Module FvwmWinList
+ "" Nop
+ "Banner" Module FvwmBanner
+ "ScrollBar" Module FvwmScroll 50 50
+ "Background" Module FvwmBacker
+ "AutoRaise" Module FvwmAuto 200 Raise Nop
+ "Stop AutoRaise" KillModule FvwmAuto
+ "" Nop
+ "IconBox" Module FvwmIconBox
+ "IconMan" Module FvwmIconMan
+ "Form - QuitVerify" Module FvwmForm QuitVerify
AddToMenu Quit-Verify
+ "Restart Fvwm%mini.refresh.xpm%" Restart fvwm
+ "No, Don't Quit" Nop
######################## Sample Functions ##########################
AddToFunc MailFunction "I" Next [$0] Iconify -1
+ "I" Next [$0] Focus
+ "I" None [$0] Exec $0 $1
AddToFunc Move-or-Raise "I" Raise
+ "M" Move
+ "D" Lower
AddToFunc Move-or-Raise2 "M" Raise
+ "M" Move
+ "D" Lower
這裡我修改了最大化窗口時的情況:
AddToFunc Maximize-Func "M" Maximize 0 100
+ "C" Maximize 80 80(桌面的80%)
+ "D" Maximize 95 95 (桌面的95%)
AddToFunc Move-or-Iconify "I" Raise
+ "M" Move
+ "D" Iconify
AddToFunc Resize-or-Raise "I" Raise
+ "M" Resize
+ "D" Lower
AddToFunc Resize-or-Raise2 "M" Raise
+ "M" Resize
+ "D" Lower
AddToFunc PrintFunction "I" Raise
+ "I" Exec xdpr -id $w
AddToFunc PrintReverseFunction "I" Raise
+ "I" Exec xdpr 1/2 -h -rv -id $w
AddToFunc Iconify-and-Raise "I" Iconify
+ "I" Raise
# RLOGIN machine fg bg
AddToFunc RLOGIN "I" Exec xterm -fg $1 -bg $2 -e rlogin $0 -8
# TELNET machine fg bg
AddToFunc TELNET "I" Exec xterm -fg $1 -bg $2 -e telnet $0
AddToFunc FocusAndWarp "I" Focus
+ "I" WarpToWindow 2p 2p
AddToFunc DeiconifyFocusAndWarp "I" Iconify -1
+ "I" FocusAndWarp
AddToFunc ChangeDefaultFocus "I" Style "*" $0
+ "I" Recapture
############################################################################
# Now some keyboard shortcuts.
# Arrow Keys
# press arrow + control anywhere, and scroll by 1 page
Key Left A C Scroll -100 0
Key Right A C Scroll +100 +0
Key Up A C Scroll +0 -100
Key Down A C Scroll +0 +100
# press arrow + meta key, and scroll by 1/10 of a page
Key Left A M Scroll -10 +0
Key Right A M Scroll +10 +0
Key Up A M Scroll +0 -10
Key Down A M Scroll +0 +10
# press shift arrow + control anywhere, and move the pointer by 1% of a page
Key Left A SC CursorMove -1 0
Key Right A SC CursorMove +1 +0
Key Up A SC CursorMove +0 -1
Key Down A SC CursorMove +0 +1
# press shift arrow + meta key, and move the pointer by 1/10 of a page
Key Left A SM CursorMove -10 +0
Key Right A SM CursorMove +10 +0
Key Up A SM CursorMove +0 -10
Key Down A SM CursorMove +0 +10
# Keyboard accelerators
Key F1 A M Menu RootMenu
Key F2 A M Menu Window-Ops
Key F3 A M WindowList FvwmWinList
Key F4 A M Iconify
Key F5 A M Move
Key F6 A M Resize
Key F7 A M CirculateUp
Key F8 A M CirculateDown
#Page Up/Dapge Down keys are used to scroll by one desktop page
# in any context, press page up/down + control
# in root context, just pressing page up/down is OK
#
# I prefer the non-wrapping scroll. These are for example purposes only
#Key Next A C Scroll 100000 0
#Key Next R N Scroll 100000 0
#Key Prior A C Scroll -100000 0
#Key Prior R N Scroll -100000 0
################## FvwmButtons button-bar ################################
*FvwmButtonsBack #5c54c0
*FvwmButtonsGeometry 120x30+400-2定義電子鐘的大小和出現的位置
*FvwmButtons(Swallow(Respawn, NoHints) xdaliclock `Exec exec xdaliclock -bg gray40 -fg yellow -fn 12x24`) bg背景色, fg前景色, fn字體大小
上面的buttons配置是我的桌面上的電子鐘的配置情況
########################## Window-Identifier ###############################
# Just choose colors and a fonts
*FvwmIdentBack MidnightBlue
*FvwmIdentFore Yellow
*FvwmIdentFont -adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*
########################### Pager #########################################
*FvwmPagerRows 1 虛擬桌面排列行數
*FvwmPagerColumns 4 虛擬桌面排列列數
*FvwmPagerFont -adobe-helvetica-bold-r-*-*-10-*-*-*-*-*-*-*使用的字體
*FvwmPagerBack #5c54c0虛擬桌面的背景色
*FvwmPagerFore white虛擬桌面的前景色
*FvwmPagerHilight #6b64b0當前使用桌面的顏色
#*FvwmPagerGeometry 100x100-1-1
*FvwmPagerGeometry +0-0桌面面板的出現位置
*FvwmPagerLabel 0 "OpenBSD 3.5"每一個虛擬桌面的名稱, 當名稱中有空格時用雙引號括起來
*FvwmPagerLabel 1 Maker
*FvwmPagerLabel 2 Mail
*FvwmPagerLabel 3 Study
*FvwmPagerSmallFont 5x8
*FvwmPagerBalloons All
*FvwmPagerBalloonBack yellow
*FvwmPagerBalloonFore black
*FvwmPagerBalloonFont -adobe-times-bold-r-*-*-10-*-*-*-*-*-*-*
*FvwmPagerBalloonYOffset +2
*FvwmPagerBalloonBorderWidth 1
*FvwmPagerBalloonBorderColor black
# FvwmForm alias - query exit ala mwm
*QuitVerifyGrabServer
*QuitVerifyWarpPointer
*QuitVerifyFont *helvetica*m*r*n*18*
#*QuitVerifyButtonFont *helvetica*m*o*n*18*
*QuitVerifyButtonFont 7x13bold
*QuitVerifyFore Black
*QuitVerifyBack Light Gray
*QuitVerifyItemFore Gold
*QuitVerifyItemBack Gray40
# begin items
*QuitVerifyLine center
*QuitVerifyText "Do you really want to exit FVWM?"
*QuitVerifyLine expand
*QuitVerifyButton quit " Exit "
*QuitVerifyCommand Quit
*QuitVerifyButton quit "Cancel"
*QuitVerifyCommand Nop
四、中文環境
安裝ttf字體, 我將這個字體保存在truetype.tar.gz,
# mv truetype.tar.gz /usr/X11R6/lib/X11/fonts/ # tar xvzf truetype.tar.gz
修改/etc/X11/XF86Config:
Load "xtt" FontPath "/usr/X11R6/lib/X11/fonts/TrueType/" FontPath "/usr/local/lib/X11/fonts/chinese/"
下面的操作為:
# /usr/local/emul/redhat/sbin/ldconfig
從redhat 系統中復制出fcitx程序安裝的各種文件, 列表如下:
/usr/bin/fcitx
/usr/bin/fcitx.xft
/usr/share/fcitx/fcitx
/usr/share/fcitx/fonts/fonts.dir
/usr/share/fcitx/fonts/gbkst16.pcf.gz
/usr/share/fcitx/punc.mb
/usr/share/fcitx/pySym.mb
/usr/share/fcitx/pyphrase.mb
/usr/share/fcitx/sp.dat
/usr/share/fcitx/wbx.mb
將 /usr/bin下的兩個文件復制到 /usr/local/emul/redhat/usr/bin 目錄下;將 /usr/share/的整個fcitx目錄復制到 /usr/local/emul/redhat/usr/share/ 目錄下.
修改/usr/local/emul/redhat/usr/bin/fcitx文件, 即修改fcitx的路徑, 改為如下:
#!/bin/sh
xset +fp /usr/local/emul/redhat/usr/share/fcitx/fonts
/usr/local/emul/redhat/usr/share/fcitx/fcitx "$@"&
安裝emacs
從redhat 8.0系統中復制出emacs安裝的各種文件:
/usr/bin/emacs
/usr/bin/emacs-21.2
/usr/bin/emacsclient
/usr/libexec/emacs 整個目錄
/usr/share/emacs 整個目錄
將/usr/bin下的文件復制到 /usr/local/emul/redhat/usr/bin 目錄下, 將/usr/libexec/emacs整個目錄復制到 /usr/local/emul/redhat/usr/libexec目錄下, 將 /usr/share/emacs整個目錄復制到 /usr/local/emul/redhat/usr/share/目錄下.另外有一些man, info文件也可以復制到相應的目錄下, 這些可有可無, 我沒有進行復制.
從redhat 8.0中復制出如下文件:
操作完成後, 執行如下命令:
# cd /usr/local/emul/redhat/usr/bin
# ./emacs
所有操作完成