gbvc 发表于 2015-8-1 13:13:59

linux下安装apache svn ssl

  之前只在window上安装配置过,这次在redhat5.4上尝试,花了不少时间。
  google上一查原来网上的相关文章多如牛毛的,下面是参考了别人的部分配置后我的安装记录。
一、安装apache
  ./configure --enable-dav --enable-dav-fs --enable-ssl --enable-cgi --enable-modules=so
  make
  make install
  启动:
  /usr/local/apache2/bin/httpd -k start
二、安装subversion:1.6.0
  下载:
  登陆http://subversion.tigris.org 注册后下载
  subversion-deps-1.6.0.tar.gz.gz
  subversion-1.6.0.tar.gz.gz
  编译和安装:
  ./configure --with-apxs=/usr/local/apache2/bin/apxs --with-apr=/usr/local/apache2 --with-apr-util=/usr/local/apache2 --with-ssl
  make
  make install
三、关联apache和svn
  创建密码文件和添加用户
  /usr/local/apache2/bin/htpasswd -c /svn/passwd tangyj
   创建版本库
  mkdir -p /svn/repos
  svnadmin create test
   创建权限控制文件
  touch /svn/auth
   配置apache
  vim /usr/local/apache2/conf/httpd.conf
  在最后添加
  
  DAV svn
  SVNParentPath /svn/repos
  AuthType Basic
  AuthName "subverion respository"
  AuthUserFile /svn/passwd
  AuthzSVNAccessFile /svn/auth
  Require valid-user
  
  重启apache
  /usr/local/apache2/bin/httpd -k restart
  svn 可以访问,check out版本库,但是commit时失败,提示如下:
  svn: Can't create directory '/svn/repos/db/transactions/1-2.txn': Permission denied
  google后确定问题出在svn版本库目录 repos的权限上,默认是root:root
  添加一个svnroot用户组,将具有svn访问权限的用户统一加到这个组中,将repos权限改为svnroot组可读写。
四、关联apache 和 ssl
  这两天正好需要使用https访问,做好了apache和ssl关联,网上文档很多的,参考后发现还是easy的,步骤如下:
     1、生成服务器key文件
  #/usr/bin/openssl genrsa -des3 -out server.key 1024
      Enter pass phrase for server.key: 输入key文件的保护口令
     2、根据key文件生成.csr文件
        #/usr/bin/openssl req -new -key server.key -out server.csr
        Please enter the following 'extra' attributes
      to be sent with your certificate request
      A challenge password []:输入随机字符串,配合.csr文件的生成.
  3、提交.csr文件给CA,以便他们制作.crt证书文件和ca文件
  这里我们可以自己制作crt文件:
  /usr/bin/openssl x509 -in server.csr -out server.crt -req -signkey server.key -days 365
     4、收到CA来的(或者自制的).crt证书文件和ca文件后,在服务器上:      
        建立存放目录
  在/usr/local/apache2/conf/中有两个目录,ssl.crt->存放证书,ssl.key->存放密钥
  修改ssl.conf配置文件路径
  修改/usr/local/apache2/conf/ssl.conf中的两行配置:
  SSLCertificateFile /usr/local/apache2/conf/ssl.crt/server.crt
                  SSLCertificateKeyFile /usr/local/apache2/conf/ssl.key/server.key
  5、重新启动apache
  #/usr/local/apache2/bin/apachectl stop
  #/usr/local/apache2/bin/apachectl startssl
五、安装samba
  确认一下服务器上是否正确安装了samba服:
  rpm -qa | grep samba
  samba-common-3.0.33-3.14.el5
  samba-client-3.0.33-3.14.el5
  (samba服务未安装:samba-3.0.33-3.14.el5)
  找到一个rpm下载网站:http://whatislinux.net/rpm
  我下载到的是 samba-3.0.33-3.28.el5.i386.rpm 稍微有点差别。
  安装时出现下面问题:
  error: Failed dependencies:
  perl(Convert::ASN1) is needed by samba-3.0.33-3.28.el5.i386
  先安装:perl-convert-asn1-020-11.noarch.rpm
  rpm -ivh samba-3.0.33-3.28.el5.i386 提示:
  error: Failed dependencies:
  samba-common = 0:3.0.33-3.28.el5 is needed by samba-3.0.33-3.28.el5.i386
  
  结论:只能使用samba-3.0.33-3.14.el5.i386版本安装才能匹配
  所幸从原始安装盘中找到了samba-3.0.33-3.14.el5.i386.rpm
六、配置samba
  /etc/samba/smb.conf   编辑samba目录
  /etc/samba/smbusers编辑samba用户和linux用户对应关系
  smbpasswd -a tom   新增samba用户tom
  /etc/selinux/config       修改SELINUX=enforcing为SELINUX=permissive
  确认samba服务已添加至服务列表   ntsysv命令或者chkconfig --list
  重启机器
页: [1]
查看完整版本: linux下安装apache svn ssl