首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 服务器 > Apache >

装配subversion1.8和apache

2013-11-20 
安装subversion1.8和apache一.安装apr和apr-utiwget http://mirror.bit.edu.cn/apache//apr/apr-1.4.8.tar

安装subversion1.8和apache
一.安装apr和apr-uti

wget http://mirror.bit.edu.cn/apache//apr/apr-1.4.8.tar.gztar zxvf apr-1.4.8.tar.gzcd apr-1.4.8./configure --prefix=/usr/local/aprmake && make install

验证:
#/usr/local/apr/bin/apr-1-config --version
1.4.8

wget http://mirrors.cnnic.cn/apache/apr/apr-util-1.5.2.tar.gztar zxvf apr-util-1.5.2.tar.gzcd apr-util-1.5.2./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/make && make install

验证:
#/usr/local/apr-util/bin/apu-1-config --version
1.5.2

二.安装sqlite3
wget http://www.sqlite.org/2013/sqlite-autoconf-3080000.tar.gztar zxvf sqlite-autoconf-3080000.tar.gzcd sqlite-autoconf-3080000./configure make && make install


三.安装openssl
wget http://www.openssl.org/source/openssl-1.0.1.tar.gztar xzvf openssl-1.0.1.tar.gzcd openssl-1.0.1./config --prefix=/usr/local/opensslmake && make install


四.安装apache http server 和ssl model
wget http://mirrors.cnnic.cn/apache//httpd/httpd-2.2.25.tar.gztar zxvf httpd-2.2.25.tar.gzexport LDFLAGS=-ldlcd httpd-2.2.25./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr-util/bin/apu-1-config --enable-modules=so --enable-dav --enable-maintainer-mode --enable-rewrite --enable-ssl --with-ssl=/usr/local/opensslmake && make install

设置开机启动
cp  /usr/local/apache2/bin/apachectl /etc/init.d/httpd#编辑/etc/init.d/httpd,在第二行增加如下内容#chkconfig: 2345 85 35chkconfig httpd on


通过service httpd start启动服务,正常情况下会提示启动成功,通过在其他电脑上打开浏览器浏览这台服务器IP的80端口服务,如果出现It works 字样,恭喜您,安装成功

如果出现
httpd: Could not reliably determine the server’s fully qualified domain name,
只需要编辑httpd.conf 将里面的
#ServerName www.example.com:80注释去掉即可,,并改成ServerName 127.0.0.1:80

五.安装zlib
wget  http://jaist.dl.sourceforge.net/project/libpng/zlib/1.2.8/zlib-1.2.8.tar.gztar -xvzf zlib-1.2.8.tar.gzcd zlib-1.2.8./configuremake && make install



六.安装subversion1.8
wget http://mirror.esocc.com/apache/subversion/subversion-1.8.4.tar.gztar zxvf subversion-1.8.4.tar.gzmkdir -p ./subversion-1.8.4/sqlite-amalgamationcp ./sqlite-autoconf-3080000/sqlite3.c ./subversion-1.8.4/sqlite-amalgamationcd subversion-1.8.4./configure --prefix=/opt/svn/subversion --with-apxs=/usr/local/apache2/bin/apxs --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr-util/bin/apu-1-config  --with-zlib --enable-maintainer-modemake && make install

验证:
#/opt/svn/subversion/bin/svnserve --version
svnserve, version 1.8.4 (r1534716)

七、整合Apache
拷贝模块
cp /opt/svn/subversion/libexec/mod_authz_svn.so /usr/local/apache2/modules/cp /opt/svn/subversion/libexec/mod_dav_svn.so /usr/local/apache2/modules/

编辑http.conf文件
vi /usr/local/apache2/conf/httpd.conf
在最后面增加如下内容
#加载整合svn所需so文件LoadModule dav_svn_module     modules/mod_dav_svn.soLoadModule authz_svn_module   modules/mod_authz_svn.so<Location />     DAV  svn     SVNParentPath /opt/svn/data/      #svn 根目录     SVNListParentPath On     SVNAutoversioning On     SVNReposName "svn"     AuthzSVNAccessFile /opt/svn/subversion/conf/authz.conf  #目录分组权限     AuthType Basic     AuthName "Subversion repository"     AuthUserFile /opt/svn/subversion/conf/passwd.conf   #密码验证文件     Require valid-user</Location>



