星期六, 十月 23, 2010

Java常用工具

=======================================================
CruiseControl,Hudson,Bamboo, Continuum

前两者是开源的,而Bamboo对于商业使用是要收费的,占用率低一点也可以理解。Hudson最为流行,用户为CruiseControl的两倍,这也能理解,毕竟易用性方面Hudson强很多。

最流行的工具是Apache的Continuum, Cruise Control
(CC)和Hudson。它们都是免费的开放源工具而且得到各类型开发者的支持。这三个工具都有能力去对每一个可配置的时间表来构建和测试代码。

Hudson和Apache的Continuum的设计是针对Java的。Cruise Control(CC)支持Java和.NET(CC.Net version)。因为这些工具都设计的非常灵活,所以在其他开发预言中也可以延展这些工具的功能去支持开发程序。例如,Hudson可以通过插件扩展功

能同C#, Python, Maven, Ruby等等工作。

=======================================================
Ant, Maven

抛开这个不谈,我们可以看到Ant以33.3%的得票率远超得票率为18.0%的Maven。这当然是可以理解的,Maven和Ant相比还比较年轻。

=======================================================
Maven权威指南

http://www.sonatype.com/books/maven-book/reference_zh/public-book.html

=======================================================
Nexus

Nexus 是Maven仓库管理器,如果你使用Maven,你可以从Maven中央仓库 下载所需要的构件(artifact),但这通常不是一个好的做法,你应该在本地架设一个Maven仓库服务器,在代理远程仓库的同时维护本地仓库,以节省带宽和时间,Nexus就可以满足这样的需要。此外,他还提供了强大的仓库管理功能,构件搜索功能,它基于REST,友好的UI是一个extjs的REST客户端,它占用较少的内存,基于简单文件系统而非数据库。这些优点使其日趋成为最流行的Maven仓库管理器。

=======================================================
Mybatis Schema Migrations

This is the command line utility for managing your database schema, similar to Rails migrations.

=======================================================
Redmine

项目管理工具,ruby on rails 编写。

=======================================================
搜索引擎Lucene

Lucene是apache软件基金会jakarta项目组的一个子项目,是一个开放源代码的全文检索引擎工具包,即它不是一个完整的全文检索引擎,而是一个全文检索引擎的架构,提供了完整的查询引擎和索引引擎,部分文本分析引擎(英文与德文两种西方语言)。Lucene的目的是为软件开发人员提供一个简单易用的工具包,以方便的在目标系统中实现全文检索的功能,或者是以此为基础建立起完整的全文检索引擎。

=======================================================
分布式缓存memcached

memcached是一个高性能的分布式基于Name Value Pairs (NVPs) 的缓存系统,不处理数据持久和安全机制。它是一个开源的免费系统,容易部署安装,简单而又不缺强大。
它由两部分组成:server和client。memcached server做的就是通过一个Key(不能超过250个字符,采用object:key:type命名)值来存储和获取数据(1M)。缓存应用时可以部署多个服务器,每个服务器是自治的。client支持多种语言,目前已经存在很多语言的API。

=======================================================
Cobertura

http://cobertura.sourceforge.net/
Cobertura is a Java code coverage analysis tool. You can use it to determine what percentage of your source code is excercised by your unit tests.

=======================================================
JWebUnit

http://jwebunit.sourceforge.net/
JWebUnit is a Java-based testing framework for web applications. It wraps existing testing frameworks such as HtmlUnit and Selenium with a unified, simple testing interface to allow you to quickly test the correctness of your web applications.

=======================================================
Canoo WebTest

http://webtest.canoo.com
Canoo WebTest is a free Open Source tool for automated testing of web applications in a very effective way.

=======================================================
FreeMarker

http://freemarker.sourceforge.net/
FreeMarker is a "template engine"; a generic tool to generate text output (anything from HTML to autogenerated source code) based on templates. It's a Java package, a class library for Java programmers. It's not an application for end-users in itself, but something that programmers can embed into their products.

