顯示具有 FreeBSD 標籤的文章。 顯示所有文章
顯示具有 FreeBSD 標籤的文章。 顯示所有文章

2009年3月2日 星期一

ASUS EEE Box202 and FreeBSD


Some notes on the operation of the Asus EEE Box202 with FreeBSD.

The machine I tested came with 160GB disk, 1GB ram, pre partitioned with Windows XP.

[From ASUS EEE Box202 and FreeBSD]

EeeBox looks like a very good alternative to the Mac Mini in terms of form factor and function, minus OS/X. But if I can use FreeBSD on it, it is almost the same to me. Wired and wireless.




2008年12月24日 星期三

大肥姊對 FreeBSD 7.1RC 的一些感想 - 關於軟體工程

[From FreeBSD 7.1 - delphij's Chaos ]


(很有趣,大肥姊用的佈景主題剛好跟我的完全一樣:minimalist_red on MT。)


我覺得他的這段話是很有道理的:



ports/ 是否有必要随 src/ 冻结?我认为意义不大,因为多数用户并不会使用光盘附带的 package,甚至于使用 -STABLE 的 package 会成为阻碍在 -STABLE 分支中增加新的 API 的障碍



從 2001 年開始,我的零號機 chihiro(千尋) 就一直是 -current 機;從最早的 5-current 一直用到現在的 8-current。除了早期的 SMPng 的不穩定以外,從 7-current 開始,已經可以穩定到可以當作半 production 在用了。所以後來規劃新的幾台機器的時候(sh-mail, kiki),都直接採用 8 - current codebase。


這幾天和 macports 說掰掰,其實有些原因,最大的原因,居然是『因為 FreeBSD ports 太好用了』。有了 dougb@ 的 portmaster (還有以前 knu@ 的 portupgrade 套件),管理系統上安裝的軟體對 FreeBSD admin 來說,變得相對容易。機器少的時候每台自己 portsnap 更新,自己 build/fetch package;如果開農場,就做幾台機器出來當作 package builder,造出不同版本的套件來讓每台機器使用。最重要的是,ports 每個 maintainer 辛苦維護 -HEAD 對每一個 production version 的 FreeBSD 相容性,所以雖然 6-STABLE, 7-STABLE, 8-CURRENT 三個不同的版本系列不斷更新,ports 卻還是能維持相當程度的可用性,只要是系統上有的 library 都盡量引用,避免重複安裝。


反觀 macports 的哲學,就是“我要裝我自己的“。拿 Python 來說好了,10.5 裡面內建 2.5 完整版和 2.3 runtime,但是如果想要用 macports 來裝 trac 系統,macports 會堅持在 10.5 上面再安裝一次 python 2.5,然後才安裝 trac,美其名是『保證所有運作環境的一致性』,實際上卻頗疊床架屋。(至少 Python 應該尊重系統內的 framework 架構,優先使用系統內建版本)如果還考慮到安裝了 Xcode 要使用 PyObjC,問題就更麻煩了。為了安裝個 mtr 或是 axel,拉進一堆 dependancy 的做法,感覺有點不乾淨。


回到 FreeBSD ports 的問題,我認為甚至可以不需要跟 pkgsrc 一樣,維護每季一次的 pkgsrc-release (or called stable?),ports 的 -HEAD 就已經足夠應付 FreeBSD 本身的版本演進了。如果系統管理員認為,只需要 security fix,其實可以手動選擇要升級的套件。除非遇到 gettext 大升級這種數年一次的事件,不然每個 package 要不要升級,管理員都是可以自己決定的。




2008年11月20日 星期四

LISA '08 Technical Sessions by Jordan K. Hubbard

這是 JKH 的投影片


自從他去 Apple 上班以後,出現在 FreeBSD mailing list 的次數好像可以數得出來,另外一位大老 Terry Lambert 也是。投影片我比較有興趣的是



  • launchd


  • ASL


  • DTrace


  • Directory Service


Dtrace 在 FreeBSD 上面已經有了,rc.d 系統使用上方便性可以跟 launchd 比,但是我覺得 rc.conf 的設定檔比較有可讀性,不過 launchd 可以區分系統和 local session 又是一個強項,感覺就是個 private rc.d。


ASL 是用來取代 syslogd 的,Directory Service 除了 local users, groups 以外,還可以對外接 OpenDirectory/ActiveDirectory。




2008年6月6日 星期五

Checking out FreeBSD with Subversion


Taken from Peter Wemm's notes on FreeBSD Subversion repository, the procedure for a normal user to checkout FreeBSD via subversion would be:


Set $ROOT for Subversion server with your choice of the dressing:


svn://svn.freebsd.org:53690/base/ - like webdav, but faster. uses streaming protocol. Temporary port.

svn://svn.freebsd.org/base/ - permanent address of above once firewall is updated.


Then pick your flavor of release/stable/current


svn co $ROOT/head -> ./head/{bin,sbin,...}

svn co $ROOT/head src -> ./src/{bin,sbin,...}. You probably want this.



RELENG_[4567] is /stable/[4567]/{bin,sbin,...}

RELENG_[4567]_[0-9] is /releng/[4567]_.[0-9]/{bin,sbin,...}

RELENG_[4567]_[0-9]_[0-9]_RELEASE is /release/[4567]_[0-9]_[0-9]/{bin,sbin,...}

eg:

RELENG_7 -> /stable/7/*

RELENG_7_0 -> /releng/7.0/* (release eng, errata, security, etc)

RELENG_7_0_0_RELEASE -> /release/7.0.0/* (static release tag)


Sounds simple.



2008年3月24日 星期一

Darwin Calendar Server on FreeBSD


最近用 iCal + Mail + Address Book 用出點心得來了,想說自己架個 calendar server 當作 internal shared calendar 不知道可不可以。 ThunderBird + Lightning 或是 Sunbird 應該也有支援 CalDAV/WebDAV 的更新方法。


參考這篇把 Darwin Calendar Server 裝在 FreeBSD 上面:


Installing the Darwin Calendar Server on FreeBSD


#6 提到的 setuptools 在系統內的已經是 0.6c8,不需要手動更新,只要把 xattr 抓下來安裝即可。



2008年3月13日 星期四

The life, is too crazy » How To FreeBSD UTF-8


The life, is too crazy » How To FreeBSD UTF-8:


長輩的文章裡提到


convmv。檔名/目錄Big5UTF-8請安裝converters/convmv-r是遞迴,–notest下去就是直接幫你改掉了,請先測試並小心使用。

ychsiao@FreeBSD [~/tmp] [22:41/W2] convmv -f big5 -t utf-8 -r –notest *
mv “CCNP/CCNP642-831Ч.pdf” “CCNP/CCNP642-831教材.pdf”





今天測試過以後,發現常常會發生"Skipping, already UTF-8",後來經過 mhsin 提醒,需要加上 --nosmart 才會成功。



2008年1月25日 星期五

<em>newsyslog</em> for Apache logs

I have been using newsyslog for Apache logs for quite a while. They provide better management than rotatelog and has a centralized view for configuration files. The only problem I have, is that I get
Jan 27 00:00:00 fred newsyslog[4489]: logfile turned over

all the time, and Apache would stop recording anything after the log has been turned over. Luckily, I found this on FreeBSD Diary that solves my problem. Let's see if this works out.


2007年7月16日 星期一

Postfix + ClamAV Milter on FreeBSD

剛好台北同事問起,就來寫個簡單的 Howto 好了


  1. Update ports collection

  2. 安裝 ports-mgmt/portconf
    這個 util 不管是破大師或是破升級都可以用,會在 /etc/make.conf 裡面加上以下的字串:

    # Begin portconf settings

    # Do not touch these lines

    .if !empty(.CURDIR:M/usr/ports*) && exists(/usr/local/libexec/portconf)

    _PORTCONF!=/usr/local/libexec/portconf

    .for i in ${_PORTCONF:S/|/ /g}

    ${i:S/%/ /g}

    .endfor

    .endif

    # End portconf settings

    另外,可以在 ${LOCALBASE}/etc/ 裡面加一個 ports.conf,給你放 ports 的 make args

  3. 在 ${LOCALBASE}/etc/ports.conf 裡面加上以下行:

    security/clamav: CLAMAVUSER=postfix | CLAMAVGROUP=postfix

    因為我們要讓 ClamAV 使用 milter, 那 log 和 clamav 的目錄都必須由 postfix user 讀寫。

  4. 安裝 security/clamav

  5. 修改 ${LOCALBASE}/etc/clamd.conf, ${LOCALBASE}/etc/freshclam.conf,把裡面的 user 都改成 postfix

  6. 安裝 mail/postfix, 在 ${LOCALBASE}/etc/postfix/main.cf 裡面加上
    smtpd_milters = unix:/var/run/clamav/clmilter.sock

    這一行也要加到 /etc/mail/sendmail.cf 裡面,先搜尋 Input mail filters,在後面加上:
    Xclamav, S=local:/var/run/clamav/clmilter.sock, F=T, T=S:4m;R:4m



這麼一來,剩下 /etc/rc.conf 裡面加上 clamd_enable="YES", clamd_milter_enable="YES",至於 freshclam,就隨喜啟動吧~
順道一提,clamav-0.90.3 啟動的時候非常慢,最近ports裡面更新了 0.91,啟動速度從原來超過150秒變成5秒,記得要升級成 0.91 版啊~



2007年3月16日 星期五

Apache + Subversion (WebDAV)

How To Configure Web Access To Subversion Repositories Using Apache | HowtoForge - Linux Howtos and Tutorials

把Apache + Subversion 配合 TortoiseSVN,應該可以解決大多數文件版本控管的問題。至於Excel/Word/Visio這類的超大blob diff 就算了吧~



2007年1月26日 星期五

2006年10月17日 星期二

萬里防火牆萬里長 防火牆外面是故鄉

[保留] 关于收到aaazzzaaazzzaaazzzaaazzzaaazzz邮件的原因(已有结论) - ChinaUnix.net

今天iyuan跟我說收到內容是亂碼的信,想起來前一陣子我也收到這樣的東西,本來以為是台北的mail server出問題,沒想到去google一下,發現連 delphij 也碰上了。最後找到上面這串討論,頗精采。

真是萬里防火牆萬里長~ The Great Firewall of China



2006年10月13日 星期五

Disable SSH Shell access while retaining SCP/SFTP


11:37 < leafy_> can sftp-enabled server prohibit ssh?

11:37 < appa_x> Yes.

11:38 < appa_x> Set their shell to scponly

11:38 < appa_x> and use AllowUsers or AllowGroups to restrict shell access.



2006年7月22日 星期六

JRE在FreeBSD底下顯示正確中文的秘技

一直以來,被FreeBSD下的X locale + Java的中文問題困擾很久。每次都去動 fonts.gg.yy.properties,換個字體馬上爆炸。從以前用的新細明體、simhei.ttf到現在的微軟正黑體,只要換一次字體就要來個大手術。這次裝了Diablo 1.5,更是完全不知道從何下手,原始碼只附送了一個 fontconfig.properties.src,裡面壓根沒提到 iso-10646-1。想到要手動把每一種字體都加進去都快抓狂了。沒想到,這個網站的方法真是簡單到一種境界,只要:

sudo ln -s /usr/X11R6/lib/X11/fonts/TTF ${JAVA_HOME}/lib/fonts/fallback

一切天下太平....雖然中文字還是粉醜,但是繁簡中可以一起顯示不再有框框的問題。真是絕招中的絕招、秘技中的秘技啊~

2006年5月31日 星期三

FreeBSD 7-current + pf + apache22 + MPM=event

餅乾大事紀 � Blog Archive � apache22 MPM=worker 遇到神秘問題

看到類似的configuration覺得備感親切。FreeBSD >5的中文參考資料越來越零散了,好像都只能自己去定 freebsd-*@freebsd.org 來看才行。

跑 -current 有一陣子了,pf也有開,然後還很大膽地用了 apache22 + event MPM,top(1)出來還蠻美的


last pid: 15917; load averages: 0.02, 0.03, 0.05 up 1+05:58:33 11:30:26
166 processes: 1 running, 165 sleeping
CPU states: % user, % nice, % system, % interrupt, % idle
Mem: 172M Active, 154M Inact, 81M Wired, 18M Cache, 60M Buf, 68M Free
Swap: 512M Total, 12K Used, 512M Free

PID USERNAME THR PRI NICE SIZE RES STATE TIME WCPU COMMAND
15563 www 27 4 0 24852K 12792K kqread 0:02 0.00% httpd
15562 www 27 4 0 20756K 10084K kqread 0:00 0.00% httpd
15559 www 1 4 0 16232K 7944K accept 0:00 0.00% httpd
15560 www 27 4 0 20756K 9788K kqread 0:00 0.00% httpd
15561 www 27 4 0 20756K 9668K kqread 0:00 0.00% httpd


我這台機器絕少 panic,倒是最近為了cached + apache的UserDir問題搞了很久。目前看來是libc裡面的NSS buffer size的問題(cached原作者還在查)。可能跟李鑫大大寫的libthr也有關。

順便請問一下,kserel 這個state會出現在純 libthr的系統上嗎? libmap.conf內容如下:

libpthread.so.2 libthr.so.2
libpthread.so libthr.so
libc_r.so.5 libthr.so.2 # Everything uses 'libthr'
libc_r.so libthr.so


2006年5月17日 星期三

The Complete FreeBSD

The Complete FreeBSD

It's now a free book~



Single User Mode

To enter single user-mode, type:

shutdown now


To return to multi-user mode, type:

exit


人生的大道理都在這裡面了啊~

人生有點像FreeBSD
boot的時候有的人
有些不同的選項
開始載入Device Driver
有的小孩ACPI沒長對
還沒boot完就panic
有的boot完成
卻找不到 root disk
永遠處於等待輸入的狀態
所幸大部分的正常人都可以進入 multi-user mode
但是每個人有每個的人的application
sendmail很保守
postfix 很穩
mysql最新
Diablo 常常 core dump
還是單純當個 flash disk 上的 firewall
pf 很好
ipf 不錯
ipfw2 大家都在用
ip6fw 已經進了 attic
有的時候會遇上 fork bomb
外面的世界也有很多 cracker
沒有龍基努斯之槍
只好拿 packet filter 當 AT Field
package 越 build 越多
system load 也從 0 跳到 nCPU+k
不知道該選 kde 還是 GNOME
libpthread 還是 libthr
swap 開始滿載
powerd 準備啟動
不小心踢到 bug 的時候
只有ddb來救
直到這台機器葛屁之前
其實只是不斷的在 single-user mode
mult-user mode 之間擺盪
偶而做做世界
偶而做做核心
不然來點 portupgrade -a
說穿了
這不過是在世界上的
某個城市
某個房間
某個角落的一台無名的 server 罷了
會不會太用力了

2006年3月10日 星期五

Blog活過來了

上個月某一天,正在遠端update我的server的時候,突然ssh斷線,telnet也進不去。完全不知道發生什麼事情了,但是因為爸爸媽媽的電腦上網沒問題,所以也就暫時沒管它。後來嚴重到影響到他們上網了,所以只好請遠在台北家中的爸爸把server reset。
進去一看,發現是 root proc_count過多,結果爆掉了。想想應該只有portmanager會造成這種現象。之前在orion上面也是,portmanager跑 -u 的時候友可能會跑到一半就core dump。看來package management還是個大麻煩.....

最早的時候,FreeBSD 只有 pkg_* 可以用。 pkg_add, pkg_delete,一直到有人寫了 sysutils/portupgrade,日子才變得好過一些。自動track dependancy,自動upgrade tree等等。但是portupgrade一直有幾個問題:
1. ruby dependancy,這樣跟早年perl dependancy是一樣的,都得多裝個 lang pack。不過這一點現在看來,反而是一種好處(後述)
2. 常常會有stale dependancy。比如 p5-Berkeley-DB如果選的是DB44,應該 p5-Berkeley-DB的depending ports會跟著pickup DB44當作他的dependancy,但是事實上卻是每次都抓到原來的DB3當作 dependancy。
3. 速度很慢,所以db format需改成 db4以上,才有顯著的改善。
portmanager一開始就用C來寫,所以performance相當好,所有的速度瓶頸都是在 make -V <$var> 這個步驟。portmanager 也不需要另外開一個 dependancy db,全部都照 /var/db/pkg裡面的內容作判斷。這樣可以解決上面2的問題,因為它的dependancy是依照 installed ports裡面的 +CONTENT 來判斷,而不是照 ports Makefile的來判斷。當然portmanager也不是沒有問題。用C寫的程式常常會有buffer overrun的問題(sigh....our server code),之前 Mike Schultz就做了好幾次這種修正。這次更是因為 fork 出去的東西太多,造成整個系統出問題。這時使用ruby的好處就出現了,interpreter 式的語言或是 bytecode based的語言在 VM/interpreter的限制(or say 保護?)下,很少可以讓系統整個掛在那邊。所以還是乖乖回到 portupgrade的懷抱,畢竟server遠在數百公里之外,要真的卡住了,也不是幾個小時就可以回去修理的。很可惜的是 Mike 決定不繼續開發portmanager,不然我真的還有很多 bug report要給他咧....

2005年11月9日 星期三

FreeBSD 6.0 released, but what about the docs?

FreeBSD 6.0 was released a couple of days ago. People are asking questions regarding the new release all over, either on the mailing lists or irc channels (##freebsd@freenode.net). The problem I see, is that documentation cannot yet keep up with the release cycle. The handbook itself is somewhat up-to-date, but not all (like sysinstall is no longer in /stand) and some features that is used in a widespread fashion were not included, for example, portupgrade/portmanager suites or the portsnap/binary upgrade mechanisms.


One can of course argue that they belong to the ports and not in the base system. But just ask yourself how these suites have streamlined operations? Or how much anyone has become more and more relying on them. Suggesting that new users start using portupgrade/portmanager is a common notion on the mailing lists and irc channels, even Dru Lavigne wrote an excellent article on portupgrade which is often referenced as 'the' article regarding portupgrade suites.
Folks, let's admit it. FreeBSD, though itself a great operating system, is mainly used as a hosting environments that run various applications from the ports collection. Creating documentations that are task based is a lot more helpful than throwing a bunch of man pages at users. (Matt Dillon's excellent tuning(7) man page is quite an exception. Though it is now outdated too.).
Topics I have come up with includes:

  1. How do I search for applications inside FreeBSD Ports collection?

  2. How do I install/deinstall/manage all the applications?

  3. What if I want a webserver? What options do I have? How do I plan my document locations? Virtual Servers?

  4. I need a mail server, but I need antispam and antivirus too, how?

  5. Can I manage my server through a browser remotely? How?


These topics may have cross-cutting optional features required, such as DNS or proxy/firewall. Basically this is a much more user as server oriented kind of setup. Because most documents that can be googled are geared towards Linux, the subtle difference when applying to FreeBSD ports collection can sometimes be time consuming just to find out in the first place, like the rc.d system that started back in 5.0.
I am not sure if I can do this alone, or maybe there already is such a project going on. I prefer wiki style collaboration if possible, so that everyone can easily add stuff into the current documentation.

2005年11月8日 星期二

The New FreeBSD Logo


The new FreeBSD logo was announced some time ago. I think it looks very Sony-Ericsson to me :)