Jarod@termainal$ tail * >> blog

A Developer's Notebook

  BlogJava :: 首页 :: 联系 :: 聚合  :: 管理
  24 Posts :: 9 Stories :: 12 Comments :: 0 Trackbacks

2008年5月2日 #

最近公司网站的squid离奇crash,用下面命令启动squid:
squid --9
-N: 用非守护进程方式运行
-d 9: 9级输出信息(最详细)

最后看到错误信息并且squid马上crash:
"File size limit exceeded (core dumped)"

同事说可能是log文件太大,后来google到一邮件列表的信息确认了的确是,是log文件中的store.log超过2G时就会报这个错误。

解决方法:
在squid.conf中查找"TAG: cache_store_log",在其下插入一行
cache_store_log none
即可把store log关掉



posted @ 2008-05-02 20:25 Jarod 阅读(894) | 评论 (0)编辑 收藏

2008年3月25日 #

硬件:
机器上有一块硬盘通过ide连接,两块通过sata连接,hda是用来安装系统的,sda和sdb组raid1。
hda: 160G
sda:160G
sdb:160G

软件:
linux下用mdadm管理软阵列设备,详见http://www.linuxmanpages.com/man8/mdadm.8.php

经过以下操作,既可搭建完成:

创建md设备
mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda /dev/sdb

查看设备状态
cat /proc/mdstat
正常的话输出类似:
Personalities : [raid1] 
md0 
: active raid1 sdb[1] sda[0]
      
156290816 blocks [2/2] [UU]
      [
=>.]  resync =  9.9% (15526336/156290816) finish=74.9min speed=31293K/sec

格式化阵列(ext3):
mkfs.ext3 /dev/md0

创建挂载点:
mkdir /data

在/etc/fstab中加入:
/dev/md0 /data ext3 defaults 0 0

使挂载马上生效:
mount /data


posted @ 2008-03-25 10:24 Jarod 阅读(1088) | 评论 (1)编辑 收藏

2008年2月15日 #

import java.util.HashMap;

import net.sf.json.JSONObject;
import net.sf.json.JsonConfig;
import net.sf.json.processors.JsDateJsonBeanProcessor;

/**
 * 
@author jarod
 *
 
*/
public class JsonDate {

    
public static void main(String[] args) {
        
// json-lib默认不支持java.sql.Date的序列化,要序列化自己的类,实现一个BeanProcessor处理即可
        JsDateJsonBeanProcessor beanProcessor = new JsDateJsonBeanProcessor();
        java.sql.Date d 
= new java.sql.Date(System.currentTimeMillis());

        
// 直接序列化
        JsonConfig config = new JsonConfig();
        JSONObject json 
= beanProcessor.processBean(d, config);
        System.out.println(json.toString());

        
// 序列化含java.sql.Date作为属性值的bean
        HashMap m = new HashMap();
        m.put(
"date", d);
        config.registerJsonBeanProcessor(java.sql.Date.
class, beanProcessor);
        json 
= JSONObject.fromObject(m, config);
        System.out.println(json.toString());
    }
}
posted @ 2008-02-15 10:11 Jarod 阅读(4130) | 评论 (4)编辑 收藏

2008年1月14日 #

词库用起来比SCIM自带的五笔爽好多,而且有调频功能。
使用方法见:
http://forum.ubuntu.org.cn/viewtopic.php?t=99877



posted @ 2008-01-14 15:14 Jarod 阅读(462) | 评论 (0)编辑 收藏

刚学一新招:用C-x C-f打开文件时用//或~/可屏蔽此符号前的路径,省去删除当前路径的麻烦
如我的C-x C-f默认是指向~/的,此时想打开/etc/apt/fstab文件,输入~//etc/apt/fstab即可
如果当前路径为/var/,打开自己home目录下的aa.txt文件,输入/var/~/aa.txt



posted @ 2008-01-14 11:34 Jarod 阅读(664) | 评论 (0)编辑 收藏

2008年1月13日 #