=======================================================
Velocity

http://velocity.apache.org/
Velocity is a simple yet powerful Java-based template engine that renders data from plain Java objects to text, xml, email, SQL, Post Script, HTML etc. The template syntax and rendering engine are both easy to understand and quick to learn and implement.

=======================================================

Rails中的插件

分页插件will_paginate
http://wiki.github.com/mislav/will_paginate/
Rails分页插件,非常强大,几乎是Rails中最好的分页插件。

Excle插件Spreadsheet
http://github.com/jacobat/ruby-spreadsheet
Excle读入,导出插件

PDF插件prawn
http://github.com/sandal/prawn
Prawn is a PDF writing library for Ruby designed to be tiny, fast, and nimble,just like the majestic sea creature.

报表插件Ruport
http://github.com/ruport/ruport
http://ruportbook.com/
Ruby Reports (Ruport) is an extensible reporting system.
For common tasks, Ruport provides formatters for CSV, HTML, PDF, and text- based reports. However, the real power lies in building custom report controllers and formatters. The base formatting libraries provide a number of helper functions that will let you build complex reports while maintaining a DRY and consistent interface.

缓存插件cache-money
http://github.com/nkallen/cache-money
cache-money是Twitter最近贡献一个缓存插件,和常见的cache plugin不同,它提供的是write-through的缓存模式:在ActiveRecord对象更新的时候不是将缓存中的数据清除,而是直接将更新的内容写入到缓存中去。

Sacffold插件activescaffold
http://github.com/activescaffold/active_scaffold

Phusion passenger
http://www.modrails.com/
Phusion Passenger™ — a.k.a. mod_rails or mod_rack — makes deployment of Ruby web applications, such as those built on the revolutionary Ruby on Rails web framework, a breeze. It follows the usual Ruby on Rails conventions, such as “Don’t-Repeat-Yourself”.

fxri
FXRI is a FXRuby Interface to RI, that supports search-on-typing. FXRI is a small little program, that tries to provide the desired information as fast as possible.

ruote
http://ruote.rubyforge.org/
Ruote is a workflow engine written in Ruby. Ruote is not a state machine library.

QueryReviewer
QueryReviewer is an advanced SQL query analyzer.
http://github.com/boulder/query_reviewer

缓存Memcached

Memcached服务器端:

http://memcached.org/
各种各样的Memcached服务器端:
包括:
Debian, Ubuntu, Redhat/Fedora, Windows

Memcached客户端:

http://code.google.com/p/memcached/wiki/Clients
各种各样的Memcached客户端:
包括:
C / C++, PHP, Java, Python, Ruby, Perl, Windows / .NET, MySQL, PostgreSQL, Erlang, Lua, Lisp dialects, ColdFusion, OCaml, Io, Protocol

xmemcached国人开发客户端:

http://code.google.com/p/xmemcached/
xmemcached是最近频繁出现在JavaEye新闻频道的热点词汇,它就是JavaEye的资深会员Dennis开发的基于java nio实现的高性能可扩展的memcached客户端。


cache-money客户端:

http://github.com/nkallen/cache-money
cache-money是Twitter最近贡献一个缓存插件,和常见的cache plugin不同,它提供的是write-through的缓存模式:在ActiveRecord对象更新的时候不是将缓存中的数据清除,而是直接将更新的内容写入到缓存中去。

Subversion install on ubuntu

1,安装Subversion

1.1 从安装源安装
sudo apt-get install subversion

1.2 测试Subversion的安装
sudo svnadmin create /home/svn
sudo groupadd subversion
sudo chown -R root:subversion /home/svn
sudo chmod -R g+rws /home/svn

mkdir svntest
echo "This is a test subversion" >> svntest/test.txt
svn import -m "new import" svntest file:///home/svn/svntest

2,安装apache2服务器

2.1 从安装源进行安装
sudo apt-get install apache2

2.2 测试apache的安装
启动apache服务器:sudo /etc/init.d/apache2 start
打开浏览器,确认连接
http://localhost
确认是否正确显示信息。

