使用者工具

網站工具


freebsd:basic

SSHD

啟動系統內建的 SSH Server

# vim /etc/rc.conf

增加一行:

sshd_enable="YES"
# /etc/rc.d/sshd

.cshrc

安裝 gnuls

# cd /usr/ports/misc/gnuls ; make install clean
alias ls gnuls --color=auto

setenv  EDITOR  vim
setenv  PAGER   less
setenv  BLOCKSIZE       K

set prompt = '%n@%m:%~%# '

make.conf

複製 make 的設定檔(若檔案已經存在就不需要)。

# cp /usr/share/examples/etc/make.conf /etc/

修改 make.conf,新增 MASTER_SITE_BACKUP 及預設語系等設定。

# CVSup update flags.  Edit SUPFILE settings to reflect whichever distribution
# file(s) you use on your site (see /usr/share/examples/cvsup/README for more
# information on CVSup and these files).  To use, do "make update" in /usr/src.
#
SUP_UPDATE=yes
#
SUP=            /usr/local/bin/csup
SUPFLAGS=       -g -L 2
SUPHOST=        cvsup.tw.FreeBSD.org
SUPFILE=        /usr/share/examples/cvsup/standard-supfile
PORTSSUPFILE=   /usr/share/examples/cvsup/ports-supfile
DOCSUPFILE=     /usr/share/examples/cvsup/doc-supfile
X11BASE=${LOCALBASE}

MASTER_SITE_BACKUP?= \
   ftp://freebsd.csie.ncu.edu.tw/distfiles/${DIST_SUBDIR}/ \
   ftp://freebsd.csie.nctu.edu.tw/pub/distfiles/${DIST_SUBDIR}/
MASTER_SITE_OVERRIDE?=    ${MASTER_SITE_BACKUP}

... ... ...

WITHOUT_X11=yes
WITH_CHARSET=utf8
WITH_XCHARSET=complex

pkg_add

如果執行 pkg_add -r xxxxxx 時出現:

Error: FTP Unable to get ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-6-release/Latest/xxxxxx.tbz: File unavailable (e.g., file not found, no access)
pkg_add: unable to fetch 'ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-6-release/Latest/xxxxxx.tbz' by URL

代表套件庫裡面找不到檔案,可先到 ftp://ftp.tw.freebsd.org/pub/FreeBSD/ports/i386/ 網址確認有哪些版本可用,然後執行

# setenv PACKAGESITE ftp://ftp.tw.freebsd.org/pub/FreeBSD/ports/i386/packages-X-release/Latest/
將 X 替換成適合的值

來更換預設的套件下載站。

portupgrade

換版本分之

原本一直使用的主要版本,有可能會因為版本大更新,而做出一個分支,但是不想要換太大,可以透過 portupgrade 來切換到分支版本。例如:postfix 分支從 2.6 升級到 2.8,並且另外獨立了一個 postfix26 分支出來,此時可透過

portupgrade -o mail/postfix26 postfix

指令,將 postfix 的版本維持在 2.6 版。

另外,由 php5 要保持在 php52,要升級的套件非常龐大,可以利用別人寫好的 bash 語法來完成:

for d in `portversion -vL= | grep php5 | awk '{print $1}'`; do OLD=`echo $d | cut -d - -f 1,2`; NEW=`echo $d | sed s/php5/php52/ | cut -d - -f 1,2`; THEPATH=`whereis $NEW | awk '{print $2}' | cut -d / -f 4,5`; echo “portupgrade -o $THEPATH $OLD && \\”; done

會產生所有需要升級的指令,將結果複製貼上去執行就可以了!

Port 安裝時 MD5/SHA256 錯誤

如果在 Ports 編譯時,出現類似訊息:

# make
===>  Extracting for py26-sqlite3-2.6.2_1
=> No MD5 checksum recorded for python/Python-2.6.2.tgz.
=> No SHA256 checksum recorded for python/Python-2.6.2.tgz.
=> No suitable checksum found for python/Python-2.6.2.tgz.
*** Error code 1

Stop in /usr/ports/databases/py-sqlite3.

代表 /usr/ports/distfiles/python/Python-2.6.2.tgz 檔案下載時錯誤,刪除後重編就可以了。

根據出現錯誤的套件,刪除相對的檔案。

vimrc

set nocompatible

" Vim5 and later versions support syntax highlighting. Uncommenting the next
" line enables syntax highlighting by default.
syntax on
set nu

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Text options
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set noexpandtab
set shiftwidth=4
set softtabstop=4
set tabstop=4
set backspace=2
set formatoptions+=mM " so that vim can reformat multibyte text(eg. Chinese) 

set enc=utf-8
set fileencoding=utf-8
set termencoding=big5

" Favorite file types
set ffs=unix,dos
nmap <leader>fd :set ff=dos<cr>
nmap <leader>fu :set ff=unix<cr>

" If using a dark background within the editing area and syntax highlighting
" turn on this option as well
set background=dark

" Uncomment the following to have Vim jump to the last position when
" reopening a file
if has("autocmd")
  au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
    \| exe "normal g'\"" | endif
endif

" Uncomment the following to have Vim load indentation rules according to the
" detected filetype. Per default Debian Vim only load filetype specific
" plugins.
if has("autocmd")
  filetype indent on
endif

" The following are commented out as they cause vim to behave a lot
" differently from regular Vi. They are highly recommended though.
set showcmd     " Show (partial) command in status line.
"set showmatch      " Show matching brackets.
"set ignorecase     " Do case insensitive matching
"set smartcase      " Do smart case matching
"set incsearch      " Incremental search
"set autowrite      " Automatically save before commands like :next and :make
"set hidden             " Hide buffers when they are abandoned
"set mouse=a        " Enable mouse usage (all modes) in terminals
set ruler


""""""""""""""""""""""""""""""
" Status line
""""""""""""""""""""""""""""""
set laststatus=2    " Always hide the status line

"func! CurDir()
"   return substitute(getcwd(), "/home/tacolin", "~/", "g")
"endfunc

" Format the status line
"set statusline=\ %F%m%r%h\ %w\ \ CWD:\ %r%{CurDir()}%h\ \ \ Line:\ %l/%L
set statusline=\ %F%m%r%h\ %w\ [%{&ff}]\ [ASCI:\%3.3b]\ [POS:%3l,%3v:%3p%%]\ [LN:%L]
freebsd/basic.txt · 上一次變更: 2011/04/28 01:17 由 wenpei