八、配置Subversion
1)建立svn版本库目录
mkdir -p /opt/svn/data/repos

可以多建版本库目录,这里我的目录是repos

2)建立svn版本库
svnadmin create /opt/svn/data/repos 

因为apache的线程使用的用户是daemon
chown -R daemon /opt/svn/data/reposchmod -R 755 /opt/svn/data/repos 


3)建立本地访问控制文件
/usr/local/apache2/bin/htpasswd -c /opt/svn/subversion/conf/passwd.conf  username

然后输入密码即可,默认是MD5加密的
添加新用户
/usr/local/apache2/bin/htpasswd  /opt/svn/subversion/conf/passwd.conf  username1 


4)建立本地项目控制文件
touch /opt/svn/subversion/conf/authz.conf
本例authz.conf内容为:
[groups]  #<groupname1>=<username1>,<username2>  admin=username       #[<versionLib>:projectName/directory]       #@<groupsname>=<authorities>       #<username>=<authorities>    [/]       @admin = rw        #指定用户组成员可以读写根目录所有应用         [repos:/abc/aaa]       username1= rw       #指定用户username1可以读写:/abc/aaa目录的文件 


测试连接
1)启动apache
/usr/local/apache2/bin/apachectl start

2)再浏览器访问http://192.168.1.100/repos
     #本例服务器ip是192.168.1.100
     使用刚才创建的权限用户名与密码登录即可访问

九.安装neon
wget http://www.webdav.org/neon/neon-0.29.6.tar.gztar zxvf neon-0.29.6.tar.gzcd neon-0.29.6./configure --prefix=/usr/local/neonmake && make install


十、配置https
1:生成证书私钥
#128位rsa算法生成密钥[root@SVN-SERVER ~]# openssl genrsa 1024 > server.keyGenerating RSA private key, 1024 bit long modulus.....++++++......++++++e is 65537 (0x10001)

2.填写凭证申请书
被问及Common Name的时候,请输入你的web服务器的hostname 例如:SVN-SERVER.
被问及A challenge  password的时候,直接按回车继续。否则每次你运行/usr/local/httpd/apachectl start启动服务器的时候你都要输入密码。这也就意味着如果你的服务器因为某些原因重新启动了,除非你在服务器旁手动敲入了密码,否则你的web服务器就不会启动
[root@SVN-SERVER ~]# openssl req -new -key server.key > server.csrYou are about to be asked to enter information that will be incorporatedinto your certificate request.What you are about to enter is what is called a Distinguished Name or a DN.There are quite a few fields but you can leave some blankFor some fields there will be a default value,If you enter '.', the field will be left blank.-----Country Name (2 letter code) [XX]:CNState or Province Name (full name) []:beijingLocality Name (eg, city) [Default City]:beijingOrganization Name (eg, company) [Default Company Ltd]:noneOrganizational Unit Name (eg, section) []:Common Name (eg, your name or your server's hostname) []:SVN-SERVEREmail Address []:Please enter the following 'extra' attributesto be sent with your certificate requestA challenge password []:An optional company name []:


3:生成web证书
openssl req -x509 -days 365 -key server.key -in server.csr > server.crt


4:添加相关证书文件
cp ./server.crt /usr/local/apache2/confcp ./server.key /usr/local/apache2/conf


5.编辑httpd.conf
取消httpd.conf下面这句之前的'#',以启用ssl支持
Include conf/extra/httpd-ssl.conf


6.设置httpd-ssl.conf文件
cd /usr/local/apache2/conf/extra vim httpd-ssl.confSSLCertificateFile "/usr/local/apache2/conf/server.crt"SSLCertificateKeyFile "/usr/local/apache2/conf/server.key"


7.强制通过SSL方式访问svn服务
同时在httpd.conf 的<Location />配置里增加
SSLRequireSSL

热点排行