3,安装libapache2-svn

sudo apt-get install libapache2-svn

4,配置Apache

4.1 编辑/etc/apache2/httpd.conf

DAV svn
SVNPath /home/svn
AuthType Basic
AuthName "subversion repository"
AuthUserFile /etc/subversion/passwd
AuthzSVNAccessFile /etc/subversion/authz
# Satisfy Any
Require valid-user


4.2 添加用户
sudo htpasswd -c /etc/subversion/passwd user1

4.3 添加用户组
编辑/etc/subversion/authz
[groups]
g_svn = user1, user2

[/]
@g_svn = r
svnroot = wr

[/svntest]
@g_svn = rw

4.4 测试
sudo /etc/init.d/apache2 restart
svn co http://localhost/svn/svntest svntest
浏览器访问:http://localhost/svn/svntest

5,配置https

5.1 配置https
a2enmod ssl
sudo mkdir /etc/apache2/ssl
cd /etc/apache2/ssl
sudo openssl req -x509 -newkey rsa:1024 -keyout apache.pem -out apache.pem -nodes -days 999
编辑/etc/apache2/httpd.conf

SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.pem
SSLProtocol all
SSLCipherSuite HIGH:MEDIUM


5.2 重启服务器,测试https
sudo /etc/init.d/apache2 restart
svn co https://localhost/svn/svntest svntest
浏览器访问:https://localhost/svn/svntest

Rails install on ubuntu

1,安装前的准备

检查linux下编译包是否安装:
audo apt-get install build-essential

2,安装Mysql

2.1 从安装源进行安装
audo apt-get install mysql-server
audo apt-get install mysql-client

2.2 从Source安装
下载Mysql源程序,http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-x.x.x.zip
unzip mysql-x.x.x.zip
cd mysql-x.x.x
./configure --prefix=/usr/local/mysql-x.x.x
make
sudo make install
以上安装过程中会提示输入mysql root密码。

2.3 测试是否安装成功。
启动服务器:sudo /etc/init.d/mysql start
客户端连接:mysql -u root -p
输入密码及判断是否连接成功。

3,安装Ruby标准版

3.1 从安装源进行安装
1) sudo apt-get install ruby1.8

2) 测试ruby是否安装成功
ruby1.8 -v
输出正确信息代表成功。

3) 建立连接
sudo ln /usr/bin/ruby1.8 /usr/bin/ruby

3.2 从Source进行安装
1) 确认依赖包
注:安装Ruby过程中可能出现依赖包不存在的情况,需要先安装之。
以下依赖包需要先安装:
audo apt-get install zlib1g zlib1g-dev
audo apt-get install libreadline5 libreadline5-dev
audo apt-get install libncurses5 libncurses5-dev

2) 下载Ruby源程序,ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-x.x.x-x.tar.gz
tar zxvf ruby-x.x.x-x.tar.gz
cd ruby-x.x.x-x.
./configure --prefix=/usr/local/ruby-x.x.x-x
make
sudo make install

3) 测试ruby是否安装成功
/usr/local/ruby-x.x.x-x/bin/ruby -v
输出正确信息代表成功。

4) 建立连接
sudo ln /usr/local/ruby-x.x.x-x/bin/ruby /usr/bin/ruby

4,安装Ruby企业版

参考:http://www.rubyenterpriseedition.com/documentation.html
4.1 从Source进行安装
下载Ruby源程序,
tar xzvf ruby-enterprise-x.x.x.tar.gz
PREFIX=/opt/rubyee-x.x.x

cd ruby-enterprise-x.x.x/source/distro/google-perftools-*
./configure --prefix=$PREFIX --disable-dependency-tracking
make libtcmalloc_minimal.la

sudo mkdir -p $PREFIX/lib
sudo rm -f $PREFIX/lib/libtcmalloc_minimal*.so*
sudo cp -Rpf .libs/libtcmalloc_minimal*.so* $PREFIX/lib/