最近在家上网经常打开网页白屏,一开始也不在意,后来觉得实在太烦了,查了查是怎么回事,在firefox中的error console中看到错误信息
Error: window.frames[0] is undefined
Source File: http://访问的网址/
Line: XX
双击打开,显示了页面代码:
<html>
<head>
</head>
<iframe src="about:blank" width="0" height="0" frameborder="0" style="display:none"></iframe>
<script language="javascript">
window.frames[
0].location = "http://121.32.136.231/update/step1.aspx?p=" +
"gzDSLXXXXXXXX|" +
Math.floor((
new Date()).getTime()/1000+ "|" + 
navigator.appMinorVersion 
+ "|" +
screen.availHeight 
+ "|" +
screen.availWidth 
+ "|" +
screen.colorDepth 
+ "|" +
screen.height 
+ "|" +
screen.width;
</script>
</body>
</html>

刚看到时心理一惊,该不会是在ubuntu+firefox也中病毒了吧。。。
google了一下121.32.136.231,有以下发现

http://121.32.136.231/notice/notice.htm
http://www.gomain.net/articles/about_121_32_136_231.html
http://bbs.qianlong.com/redirect.php?tid=1281281

终于知道了真相

UPDATE:
反馈到电信,回复如下:
您好,这有可能电脑中了病毒的,建议您使用杀毒软件查杀一下
唉,客服练的都是忽悠功啊

posted @ 2008-01-13 10:16 Jarod 阅读(386) | 评论 (0)编辑 收藏

2008年1月10日 #

白色+8G+硅胶套 + 送便宜保护膜 + 送游戏DVD一张 ~= 2K

入手几天了,无聊的时候可以玩玩小游戏。本来想着也可以看看电子书,但试了看PDF和CHM的书效果特不好。。。

posted @ 2008-01-10 15:30 Jarod 阅读(285) | 评论 (0)编辑 收藏

2008年1月7日 #

http://gaming.gwos.org/doku.php/wine:winestuff
posted @ 2008-01-07 16:29 Jarod 阅读(1351) | 评论 (0)编辑 收藏

2007年12月28日 #

在地址栏输入about:config进入配置表,添加或修改下列相应项

内存缓存:
browser.cache.memory.enable=true
内存缓存开关
browser.cache.memory.capacity=51200
内存缓存大小,单位KB;-1: (默认)根据系统可用内存动态调整;

TIPS: 如果内存大可以关闭磁盘缓存,把此值设大;如果不关闭磁盘缓存,建议保留默认值


磁盘缓存:
browser.cache.disk.enable=false
磁盘缓存大小
browser.cache.disk.capacity=50000
磁盘缓存大小
browser.cache.disk.parent_directory=用户目录

TIPS: 提升性能第二法是把内存缓存关闭,把browser.cache.disk.parent_directory指向ramdisk


DNS:
network.dns.disableIPv6=false
TIPS: 建议设成true,关闭ipv6的dns解释,对打开网页的速度有比较明显的提高


HTTP连接数:
network.http.max-connections=64
最大连接数
network.http.max-connections-per-server=16
对每个服务器的最大请求数
network.http.max-persistent-connections-per-server=4
对每个服务器长连接的最大数
network.http.max-persistent-connections-per-proxy=4
对每个代理的最大长连接数

上面几个值可根据自己的机器情况配置


开启Pipelining:(http://www.mozilla.org/projects/netlib/http/pipelining-faq.html)
对多内容的页面比较有用
network.http.pipelining=true
开关pipelining
network.http.proxy.pipelining=true
开关代理pipelining
network.http.pipelining.maxrequests=8
单个网页的最大请求数有效值1-8


加快页面渲染速度
nglayout.initialpaint.delay=0
这个值为firefox等待多少毫秒后开始渲染页面。默认值250。网速快时设成0可以加速网页渲染。网速慢的最好就不要改了。对网速物慢的,如56kbit/s拨号上网的,还应适当增大此值,不然firefox的CPU使用就会上升很快

不检查插件兼容性
extensions.checkCompatibility=false
对于想试3.0的朋友此项特有用。因为firefox插件的兼容性检查是基于版本号的,所以某些“不兼容”的插件不一定就是不兼容

不使用页面指定的字体
browser.display.use_document_fonts=false
对于像我的linux系统,使用的中文字体是雅黑,但有些页面是指定使用宋体,显示的字体很难看,设这个值就可以忽视页面字体了

posted @ 2007-12-28 22:03 Jarod 阅读(1200) | 评论 (0)编辑 收藏

2007年12月20日 #

测试环境:
tomcat-6.0.14
ubuntu gusty
sun-jdk-1.6

多个人合作的项目里只要修改tomcat-conf.properties文件后即可使用。我这里用了slf4j做LOG,不用LOG的把相关类去掉即可。还有我是把tomcat/lib下的jar都加进classpath的。

目录结构
/-|projectHome
  |
  |--src
  |   |--TomcatServer.java
  |   |--tomcat-conf.properties
  |
  |--webapp
  |   |--WEB-INF
  |   |   |-web.xml

TomcatServer.java:
 1 import java.io.File;
 2 import java.io.IOException;
 3 import java.util.Properties;
 4 
 5 import org.apache.catalina.Context;
 6 import org.apache.catalina.Engine;
 7 import org.apache.catalina.Host;
 8 import org.apache.catalina.LifecycleException;
 9 import org.apache.catalina.startup.Embedded;
10 import org.slf4j.Logger;
11 import org.slf4j.LoggerFactory;
12 
13 /**
14  * http://www.blogjava.net/jarod
15  * @author jarod
16  */
17 public class TomcatServer {
18 
19     private static final Logger logger = LoggerFactory
20             .getLogger(TomcatServer.class);
21 
22     public static void main(String[] args) {
23         try {
24             new TomcatServer();
25         } catch (Throwable t) {
26             logger.error("", t);
27         }
28     }
29 
30     private Embedded tomcat;
31 
32     // tomcat主目录
33     private String catalinaHome;
34 
35     private String projectHome;
36 
37     public TomcatServer() {
38         initConf();
39 
40         tomcat = new Embedded();
41         tomcat.setCatalinaHome(catalinaHome);
42         Engine engine = tomcat.createEngine();
43         Host host = tomcat.createHost("localhost", projectHome);
44         host.addChild(tomcat.createContext(""""));
45         Context context = tomcat.createContext("/webapp1""webapp");
46         // 当以debug模式启动时,修改可立即生效
47         context.setReloadable(true);
48         host.addChild(context);
49         engine.addChild(host);
50         engine.setDefaultHost("localhost");
51         tomcat.addEngine(engine);
52         tomcat.addConnector(tomcat.createConnector("0"8081false));
53         registerShutdownHook();
54         try {
55             tomcat.start();
                
Thread.sleep(Long.MAX_VALUE);
56         } catch (Exception e) {
57             throw new RuntimeException(e);
58         }
59     }
60 
61     private void initConf() {
62         Properties properties = new Properties();
63         try {
64             properties.load(TomcatServer.class
65                     .getResourceAsStream("/tomcat-conf.properties"));
66             catalinaHome = properties.getProperty("catalina.home");
67 
68             File f = new File(".");
69             projectHome = f.getAbsolutePath();
70         } catch (IOException e) {
71             throw new RuntimeException(e);
72         }
73     }
74 
75     private void registerShutdownHook() {
76         Runtime.getRuntime().addShutdownHook(new Thread() {
77             @Override
78             public void run() {
79                 try {
80                     tomcat.stop();
81                 } catch (LifecycleException e) {
82                     throw new RuntimeException(e);
83                 }
84             }
85         });
86     }
87 }


tomcat-conf.properties:
catalina.home=/home/jarod/server/tomcat/apache-tomcat-6.0.14


为什么要setCatalinaHome?
设了该值,tomcat启动时会在该目录加载默认的一些配置,如MIME mapping等,如果要自己手动添加配置太麻烦了,而如果不要这些配置,这个embedded tomcat用处也不大
posted @ 2007-12-20 14:49 Jarod 阅读(2153) | 评论 (0)编辑 收藏

2007年12月19日 #

系统: ubuntu 7.10
我现在2台机上在用这个版本,一台机是gnome, 另一台机是KDE,KDE上的emacs-gtk可以直接用scim输入了,但gnome据说是某session-daemon程序的问题导致不能激活外部输入法,我现在的解决方法是开一个terminal, 在terminal下用emacs -nw启动,这样就能用外部输入法输入中文了



Checkout源代码


sudo apt-get install ssh cvs
export CVS_RSH
="ssh"
cvs 
-z3 -d:pserver:anonymous@cvs.sv.gnu.org:/cvsroot/emacs co -r emacs-unicode-2 emacs


安装依赖包


sudo apt-get install texinfo libgpmg1-dev libungif4-dev libpng12-dev libgd2-xpm-dev libtiff4-dev libjpeg62-dev librsvg2-dev libgtk2.0-dev
注意:上面有几个图形库不是必须的;我的机器本来就装了很多开发库,所以上面的库估计也是不全的

编译安装


./configure --prefix=/usr --enable-font-backend --with-gtk --with-xft --with-freetype && make bootstrap && make info && sudo make install



配置


编辑~/.Xresources

Xft.antialias: 1
# 可以尝试把hinting关了对比效果,有些显示器上不开反而更好看
Xft
.hinting: 1
Xft
.hintstyle: hintfull 
Xft
.rgba: rgb

Emacs
.FontBackend: xft
Emacs.Geometry: 100x32+4+4
执行xrdb ~/.Xresources例配置生效

编辑~/.emacs文件(最新版在我的wiki
;;设置个人信息
;;
(setq user
-full-name "Jarod Liu")
(setq user
-mail-address "liuyuanzhi(at)gmail.com")

;;添加自定义loadpath
;;
(
if (fboundp 'normal-top-level-add-subdirs-to-load-path)
    (let* ((my-lisp-dir "/home/jarod/.myemacs/")
           (default-directory my-lisp-dir))
      (setq load-path (cons my-lisp-dir load-path))
      (normal-top-level-add-subdirs-to-load-path)))


;;设置字体 
;;
(set-default-font "Monospace-14")
(set-fontset-font (frame-parameter nil 
'font)
          
'unicode '("Microsoft YaHei" . "unicode-bmp")) 
(set
-fontset-font (frame-parameter nil 'font)
          
'han '("Microsoft YaHei" . "unicode-bmp"))
(set-fontset-font (frame-parameter nil 
'font)
          
'symbol '("Microsoft YaHei"  . "unicode-bmp"))
(set
-fontset-font (frame-parameter nil 'font)
          
'cjk-misc '("Microsoft YaHei"  . "unicode-bmp"))
(set-fontset-font (frame-parameter nil 
'font)
          
'bopomofo '("Microsoft YaHei"  . "unicode-bmp")) 


;; 
For my language code setting (UTF-8)
;;
(setq current
-language-environment "UTF-8")
(setq default
-input-method "chinese-py")
(setq locale
-coding-system 'utf-8)
(set-terminal-coding-system 
'utf-8)
(set
-keyboard-coding-system 'utf-8)
(set-selection-coding-system 
'utf-8)
(prefer
-coding-system 'utf-8)


;;启动服务器(for emacsclient)
;;
(server-start)


;;自定义按键
;;
(global-set-key [f1] 
'shell);F1进入Shell 
;(global
-set-key (kbd "C-SPC"'nil);用win+space为set-mark键,留出ctrl+space热键作为输入法
;(global-set-key (kbd "S-SPC") 
'set-mark-command)


;;使用习惯配制
;;
(setq default
-major-mode 'text-mode);一打开就起用 text 模式。
(global-font-lock-mode t);语法高亮
(auto-image-file-mode t);打开图片显示功能
(fset 
'yes-or-no-'y-or-n-p);以 y/n代表 yes/no
(setq default-fill-column 80);默认显示 xx列就换行
(column-number-mode t);显示列号
(show-paren-mode t);显示括号匹配
(setq show-paren-style 
'parentheses);括号匹配时显示另外一边的括号,而不是跳到另一个括号
;(display
-time-mode 1);显示时间,格式如下
;(setq display
-time-24hr-format t)
;(setq display
-time-day-and-date t)
(tool
-bar-mode nil);去掉工具栏
(scroll
-bar-mode nil);去掉滚动条,可以使用鼠标滚轮
(setq scroll
-margin 3 scroll-conservatively 10000);防止页面滚动时跳动, scroll-margin 3 可以在靠近屏幕边沿3行时就开始滚动
(mouse
-avoidance-mode 'animate);光标靠近鼠标指针时,让鼠标指针自动让开
(setq mouse-yank-at-point t);支持中键粘贴
(transient-mark-mode t);高亮显示要拷贝的区域
(setq x-select-enable-clipboard t);支持emacs和外部程序的粘贴
(setq interprogram-paste-function 
'x-cut-buffer-or-selection-value) ;
(setq frame
-title-format "%b");在标题栏提示buffer名
(setq
-default make-backup-files nil);不要生成临时文件
(setq visible
-bell t);关闭烦人的出错时的提示声
(setq inhibit
-startup-message t);关闭起动时的那个“开机画面”
(setq 
kill-ring-max 64);undo number
;; 缩进
(setq default
-tab-width 4);;    设置tab为4个空格的宽度
(setq tab
-width 4)
(global
-set-key "\C-m" 'newline-and-indent)
(global-set-key "\C-j" 
'newline);; 交换这两个按键。因为大多数情况下,回车后是要缩进的。

;; mode alist
(mapcar
 (function (lambda (setting)
         (setq auto
-mode-alist
           (cons setting auto
-mode-alist))))
 
'(("\\.xml$".  sgml-mode)
   ("\\\.bash" . sh-mode)
   ("\\.rdf$".  sgml-mode)
   ("\\.session" . emacs-lisp-mode)
   ("\\.l$" . c-mode)
   ("\\.css$" . css-mode)
   ("\\.cfm$" . html-mode)
   ("gnus" . emacs-lisp-mode)
   ("\\.idl$" . idl-mode)
   ("\\.rb$" . ruby-mode)
   ("\\.rhtml$" . html-mode)))




;; tabbar
;;
(require 
'tabbar) ; http://liuyuanzhi.googlepages.com/tabbar.el
(tabbar
-mode)
;(global
-set-key (kbd ""'tabbar-backward-group)
;(global-set-key (kbd "") 
'tabbar-forward-group)
(global
-set-key (kbd "C-`"'tabbar-backward) ;切换TAB的快捷键
(global-set-key (kbd "C-<tab>") 
'tabbar-forward)
;(set
-face-attribute 'tabbar-default-face nil :family "Tahoma") ;设置tabbar字体


;; color-theme 
;;
(require 
'color-theme) ;http://liuyuanzhi.googlepages.com/color-theme.el
(color
-theme-gnome2)


;; ruby                                                                         
;; based on http
://www.rubygarden.org/Ruby/page/show/InstallingEmacsExtensions  
;;                                                                              
(
require 'ruby-mode) ;安装ubuntu中的ruby-elisp包
(autoload 
'ruby-mode "ruby-mode" "Ruby editing mode." t)
(modify
-coding-system-alist 'file "\\.rb$" 'utf-8)
(modify
-coding-system-alist 'file "\\.rhtml$" 'utf-8)


(autoload 
'run-ruby "inf-ruby"
  "Run an inferior Ruby process")
(autoload 
'inf-ruby-keys "inf-ruby"
  
"Set local key defs for inf-ruby in ruby-mode")
(add
-hook 'ruby-mode-hook
          
'(lambda ()
             (inf
-ruby-keys)))
;; 
If you have Emacs 19.2x or older, use rubydb2x                              
(autoload 
'rubydb "rubydb3x" "Ruby debugger" t)

配置文件都是从网上直接copy来的,把一些不用的注释了
posted @ 2007-12-19 10:29 Jarod 阅读(3682) | 评论 (0)编辑 收藏

2007年10月28日 #


由于iBATIS方面的书本来就不多(这是我除了官方文档外找到的唯一一本),使这本书无疑是学习iBATIS不二的选择。而这本书本身也是不错的,囊括了几乎所有的iBATIS的知识点。很适合作为iBATIS的入门和参考书籍。
我读这本书的时候并没接触过iBATIS相关的知识,但凭借本身的编程经验,看这本书也不必细看,也是匆匆看完,然后在实际使用中遇到问题再参考此书,比官方的文档好多了。
posted @ 2007-10-28 12:34 Jarod 阅读(325) | 评论 (0)编辑 收藏

昨天由于有点时间,就想找本书看看。在手头上找了本最薄的书-《MySQL Phrasebook - Essential Code and Commands》。最近因工作需要,刚从Hibernate转到iBatis。这个转变感觉自己离OO远了一点,而离DO(DB-oriented)却近了一点,现在要对数据库级的细节要更加了解了。
看标题"Phrasebook"感觉就像时下不少的“XXX高手箴言”之类的书,没翻之前还抱着希望是一些经验总结的精华集。当看完整本书,发现大部分篇幅都是讲SQL语法和MySQL的一些基础指令。也有一点cookbook的味道,讲述解决某一类问题时的方案。还有一些安全小tips是不错的。还有一章讲MYSQL对各语言的接口的,我是直接跳过了。
刚翻完的时候其实我想骂,“什么烂phrasebook,要学这些基础语法指令我不如去看MYSQL的官方教程”,但想到它的副标是“Essential Code and Commands”。。。算了
总的来说,这本书对于MYSQL的新手还是有点用的,可以让你了解有些什么要注意的,有些什么小技巧之类的。但对大部分用过MySQL一段时间的人来说,这本书是不值得买的。

书虽然是不怎么好,但在其中学到了一些新东西:
DELAY_KEY_WRITE
作用:减少MyISAM表更新索引的次数
用法:ALTER TABLE table_name DELAY_KEY_WRITE = 1;

LIKE中的'_'
作用:匹配一个字符(我以前只知道%)

<=>
作用:"NULL安全”的不等,正常的!=遇到NULL时不会返回0(false),1(true),而是返回NULL,用<=>就会得到你想要的结果了

启动选项--safe-updates
作用:不执行无WHERE子句的DELETE和UPDATE语句
posted @ 2007-10-28 12:25 Jarod 阅读(289) | 评论 (0)编辑 收藏

2007年10月27日 #

Registers



General-purpose registers


Register Description
EAX Accumulator for operands and results data
EBX Pointer to data in the data memory segment
ECX Counter for string and loop operations
EDX I/O pointer
EDI Data pointer for destination of string operations
ESI Data pointer for source of string operations
ESP Stack pointer
EBP Stack data pointer


Segment registers


Segment Register Description
CS Code segment
DS Data segment
SS Stack segment
ES Extra segment pointer
FS Extra segment pointer
GS Extra segment pointer


Instruction pointer register


EIP keeps track of the next instruction code to execute


Control registers


Control Register Description
CR0 System flags that control the operating mode and states of the processor
CR1 Not currently used
CR2 Memory page fault information
CR3 Memory page directory information
CR4 Flags that enable processor features and indicate feature capabilities of the processor




Sections



.section .data


section for variables declaration

Directive Data Type
.ascii Text string
.asciz Null-terminated text string
.byte Byte value
.double Double-precision floating-point number
.float Single-precision floating-point number
.int 32-bit integer number
.long 32-bit integer number (same as .int)
.octa 16-byte integer number
.quad 8-byte integer number
.short 16-bit integer number
.single Single-precision floating-point number (same as .float)

.equ static variables


.section .rodata


section for constants declaration


.section .bss


buffers

Directive Description
.comm Declares a common memory area for data that is not initialized
.lcomm Declares a local common memory area for data that is not initialized


.section .text


assembly codes

Directive Description
.global _start entry point
posted @ 2007-10-27 17:36 Jarod 阅读(250) | 评论 (0)编辑 收藏

一、工具准备


Apache Web服务器:httpd-2.2.4.tar.bz2
Subversion源码包及依赖包:subversion-1.4.3.tar.bz2,subversion-deps-1.4.3.tar.bz2
(下面假设apache和svn源码都解压到了/home/tmp下)

二、安装Apache


Apache的安装就根平时安装Apache没什么两样,都记得要打开dav模块和动态模块选项。安装安装命令如下:
tar xfj httpd-2.2.4.tar.bz2
cd httpd-2.2.4
./buildconf
./configure --enable-dav --enable-so
make
make install


三、安装Subversion


SVN的安装一定要注意:

  • SVN 依赖的APR版本要正确。如果Apache为2.0.x,对应的APR版本应为0.9.x;Apache为2.2.x,对应的APR版本应为1.2.x。 由于subversion-deps包里的APR是0.9.x的,因此编译svn时要删除从deps里解压出来的apr, apr-util,改而使用apache 2.2里提供的。

  • 如果apache不是安装在默认路径,configure必須加上--with-apxs选项,如:./configure --with-apxs=/home/apache2/bin/apxs


安装命令如下:

tar xfj subversion-1.4.3.tar.bz2
tar xfj subversion-deps-1.4.3.tar.bz2
# subversion-deps的文件也会解压到subversion-1.4.3目录中
cd subversion-1.4.3
rm -rf apr
rm -rf apr-util
ln -s /home/tmp/httpd-2.2.4/srclib/apr apr
ln -s /home/tmp/httpd-2.2.4/srclib/apr-util apr-util
./configure &&amp;amp; make && make install

安 装完成后,查看是否存在文件$APACHE_HOME/modules/mod_dav_svn.so(默认 /usr/local/apache2/modules/mod_dav_svn.so)。另外,如果该机器上以前是装过旧版本的SVN,要把 "/usr/local/lib/libsvn*"文件都删除。

四、在apache中配置svn


创建SVN库:
cd /home/svn
svnadmin create repo1


在Apache 的配置文件httpd.conf中加入以下代码,Apache中就可以配置好一个虚拟主机svn.mydomain.net,并把该域名下的根路径配置给 Subversion。通过AuthzSVNAccessFile和AuthUserFile指令分别配置SVN用户的用户名和密码文件。
<virtualhost *:80>
DocumentRoot /home/svn/htdocs
<directory>
Options Includes
AllowOverride All
Order allow,deny
Allow from all
</directory>

<location />
DAV svn
SVNParentPath /home/svn/svnroot
AuthzSVNAccessFile /home/svn/svnroot/conf/accessfile
Require valid-user
AuthType Basic
AuthName "Subversion System"
AuthUserFile /home/svn/svnroot/conf/passwdfile
</location>

ServerName svn.mydomain.net
DirectoryIndex index.html
</virtualhost>



创建文件/home/svn/svnroot/conf/accessfile:

[groups]
user = jarod
anonymous = guest
[/]
* = r
@user = rw
@anonymous = r


再用htpasswd命令创建/home/svn/svnroot/conf/passwdfile文件:

htpasswd -c /home/svn/svnroot/conf/passwdfile jarod
# 这时会提示输入密码


最后把/home/svn目录的拥有者设为启动apache服务的用户,apache-2.2默认会由daemon用户启动:
chown daemon.daemon -R /home/svn
chmod 777 /home/svn -R


大功告成,通过浏览器或SVN客户端测试http://svn.mydomain.net/repo1
posted @ 2007-10-27 17:32 Jarod 阅读(5920) | 评论 (1)编辑 收藏