Archive for category FreeBSD
快快樂樂打造你自已的port
以我自已弄的Net-POP3-SSLWrapper為例
# mkdir /root/Net-POP3-SSLWrapper
# vim Makefile
# New ports collection makefile for: p5-Net-POP3-SSLWrapper
# Date created: 16 December 2009
# Whom: johnpupu <johnpupu @gmail.com>
#
# $FreeBSD$
#
PORTNAME= Net-POP3-SSLWrapper
PORTVERSION= 0.02
CATEGORIES= mail perl5
MASTER_SITES= CPAN
PKGNAMEPREFIX= p5-
MAINTAINER= johnpupu@gmail.com
COMMENT= Perl extension for simple POP3S wrapper for Net::POP3
BUILD_DEPENDS= ${SITE_PERL}/IO/Socket/SSL.pm:${PORTSDIR}/security/p5-IO-Socket-SSL
PERL_CONFIGURE= yes
MAN3= Net::POP3::SSLWrapper.3
.include <bsd .port.mk>
整個Makefile 我是看相同類型的port的Makefile 來參考的
#vim pkg-descr
This is a port of Net-POP3-SSLWrapper. WWW: http://search.cpan.org/dist/Net-POP3-SSLWrapper/
#fetch http://search.cpan.org/CPAN/authors/id/T/TO/TOKUHIROM/Net-POP3-SSLWrapper-0.02.tar.gz
#mv Net-POP3-SSLWrapper-0.02.tar.gz /usr/ports/distfiles
#cd /root/Net-POP3-SSLWrapper
#make makesum
這樣/root/Net-POP3-SSLWrapper 目錄裡應該就會有 Makefile, distinfo, pkg-descr 三個檔案
#cd /root/Net-POP3-SSLWrapper
#portlint -a ### 檢查Makefile 有沒有問題
#cp -Rp /root/Net-POP3-SSLWrapper /root/Net-POP3-SSLWrapper.new
#/root/create_pkg.sh /root/Net-POP3-SSLWrapper /root/Net-POP3-SSLWrapper.new
#cp /root/Net-POP3-SSLWrapper.new/pkg-plist /root/Net-POP3-SSLWrapper
這樣 應該就差不多了
然後 寫個測試的perl 看看有沒有問題
我原先的Makefile 是沒寫到BUILD_DEPENDS= ${SITE_PERL}/IO/Socket/SSL.pm:${PORTSDIR}/security/p5-IO-Socket-SSL
是看測試的perl 說沒有這個module 才去補上這個dependency
送pr …
#shar `find /root/Net-POP3-SSLWrapper -print` > ~/Net-POP3-SSLWrapper.shar
#send-pr -a ~/Net-POP3-SSLWrapper.shar -c 長輩的e-mail
PS:
1.
create_pkg.sh 請參考
http://blog.wu-boy.com/2009/11/18/1843/
2.
http://www.freebsd.org/doc/zh_TW/books/porters-handbook/plist-autoplist.html
這個自動產生pkg-plist的指令請在bash 底下run
csh 跑不起來..
3.我還沒驗證重作一遍…..不確定過程是完全沒少的
4.
得cls_bsd長輩指點
可以用
ports-mgmt/porttools
來檢查port 對不對
就直接在port 資料夾裡
port test 就會列出是否有錯誤了
5.
Q:
WARN: Makefile: “BUILD_DEPENDS” has to appear earlier.
A:
RUN_DEPENDS和BUILD_DEPENDS
中間不要有空行
6.
要是出現
FATAL: Makefile: duplicated manpage entry Net::POP3::SSLWrapper.3: content of MAN3 will be automatically added to pkg-plist.
表示沒把pkg-plist 中的man文件刪掉
所以請把pkg-plist 中的man 幹掉
手冊寫到
The MAN[1-9LN] variables will automatically add any manpages to pkg-plist (this means you must not list manpages in the pkg-plist——see generating PLIST for more).
ref.
http://www.freebsd.org/doc/zh_TW/books/porters-handbook/index.html
http://blog.wu-boy.com/2009/11/18/1843/
http://blog.wu-boy.com/2009/09/22/1670/
http://www.ptt.cc/man/FreeBSD/DEBD/D160/M.1135705310.A.E5B.html
http://blog.dragon2.net/2009/12/17/912.php
apache-worker & php5 & mod_fastcgi
cd /usr/ports/www/apache22 make WITH_MPM=worker install clean
cd /usr/ports/lang/php5; make install clean
cd /usr/ports/www/mod_fastcgi make install clean
httpd.conf 中新增or把註解拿掉這兩行
LoadModule fastcgi_module libexec/apache22/mod_fastcgi.so
Include etc/apache22/extra/httpd-mpm.conf
編輯
/usr/local/etc/apache22/extra/httpd-mpm.conf
ThreadLimit 512
StartServers 1
MaxClients 512
MinSpareThreads 1
MaxSpareThreads 512
ThreadsPerChild 512
MaxRequestsPerChild 0
新增/usr/local/etc/apache22/Includes/fastcgi.conf
AddType application/x-httpd-php .php ScriptAlias /php-fcgi "/usr/local/bin/php-cgi" FastCgiServer "/usr/local/bin/php-cgi" -initial-env PHP_FCGI_CHILDREN=32 <directory /usr/local/bin > Options ExecCGI FollowSymLinks SetHandler fastcgi-script Order allow,deny Allow from all </directory> Action application/x-httpd-php /php-fcgi
ps
若之前php 是用php5_module來啟的話
記得把相關的php 都重編…
不然會一直出現
kernel: pid 86212 (php-cgi), uid 80: exited on signal 11
若一直出現這個就先把extension 都先拔掉
ref.
http://blog.wu-boy.com/2008/09/13/388/
http://blog.gslin.org/archives/2008/08/17/1624/
wens’s comment on http://blog.gslin.org/archives/2008/08/17/1624/
dovecot-lda
dovecot.conf
auth default {
socket listen {
master {
# Master socket provides access to userdb information. It's typically
# used to give Dovecot's local delivery agent access to userdb so it
# can find mailbox locations.
path = /var/run/dovecot/auth-master
mode = 0600
# Default user/group is the one who started dovecot-auth (root)
user = vmail
group = mail
}
}
master.cf
dovecot unix - n n - - pipe
flags=DRhu user=vmail:vmail argv=/usr/local/libexec/dovecot/deliver -f ${sender} -d ${recipient}
mail.cf
dovecot_destination_concurrency_limit = 1 dovecot_destination_recipient_limit = 1 virtual_transport = dovecot
dovecot-sql.conf
user_query = SELECT concat(/home/mbox/', maildir) AS home, 'maildir:/home/mbox/%u' AS mail , 150 AS uid, 150 AS gid FROM mailbox WHERE username = '%u' AND active = '1'
password_query = SELECT username AS user, password, concat('/home/mbox/', maildir) AS userdb_home, 'maildir:/home/mbox/%u' AS userdb_mail, 150 AS userdb_uid, 150 AS userdb_gid FROM mailbox WHERE username = '%u' AND active = '1'
ref.
http://wiki.dovecot.org/LDA/Postfix
Q:
Dec 12 02:28:15 mail dovecot: deliver(johnpupu@example.tw): Fatal: setgid(125(postfix)) failed with euid=143(dovecot), gid=6(mail), egid=6(mail): Operation not permitted
A:
像這樣的uid錯誤就是,dovecot-sql.conf 這個 uid 和master.cf中設的user id 沒不一樣造成的..
Q:
Dec 12 16:36:07 mail dovecot: deliver(johnpupu@example.tw): mail_location: Ambiguous mail location setting, don’t know what to do with it: /home/mbox/johnpupu@example.tw (try prefixing it with mbox: or maildir:)
A:
請乖乖的在dovecot-sql.conf把
maildir: 加在你的/home/mbox/%u 前面
就好了…
Q:
Relative home directory paths not supported (user johnpupu@example.tw): maildir:/home/mbox/johnpupu@example.tw
A:
這個問題就是user_query 的home 設錯了..
請設成
SELECT concat(‘/home/mbox/’, maildir) AS home,
就好了….
把mail_debug=yes 打開會看的滿清楚的
FreeNAS 得到iXsystems 支持
前一陣子FreeNAS 說0.7 是最後一版了
以後會轉成Linux 平台上 叫coreNAS
後來 剛剛看到消息說iXsystem 的工程師會大幅度的改寫
而FreeNAS Project 也會繼續下去了
目前會先昇上FreeBSD 8
看起來 可以繼續下去~~
winbind cache refresh
man winbindd
SIGHUP
Reload the smb.conf(5) file and apply any parameter changes to the
running version of winbindd. This signal also clears any cached
user and group information. The list of other domains trusted by
winbindd is also reloaded.
所以只要
/usr/local/etc/rc.d/samba reload
就好了….
lib
ldd -a /usr/local/bin/mysql
ldconfig -r
/sbin/ldconfig -m /usr/local/lib
ldconfig
-m Instead of replacing the contents of the hints file with those
found in the directories specified, “merge” in new entries.
Directories recorded in the hints file by previous runs of
ldconfig are also rescanned for new shared libraries.
筆記一下…
Squirrelmail 亂碼
忘了從 1.4.1X 開始
zh_TW編碼就是
設成UTF8
這樣big5 的mail 會是亂碼
簡單的改法就是
squirrelmail/functions/i18n.php
//$languages['zh_TW']['NAME'] = 'Chinese Trad'; //$languages['zh_TW']['CHARSET'] = 'utf-8'; //$languages['zh_TW']['LOCALE'] = 'zh_TW.UTF-8'; //$languages['tw']['ALIAS'] = 'zh_TW'; $languages['zh_TW']['NAME'] = 'Chinese Trad'; $languages['zh_TW']['CHARSET'] = 'Big5'; $languages['zh_TW']['LOCALE'] = 'zh_TW.Big5'; $languages['tw']['ALIAS'] = 'zh_TW';
這樣就成了…..
pop3gwd (pop3 proxy)
SERVER Side 設定
# cd /usr/ports/mail/pop3gwd/
# make install clean
# vim /etc/inetd.conf
加入
pop3 stream tcp nowait root /usr/libexec/tcpd /usr/local/libexec/pop3gwd
# vim /etc/rc.conf
加入
inetd_enable="YES" /etc/rc.d/inetd restart
Client Side 設定
Pop3 主機請設安裝pop3gwd 的位置
例如
192.168.2.220
Outlook 帳號設定
username#server
例如
john#mail.green-computing.com
FreeBSD Patch file 初體驗..(lighttpd mod_deflate module for freebsd)
今天早上看到
這篇文章
覺得應該把..目前的公司的網站來 壓縮一下…
不過因為用的web server 是lighttpd
目前1.4.X沒有預設是沒有這個功能的
1.5 預設會有
所以只好自已上patch ….
我的作法是………..
#cd /usr/ports/www/lighttpd #make .............. .............. #cd work #cp -rp lighttpd-1.4.19 lighttpd-1.4.19-org #fetch http://trac.lighttpd.net/trac/raw-attachment/wiki/Mod_Deflate/lighttpd-1.4.19.mod_deflate.patch #cd lighttpd-1.4.19 #patch -p1 < ../lighttpd-1.4.19.mod_deflate.patch /* 以下是笨小孩用的方法 */ #diff -C 5 ../lighttpd-1.4.19-org/configure.in configure.in > patch-src__mod_deflate.c #diff -C 5 ../lighttpd-1.4.19-org/src/base.h src/base.h >> patch-src__mod_deflate.c #diff -C 5 ../lighttpd-1.4.19-org/src/chunk.c src/chunk.c >> patch-src__mod_deflate.c #diff -C 5 ../lighttpd-1.4.19-org/src/chunk.h src/chunk.h >> patch-src__mod_deflate.c #diff -C 5 ../lighttpd-1.4.19-org/src/connections.c src/connections.c >> patch-src__mod_deflate.c #diff -C 5 ../lighttpd-1.4.19-org/src/http_chunk.c src/http_chunk.c >> patch-src__mod_deflate.c #diff -C 5 ../lighttpd-1.4.19-org/src/joblist.c src/joblist.c >> patch-src__mod_deflate.c #diff -C 5 ../lighttpd-1.4.19-org/src/Makefile.am src/Makefile.am >> patch-src__mod_deflate.c #diff -C 5 ../lighttpd-1.4.19-org/src/Makefile.in src/Makefile.in >> patch-src__mod_deflate.c #diff -NC 5 ../lighttpd-1.4.19-org/src/mod_deflate.c src/mod_deflate.c >> patch-src__mod_deflate.c #diff -C 5 ../lighttpd-1.4.19-org/src/plugin.c src/plugin.c >> patch-src__mod_deflate.c #diff -C 5 ../lighttpd-1.4.19-org/src/plugin.h src/plugin.h >> patch-src__mod_deflate.c #diff -C 5 ../lighttpd-1.4.19-org/src/request.c src/request.c >> patch-src__mod_deflate.c #diff -C 5 ../lighttpd-1.4.19-org/src/response.c src/response.c >> patch-src__mod_deflate.c #diff -C 5 ../lighttpd-1.4.19-org/src/server.c src/server.c >> patch-src__mod_deflate.c /* 聰明小孩要這樣用 */ #cd ../lighttpd-1.4.19-org #diff -Naur . ../lighttpd-1.4.19/ >> ../patch-src__mod_deflate.c
放到…/usr/ports/www/lighttpd/files 下
#cp patch-src__mod_deflate.c /usr/ports/www/lighttpd/files #cd /usr/ports/www/lighttpd ; make clean #make install
編輯lighttpd.conf
[...]
server.modules = (
"mod_access",
"mod_alias",
"mod_accesslog",
"mod_fastcgi",
# "mod_rewrite",
"mod_deflate",
# "mod_redirect",
# "mod_status",
# "mod_evhost",
# "mod_compress",
# "mod_usertrack",
# "mod_rrdtool",
# "mod_webdav",
# "mod_expire",
# "mod_flv_streaming",
# "mod_evasive"
)
[...]
[...]
deflate.enabled = "enable"
deflate.compression-level = 9
deflate.mem-level = 9
deflate.window-size = 15
# deflate.bzip2 only in patch for 1.4.x
deflate.bzip2 = "enable"
# deflate.allowed_encodings only in 1.5.x
#deflate.allowed_encodings = ( "bzip2", "gzip", "deflate" )
deflate.min-compress-size = 200
#deflate.sync-flush = "enable"
deflate.output-buffer-size = 4096
deflate.work-block-size = 512
deflate.mimetypes = ("text/html", "text/plain", "text/css", "text/javascript", "text/xml")
#deflate.debug = "enable"
然後去這網站看一下結果
http://www.port80software.com/tools/compresscheck?
輸入網站url
看結果
patch 在這
要的請自取
maybe 會進ports 也不一定..
我有send pr了
不知道送的對不對就是了 哈
基於有圖有真相原則
ref:
http://trac.lighttpd.net/trac/wiki/Mod_Deflate
http://www.howtoforge.com/lighttpd_1.4_mod_deflate_debian_etch
http://www.freebsddiary.org/patch.php
http://yblog.org/archive/index.php/5318
PS: ………有r-proxy 下…lighttpd 吐出去的是沒compressed 的……….
白弄了…
要再看看有沒有什麼解法………..
FreeBSD src 更新—-指正!!
23:51 <@chxxxn> johnpupu: 那個要 make buildworld 跟 make installworld 啊,
23:51 <@chxxxn> 如何升級到7.0-p1
23:51 <@chxxxn> http://phorum.study-area.org/index.php/topic,51783.0.html
23:52 <@chxxxn> “你沒跳大版號…應該不用make world ..”……看了看問題標題:『如何升級到7.0-p1』
23:53 * chxxxn 不常逛 www forum, 也懶得那麼多站一個一個都註冊..以免又收到一些奇怪信件
23:54 <@chxxxn> johnpupu: 某長輩說的好:『至於有沒有大版號, 要不要 buildworld? 這是看到底是為甚麼改版號吧, 有的是 user land library 做 security patch, 關 kernel 鳥事, 只 make kernel 是把頭埋進沙裡的行為.』
Day changed to 04 Jun 2008
00:00 <@jxxxn> security issue 都寫的很清楚啊
00:03 <@chxxxn> 然後日後就會有人在批踢踢上面發問 [問題] 網路寫說『關於 security patch 方面,你沒跳大版號…應該不用make world ..』……
昨天在irc 上 長輩的指正…
記一下..免的以後忘記…
感謝長輩的指正………..
從以前都昨天………….update 都沒buildworld , installworld………….
錯了大蓋一年多了……..
Orz