cd ../..
./configure --prefix=$PREFIX
LIBS =
make PRELIBS="-Wl,-rpath,$PREFIX/lib -L$PREFIX/lib -ltcmalloc_minimal"
sudo make install

4.2 测试ruby是否安装成功
/opt/rubyee-x.x.x/bin/ruby -v
输出正确信息代表成功。


5,添加环境变量

这里假设我们用Ruby标准版进行安装,如果用企业版方法相同。
5.1 添加到系统环境变量
sudo vim /etc/profile
尾部添加:
export MYSQL_HOME=/usr/local/mysql-x.x.x
export RUBY_HOME=/usr/local/ruby-x.x.x-x
export PATH=$PATH:$MYSQL_HOME/bin:$RUBY_HOME/bin
使其生效:
source /etc/profile

5.2 添加到个人环境变量,不影响其它人
sudo vim ~/.bashrc
尾部添加:
export MYSQL_HOME=/usr/local/mysql-x.x.x
export RUBY_HOME=/usr/local/ruby-x.x.x-x
export PATH=$PATH:$MYSQL_HOME/bin:$RUBY_HOME/bin
使其生效:
source ~/.bashrc

5.3 测试是否设置成功。
ruby -v
输出正确信息代表成功。

6 安装openssl(对于Ruby标准版,可能需要这样安装openssl)

sudo apt-get install libssl0.9.8 libssl-dev

cd ruby-x.x.x-x\ext\openssl\
ruby extconf.rb
make
sudo make install

7,安装gem

7.1 下载rubygems-x.x.x.zip
unzip rubygems-x.x.x.zip
cd rubygems-x.x.x
ruby setup.rb

7.2 测试安装gem是否安装成功。
gem list
输出正确信息代表成功。

8,安装Rails

8.1 下载以下gem:
actionmailer-x.x.x.gem
actionpack-x.x.x.gem
activerecord-x.x.x.gem
activeresource-x.x.x.gem
activesupport-x.x.x.gem
rails-x.x.x.gem
rake-x.x.x.gem

8.2 安装Rails:
gem install rails-x.x.x.gem --local

8.3 测试安装rails是否安装成功。
rails -v
输出正确信息代表成功。

9,安装mysql-ruby驱动

参考:http://tmtm.org/en/mysql/ruby/
9.1 下载mysql-ruby-x.x.x.tar.gz
tar zxvf mysql-ruby-x.x.x.tar.gz
cd mysql-ruby-x.x.x
ruby extconf.rb
make
sudo make install

9.2 测试是否安装成功。
1)新建库:
mysql -u root -p
create database test_development;

2)新建rails工程
rails test -d mysql

3)确认test/config/database.yml下数据库连接是否配置成功。(包括用户名和密码)

4)启动工程
cd test
ruby script/server

5)打开浏览器,确认连接
http://localhost:3000
点击xxx确认是否正确显示服务器信息。

10,安装apache2服务器

10.1 从安装源进行安装
sudo apt-get install apache2

10.2 从源程序进行安装
下载Apache源程序,http://www.eng.lsu.edu/mirrors/apache/httpd/httpd-x.x.x.tar.gz
tar zxvf httpd-x.x.x.tar.gz
cd httpd-x.x.x
./configure --prefix=/usr/local/apache-x.x.x-x
make
sudo make install

10.3 测试apache的安装
启动apache服务器:sudo /etc/init.d/apache2 start
打开浏览器,确认连接
http://localhost
确认是否正确显示信息。

11 安装passenger-apache2

参考:http://www.modrails.com/documentation/Users%20guide%20Apache.html
11.1 下载以下gem
passenger-x.x.x.gem
fastthread-x.x.x.gem

gem install passenger-x.x.x.gem --local
passenger-install-apache2-module

