所需文件:
httpd-2.2.19.tar.bz2
subversion-deps-1.6.19.tar.gz
subversion-1.6.19.tar.gz
安装Apache:
# bzip2 -dc httpd-2.2.19.tar.bz2 | tar -xvf -
# ./configure--prefix=/usr/local/apache2 --enable-dav --enable-so --enable-rewrite --enable-module -with-ssl
with-ssl增加SSL功能
# make && make install
将http改为服务方式:
# cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd
# ln -s /usr/local/apache2/conf/httpd.conf /etc/httpd.conf
# vi /etc/rc.d/init.d/httpd
加下以下三行,否则chkconfig --add httpd时报service httpd does not support chkconfig
#Comments to support chkconfig on RedHat Linux
#chkconfig: 2345 90 90
#description:http server
# chkconfig --add httpd
# chkconfig --list httpd
启动,看到it works!说明安装正常。
安装subversion:
将subversion两个文件解压到相同的目录下
# tar xvzf subversion-deps-1.6.19.tar.gz
# tar xvzf subversion-1.6.19.tar.gz
# cd subversion-1.6.19
#./configure --prefix=/usr/local/subversion
# make
# make install
为安全,创建svn用户
创建版本库:
mkdir /home/svn/repository
svnadmin create /home/svn/repository/txzl
初始化目录:
# cd /opt/
# mkdir txzl txzl/Soft txzl/Documents
# svn import txzl/ file:///home/svn/repository/txzl -m "初始化SVN目录";
创建资源权限文件:
/home/svn/repository/authz.conf
[groups]
project_p = pm
project_s = admin
project_c = user01
project_t = test
[txzl:/]
@project_p = rw
* =
[txzl:/soft]
@project_p = rw
@project_s = rw
* =
[txzl:/documents]
@project_p = rw
@project_s = rw
@project_c = rw
@project_t = rw
* =
注:* = 指除所有人
创建用户文件:
1、创建user.conf文件并增加admin用户
/usr/local/apache2/bin/htpasswd -c /home/svn/repository/user.conf admin
2、增加其他用户
/usr/local/apache2/bin/htpasswd /home/svn/repository/user.conf admin2
修改httpd.conf
1、修改运行程序所属组
#User daemon
#Group daemon
改为
User svn
Group svn
2、指定svn访问目录:
<Location /svn>
DAV svn
SVNParentPath /home/svn/repository/
AuthzSVNAccessFile /home/svn/repository/authz.conf
AuthType Basic
AuthName "Subversion SVN Login Auth!"
AuthUserFile /home/svn/repository/user.conf
Require valid-user
</Location>
测试:
http://192.168.6.100/svn/txzl
配置SSL:
1、查看模块集成情况:
/usr/local/apache2/bin/httpd -l
.....
mod_ssl.c
.....
2、查看openssl
rpm -qa|grep openssl
3、生成证书文件
a.创建rsa私钥,文件名为server.key
# openssl genrsa -out server.key 1024
b.用 server.key 生成证书签署请求 CSR
#openssl req -new -key server.key -out server.csr
Country Name:两个字母的国家代号
State or Province Name:省份名称
Locality Name:城市名称
Organization Name:公司名称
Organizational Unit Name:部门名称
Common Name:你的姓名
Email Address:地址
'extra' attributes 不用输入
c.生成证书CRT文件server.crt
openssl x509 -days 365 -req -in server.csr -signkey server.key -out server.crt
将证书复制到/usr/local/apache2/下
httpd-ssl.conf文件中默认证书的参数为:
SSLCertificateFile /usr/local/apache2/server.crt
SSLCertificateKeyFile /usr/local/apache2/server.key
d.修改httpd.conf
去掉Include conf/extra/httpd-ssl.conf 前的#号
注释掉listen 80
修改servername 127.0.0.1:80为127.0.0.1:443
强制使用SSL.
重启httpd
./apachectl -S
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
_default_:443 www.example.com (/usr/local/apache2/conf/extra/httpd-ssl.conf:74)
e.测试
https://192.168.6.100/svn/txzl