11.2 测试passenger是否安装成功
1)编辑/etc/apache2/httpd.conf
加入:
LoadModule passenger_module /opt/rubyee-x.x.x/lib/ruby/gems/1.8/gems/passenger-x.x.x/ext/apache2/mod_passenger.so
PassengerRoot /opt/rubyee-x.x.x/lib/ruby/gems/1.8/gems/passenger-x.x.x
PassengerRuby /opt/rubyee-x.x.x/bin/ruby


ServerName yourserver
DocumentRoot /home/yourname/test/public
RailsEnv development

AllowOverride all
Options -MultiViews



2)重启apache2服务器
sudo /etc/init.d/apache restart

3)打开浏览器,确认连接
http://localhost
点击xxx确认是否正确显示服务器信息。

12 安装nginx


12.1 下载:nginx-x.x.x.tar.gz
tar zxvf nginx-x.x.x.tar.gz
cd nginx-x.x.x
./configure --prefix=/opt/nginx-x.x.x
make
sudo make install

12.2 打开浏览器,确认连接
http://localhost
确认是否正确显示服务器信息。

13 安装passenger-nginx

参考:http://www.modrails.com/documentation/Users%20guide%20Nginx.html
13.1 下载以下gem
passenger-x.x.x.gem
fastthread-x.x.x.gem

gem install passenger-x.x.x.gem --local
passenger-install-nginx-module

13.2 测试passenger是否安装成功
1)编辑/opt/nginx-x.x.x/conf/nginx.conf
加入如下内容:
http {
...
server {
listen 80;
server_name yourserver;
root /home/yourname/test/public;
passenger_enabled on;
rails_env development;
}
...
}

2)启动sudo /opt/nginx-x.x.x/sbin/nginx

3)打开浏览器,确认连接
http://localhost
点击xxx确认是否正确显示服务器信息。

14 连接Oracle数据库注意事项:

在httpd.conf中加入:
SetEnv ORACLE_HOME /sdb1/app/oracle/product/11.1.0/db_1
SetEnv LD_LIBRARY_PATH /sdb1/app/oracle/product/11.1.0/db_1/lib

Mail server install on Ubuntu

1, postfix的安装

1.1 从安装源安装
sudo apt-get install postfix

1.2 编辑/etc/postfix/main.cf
如果没有,可以运行dpkg-reconfigure postfix来重新生成配置信息。
sudo vim /etc/postfix/main.cf
修改:mydestination 和 mynetworks。

添加:
home_mailbox = Maildir/
mailbox_command =

1.3 测试postfix的安装
sudo /etc/init.d/postfix restart

1.4 安装测试用命令工具
sudo apt-get install mailutils

测试smtp是否正常
netcat localhost 25 (telnet localhost 25)
ehlo localhost
mail from: bulain@localhost
rcpt to: bulain@localhost
data
Subject: My first mail for my domain
Hi,
Are you there?
regards,
Admin
. (and Enter In a new Line)
quit

测试邮件目录mailbox
su - bulain
cd Maildir/new
ls

2,courier-pop,courier-imap的安装

2.1 从安装源安装
sudo apt-get install courier-pop courier-imap

2.2 测试pop3是否正常
netcat localhost 110
Connected to localhost (127.0.0.1).
Escape character is '^]'.
+OK Hello there.
user bulain
+OK Password required.
pass password
+OK logged in.
quit

2.3 测试IMAP是否正常
netcat localhost 143
* OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE ACL ACL2=UNION STARTTLS XCOURIEROUTBOX=INBOX.Outbox] Courier-IMAP ready. Copyright 1998-2005 Double Precision, Inc. See COPYING for distribution information.
a login bulain password
a OK LOGIN Ok.
a logout



3,mysql的安装

3.1 从安装源安装
sudo apt-get install mysql-server mysql-client

3.2 测试mysql的安装
mysql -u root -p
连接成功代表安装成功。


4, PHP的安装

4.1 从安装源安装
sudo apt-get install php5

5, apache2的安装

5.1 从安装源安装
sudo apt-get install apache2

5.2 测试apache2的安装
sudo /etc/init.d/apache restart
打开 http://localhost 代表成功。

6,phpmyadmin的安装

6.1 从安装源安装
sudo apt-get install phpmyadmin

6.2 配置apache2
ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf.d/phpmyadmin

6.3 测试phpmyadmin
打开http://localhost/phpmyadmin
输入mysql用户名,密码,登陆成功代表登陆成功。

7,postfixadmin的安装

7.1 从安装源安装
sudo apt-get install postfixadmin
sudo apt-get install postfix-mysql
sudo apt-get install courier-authlib-mysql

7.2 添加mysql数据库
mysql -u root -p
create database postfix;
grant all on postfix.* to postfixadmin@localhost identified by 'postfixadmin';
grant select on postfix.* to postfix@localhost identified by 'postfix';
flush privileges;

7.3 配置postfixadmin
sudo vim /etc/postfixadmin/config.inc.php
找到如下地方,进行修改。
$CONF['database_type'] = 'mysqli';
$CONF['database_host'] = 'localhost';
$CONF['database_user'] = 'postfixadmin';
$CONF['database_password'] = 'postfixadmin';
$CONF['database_name'] = 'postfix';
$CONF['database_prefix'] = '';

7.4 配置apache2
ln -s /etc/postfixadmin/apache.conf /etc/apache2/conf.d/postfixadmin

7.5 测试postfixadmin
打开http://localhost/postfixadmin/
能够打开页面代表成功。
根据提示进行修改即可(并修改页面上的连接)。

7.6 修改postfix存取数据库。
sudo vim /etc/postfix/mysql_relay_domains_maps.cf
添加以下内容
user = postfix
password = postfix
hosts = 127.0.0.1
dbname = postfix
table = domain
select_field = domain
where_field = domain
additional_conditions = and backupmx = '1'

sudo vim /etc/postfix/mysql_virtual_alias_maps.cf
添加以下内容
user = postfix
password = postfix
hosts = 127.0.0.1
dbname = postfix
table = alias
select_field = goto
where_field = address

sudo vim /etc/postfix/mysql_virtual_domains_maps.cf
添加以下内容
user = postfix
password = postfix
hosts = 127.0.0.1
dbname = postfix
table = domain
select_field = domain
where_field = domain
#additional_conditions = and backupmx = '0' and active = '1'

sudo vim /etc/postfix/mysql_virtual_mailbox_limit_maps.cf
添加以下内容
user = postfix
password = postfix
hosts = 127.0.0.1
dbname = postfix
table = mailbox
select_field = quota
where_field = username
#additional_conditions = and active = '1'


sudo vim /etc/postfix/mysql_virtual_mailbox_maps.cf
添加以下内容
user = postfix
password = postfix
hosts = 127.0.0.1
dbname = postfix
table = mailbox
select_field = maildir
where_field = username
#additional_conditions = and active = '1'


修改/etc/postfix/main.cf
sudo vim /etc/postfix/main.cf
添加以下内容。

# Virtual Mailbox Domain Settings
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_mailbox_limit = 51200000
virtual_minimum_uid = 5000
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
virtual_mailbox_base = /home/vmail
virtual_transport = virtual

# Additional for quota support
virtual_create_maildirsize = yes
virtual_mailbox_extended = yes
virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql_virtual_mailbox_limit_maps.cf
virtual_mailbox_limit_override = yes
virtual_maildir_limit_message = Sorry, the your maildir has overdrawn your diskspace quota, please free up some of spaces of your mailbox try again.
virtual_overquota_bounce = yes

修改/etc/courier/authdaemonrc
sudo vim /etc/courier/authdaemonrc
修改一下内容:
authmodulelist="authmysql"

修改/etc/courier/authmysqlrc
sudo vim /etc/courier/authmysqlrc
修改一下内容:
MYSQL_SERVER localhost
MYSQL_USERNAME postfix
MYSQL_PASSWORD postfix
MYSQL_SOCKET /var/run/mysqld/mysqld.sock
MYSQL_OPT 0
MYSQL_DATABASE postfix
MYSQL_USER_TABLE mailbox
MYSQL_CRYPT_PWFIELD password
MYSQL_UID_FIELD '5000'
MYSQL_GID_FIELD '5000'
MYSQL_LOGIN_FIELD name
MYSQL_HOME_FIELD '/home/vmail'
MYSQL_NAME_FIELD name
MYSQL_MAILDIR_FIELD maildir

修改:/etc/postfix/main.cf
sudo vim /etc/postfix/main.cf
修改内容如下:
mydestination=
mynetworks=

7.7 测试postfix收发邮件。
注意:新建域名时用互联网上存在的域名,如:gmail.com

8,squirrelmail的安装

8.1 从安装源安装
sudo apt-get install squirrelmail

8.2 配置apache2
ln -s /etc/squirrelmail/apache.conf /etc/apache2/conf.d/squirrelmail

8.3 测试squirrelmail
打开http://localhost/squirrelmail/
能够登陆代表成功。


9,roundcube的安装

9.1 下载roundcubemail-0.3.1.tar.gz

9.2 安装roundcube
tar zxvf roundcubemail-0.3.1.tar.gz
sudo mv roundcubemail /usr/share/roundcubemail
sudo chown www-data:www-data {/usr/share/roundcubemail/logs, /usr/share/roundcubemail/temp}

9.3 创建mysql数据库
mysql -u root -p
create database roundcube;
grant all on roundcube.* to roundcube@localhost identified by 'roundcube';
flush privileges;

9.4 建表
mysql -u root -p
use roundcube;
source /usr/share/roundcubemail/SQL/mysql.initial.sql;

9.5 修改roundcube配置。
sudo cp /usr/share/roundcubemail/config/db.inc.php.dist /usr/share/roundcubemail/config/db.inc.php
sudo vim /usr/share/roundcubemail/config/db.inc.php
修改以下地方:
$rcmail_config['db_dsnw'] = 'mysql://roundcube:roundcube@localhost/roundcube';

sudo cp /usr/share/roundcubemail/config/main.inc.php.dist /usr/share/roundcubemail/config/main.inc.php
sudo vim /usr/share/roundcubemail/config/main.inc.php
修改以下地方:
$rcmail_config['smtp_user'] = '%u';
$rcmail_config['smtp_pass'] = '';
$rcmail_config['enable_installer'] = true;

9.6 测试roundcube
打开http://localhost/roundcube/installer
根据提示进行配置。

Linux下Apache2和Tomcat,Rails,Subversion并行部署

===============================================
httpd.conf
#subversion

DAV svn
SVNPath /home/svn
AuthType Basic
AuthName "subversion repository"
AuthUserFile /etc/subversion/passwd
AuthzSVNAccessFile /etc/subversion/authz
# Satisfy Any
Require valid-user


#jk tomcat
JkWorkersFile /etc/apache2/workers.properties
JkLogFile /var/log/apache2/mod_jk.log
JkShmFile /var/log/apache2/jkstatus
JkLogLevel warn

#passenger rails
LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.15/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.15
PassengerRuby /usr/local/bin/ruby


ServerName 192.168.0.101
DocumentRoot /var/www

RailsBaseURI /redmine
RailsEnv development

JkMountFile /etc/apache2/uriworkermap.properties


===============================================
workers.properties
worker.list=s1, status

worker.s1.port=8009
worker.s1.host=localhost
worker.s1.type=ajp13

worker.status.type=status

===============================================
uriworkermap.properties
/hudson=s1
/hudson/*=s1
/nexus=s1
/nexus/*=s1

/jkstatus=status

===============================================
environment.rb
config.action_controller.relative_url_root = '/redmine'

===============================================
在/var/www建立软连接
ln -s /usr/local/redmine-0.9.6/public /var/www/redmine

Redhat AS 5.3下ntfs-3g的安装

前提:Redhat默认的对ntfs是只读的,所以必须安装其他第三方的软件,这里我选择ntfs-3g.

1,安装fuse

1.1 下载fuse安装包,这里为fuse-2.7.6.tar.gz

1.2 编译安装
tar zxpfv fuse-2.7.6.tar.gz
cd fuse-2.7.6
./configure
报错:
checking kernel source directory... Not found
configure: error:
*** Please specify the location of the kernel source with
*** the '--with-kernel=SRCDIR' option
configure: error: ./configure failed for kernel

1.3 安装kernel source
yum install kernel-devel
ls -l /usr/src/kernels/2.6.XXX/

1.4 再次编译安装
./configure --with-kernel=/usr/src/kernels/2.6.XXX
make
make install

2, 安装ntfs-3g

2.1 下载fuse安装包,这里为fuse-2.7.6.tar.gz

2.2 编译安装
./configure --with-kernel=/usr/src/kernels/2.6.XXX
make
make install

Ftp server install on Ubuntu

1 vsftpd的安装

1.1 从安装源安装
sudo apt-get install vsftpd

1.2 测试vsftpd的安装
sudo /etc/init.d/vsftpd start
telnet localhost 21
如果成功连接,说明vsftpd安装成功。

1.3 修改vsftpd的配置
sudo vim /etc/vsftpd.conf
修改到你满意为止。

vim for Rails on ubuntu

1,安装vim完全版。

sudo apt-get install vim

2,安装vim插件。

参见:http://www.vim.org/scripts/script.php?script_id=1567
NERD_tree.vim
rails.vim
lookupfile.vim
genutils.vim
snipMate.vim
vcscommand.vim

3,修改~/.vimrc,添加以下内容:

"set guifont=Monaco\ 11
set bsdir=buffer
set enc=utf-8
set fenc=utf-8
set fencs=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
syntax on
set number
set hlsearch
set tabstop=4
set cindent shiftwidth=4
set autoindent shiftwidth=4
filetype plugin indent on
map <F8> :NERDTree<CR>
"map <C-S> <C-C>:w<CR>

Subversion install on ubuntu from source

1,从源程序安装Apache

1.1 从源程序进行安装
sudo apt-get install openssl libssl-dev
下载Apache源程序,http://www.eng.lsu.edu/mirrors/apache/httpd/httpd-x.x.x.tar.gz
tar zxvf httpd-x.x.x.tar.gz
cd httpd-x.x.x
./configure --prefix=/usr/local/apache-x.x.x \
--enable-so \
--enable-auth-digest \
--enable-rewrite \
--enable-setenvif \
--enable-mime \
--enable-ssl \
--with-ssl=/usr/local \
--enable-dav \
--enable-headers
make
sudo make install

1.2 测试安装
export APACHE_HOME=/usr/local/apache-x.x.x
export PATH=$PATH:$APACHE_HOME/bin

启动apache服务器:apachectl -k start
打开浏览器,确认连接
http://localhost
确认是否正确显示信息。

2 从源程序安装Subversion

2.1 从源程序安装
下载subversion-x.x.x.tar.gz, http://subversion.tigris.org/downloads/subversion-x.x.x.tar.gz
安装之前可能需要安装zlib1g zlib1g-dev libexpat1 libexpat1-dev
sudo apt-get install zlib1g zlib1g-dev libexpat1 libexpat1-dev
tar zxvf subversion-x.x.x.tar.gz
cd subversion-x.x.x
./configure --prefix=/usr/local/subversion-x.x.x \
--with-apr=/usr/local/apache-x.x.x \
--with-apr-util=/usr/local/apache-x.x.x \
--with-apxs
make
sudo make install

2.2 测试Subversion安装
export SVN_HOME=/usr/local/subversion-x.x.x
export PATH=$PATH:$SVN_HOME/bin

sudo svnadmin create /home/svn
sudo groupadd subversion
sudo chown -R root:subversion /home/svn
sudo chmod -R g+rws /home/svn

mkdir svntest
echo "This is a test subversion" >> svntest/test.txt
svn import -m "new import" svntest file:///home/svn/svntest