CentOs7.8_x64安装Apache2.4.48+Mysql5.7.33+Redmine4.2.1+Subversion1.14.1+PHP7.3.27+SvnManager1.10

臧亦
2023-12-01
1.安装libs
# yum install -y perl perl-devel autoconf libaio gcc gcc-c++ libtool expat-devel libxml2-devel pcre pcre-devel lrzsz
2.卸载系统自带的mariadb-lib
# rpm -qa | grep mariadb
mariadb-libs-5.5.65-1.el7.x86_64
# rpm -e mariadb-libs-5.5.65-1.el7.x86_64 --nodeps
# rpm -qa |grep mysql
确认系统没有自带mysql
3.安装mysql5.7
# rpm -ivh mysql-community-common-5.7.33-1.el7.x86_64.rpm 
# rpm -ivh mysql-community-libs-5.7.33-1.el7.x86_64.rpm 
# rpm -ivh mysql-community-client-5.7.33-1.el7.x86_64.rpm
# rpm -ivh mysql-community-server-5.7.33-1.el7.x86_64.rpm 
# rpm -ivh mysql-community-devel-5.7.33-1.el7.x86_64.rpm
4.启动数据库
# service mysqld start
Redirecting to /bin/systemctl start mysqld.service
# service mysql status
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2021-06-23 16:51:18 CST; 23s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 2552 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
  Process: 2499 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 2556 (mysqld)
   CGroup: /system.slice/mysqld.service
           └─2556 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

Jun 23 16:51:14 redmine-server systemd[1]: Starting MySQL Server...
Jun 23 16:51:18 redmine-server systemd[1]: Started MySQL Server.
停止命令:systemctl stop mysqld.service
5.登录mysql
# grep password /var/log/mysqld.log
2021-06-23T08:51:16.304499Z 1 [Note] A temporary password is generated for root@localhost: :,:zH=O8o;fi
# mysql -uroot -p
Enter password: :,:zH=O8o;fi
更新密码
mysql> set password = password("you_password");
Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> exit;
6.迁移数据库文件到数据盘
# systemctl stop mysqld.service
# mkdir /mnt/mysql5.7.33-data
# mv /var/lib/mysql/* /mnt/mysql5.7.33-data/
# rm -r /var/lib/mysql
# ln -s /mnt/mysql5.7.33-data /var/lib/mysql
# chown -R mysql:mysql /mnt/mysql5.7.33-data
7.安装ruby
# tar zxvf openssl-1.1.1k.tar.gz
# cd openssl-1.1.1k
# ./config --prefix=/usr/local/openssl
# make
# make install
# cd ..
# rpm -qa |grep openssl
openssl-libs-1.0.2k-21.el7_9.x86_64
openssl-devel-1.0.2k-21.el7_9.x86_64
openssl-1.0.2k-21.el7_9.x86_64
# rpm -e openssl --nodeps
# ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl
# echo "/usr/local/openssl/lib" >> /etc/ls.so.conf
# ldconfig -v
/usr/lib64//bind9-export:
 libisc-export.so.169 -> libisc-export.so.169.0.3
 libdns-export.so.1102 -> libdns-export.so.1102.1.2
 libirs-export.so.160 -> libirs-export.so.160.0.5
 libisccfg-export.so.160 -> libisccfg-export.so.160.2.1
/usr/lib64/mysql:
 libmysqlclient.so.20 -> libmysqlclient.so.20.3.20
/lib:
/lib64:
 libmozjs-17.0.so -> libmozjs-17.0.so
 libnsssysinit.so -> libnsssysinit.so
 libnssdbm3.so -> libnssdbm3.so
。。。。。。
# openssl version -a
openssl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory
# find / -name libssl.so.1.1
/usr/local/openssl/lib/libssl.so.1.1
/usr/local/src/openssl-1.1.1k/libssl.so.1.1
# ln -s /usr/local/openssl/lib/libssl.so.1.1 /usr/lib64/libssl.so.1.1
# ln -s /usr/local/openssl/lib/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1
# openssl version
OpenSSL 1.1.1k  25 Mar 2021
# tar zxvf ruby-2.6.7.tar.gz
# cd ruby-2.6.7
# ./configure --with-openssl-dir=/usr/local/openssl
# make
# make install
# cd ,,
8.安装gem,rails,bundler
# yum install -y gem
# gem sources -l
*** CURRENT SOURCES ***

https://rubygems.org/
# gem sources --remove https://rubygems.org/
https://rubygems.org/ removed from sources
# gem sources --add https://gems.ruby-china.com
https://gems.ruby-china.com added to sources
# gem sources -l
*** CURRENT SOURCES ***

https://gems.ruby-china.com
也可以不换源
# gem install rails -v 5.2
# rails -v
Rails 5.2.0
# gem install bundler
# bundler -v
Bundler version 2.2.20
9.安装redmine4.2
# tar zxvf redmine-4.2.1.tar.gz
# mkdir /var/www
# mkdir /var/www/html
# mv redmine-4.2.1 /mnt/
# cd /mnt/redmine-4.2.1/
# bundle install 
创建数据库
# mysql -uroot -p
Enter password: you_password
mysql> CREATE DATABASE redmine CHARACTER SET utf8mb4;
Query OK, 1 row affected (0.00 sec)
mysql> CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'you_password';
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';
Query OK, 0 rows affected (0.00 sec)
mysql> exit
创建redmine数据库配置
# cp config/database.yml.example config/database.yml
修改数据库连接密码
# vim config/database.yml
为Rails生成cookies秘钥
# rake generate_secret_token
创建redmine表结构
# RAILS_ENV=production rake db:migrate
初始化数据
# RAILS_ENV=production bundle exec rake redmine:load_default_data
Select language: ar, az, bg, bs, ca, cs, da, de, el, en, en-GB, es, es-PA, et, eu, fa, fi, fr, gl, he, hr, hu, id, it, ja, ko, lt, lv, mk, mn, nl, no, pl, pt, pt-BR, ro, ru, sk, sl, sq, sr, sr-YU, sv, th, tr, uk, vi, zh, zh-TW [en] zh
====================================
Default configuration data loaded.
创建文件目录,并调整权限
# mkdir -p tmp tmp/pdf public/plugin_assets
# chown -R daemon.daemon /mnt/redmine-4.2.1
启动
# bundle exec rails server webrick -e production -p 80
 => Booting WEBrick
=> Rails 5.2.5 application starting in production on http://0.0.0.0:80
=> Run `rails server -h` for more startup options
[2021-06-23 17:50:07] INFO  WEBrick 1.4.4
[2021-06-23 17:50:07] INFO  ruby 2.6.7 (2021-04-05) [x86_64-linux]
[2021-06-23 17:50:07] INFO  WEBrick::HTTPServer#start: pid=11272 port=80
访问 http://127.0.0.1/
login: admin

password: admin
# ctrl + C 退出
10.安装Apache
# tar zxvf apr-1.6.5.tar.gz
# cd apr-1.6.5
# ./configure --prefix=/usr/local/apr
# make
# make install
# cd ..
# tar zxvf apr-util-1.6.1.tar.g
# cd apr-util-1.6.1
# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config
# make
# make install
# cd ..
# tar zxvf httpd-2.4.48.tar.g
# cd httpd-2.4.8
# ./configure --prefix=/usr/local/apache2 --enable-cache  --enable-mem-cache --enable-ssl --enable-so --enable-rewrite --enable-cgi --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre --with-ssl=/usr/local/openssl
# make
# make install
# cd ..
# tar zxvf mod_fcgid-2.3.9.tar.gz
# cd mod_fcgid-2.3.9
# APXS=/usr/local/apache2/bin/apxs ./configure.apxs
# make
# make install
# cd ..
11.安装Passenger
# gem install passenger
# yum install apr-devel apr-util-devel curl curl-devel httpd-devel
# passenger-install-apache2-module --apxs2-path=/usr/local/apache2/bin/apxs apr-config-path=/usr/local/apr/bin/apr-1-config
12.配置Apache
# cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd
# vi /etc/rc.d/init.d/httpd
在#!/bin/sh后面加入下面两行
#chkconfig:345 85 15
#description:Start and stops the Apache HTTP Server.
         # chmod +x /etc/rc.d/init.d/httpd
         # chkconfig --add httpd
# vi /usr/local/apache2/conf/httpd.conf
         修改

         #LoadModule rewrite_module modules/mod_rewrite.so

         #DocumentRoot  "/usr/local/apache2/htdocs”

         #<Directory  "/usr/local/apache2/htdocs">

改为
         DocumentRoot"/var/www/html"
         <Directory "/var/www/html">
         LoadModule rewrite_module modules/mod_rewrite.so
添加
ServerName 127.0.0.1
LoadModule passenger_module /usr/local/lib/ruby/gems/2.6.0/gems/passenger6.0.9/buildout/apache2/mod_passenger.so
  
   <IfModule mod_passenger.c>
     PassengerRoot /usr/local/lib/ruby/gems/2.6.0/gems/passenger-6.0.9
     PassengerDefaultRuby /usr/local/bin/ruby
   </IfModule>
:x 保存退出
# vi /usr/local/apache2/conf/extra/httpd-vhosts.conf
<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot "/mnt/redmine-4.2.1/public"
    ServerName redmine.keyush.cn
    ErrorLog "logs/redmine-error_log"
    CustomLog "logs/redmine-access_log" common
    <Directory /mnt/redmine-4.2.1/public>
        AllowOverride all
        Options -MultiViews
        Require all granted
    </Directory>
</VirtualHost>
:x 保存退出
重启apache,
# service httpd restart
13.安装SVN Server
# yum install -y bzip2 unzip zip
# tar zxvf scons-3.1.2.tar.gz 
# cd scons-3.1.2
# python -V
Python 2.7.5
# python setup.py install --prefix=/usr/local/scons
# cd ..
# tar jxvf serf-1.3.9.tar.bz2
# cd serf-1.3.9
# /usr/local/scons/bin/scons PREFIX=/usr/local/serf APR=/usr/local/apr APU=/usr/local/apr-util
# /usr/local/scons/bin/scons install
scons: Reading SConscript files ...
Checking for GNU-compatible C compiler...(cached) yes
scons: done reading SConscript files.
scons: Building targets ...
Install file: "libserf-1.a" as "/usr/local/lib/libserf-1.a"
Install file: "libserf-1.so.1.3.0" as "/usr/local/lib/libserf-1.so.1.3.0"
Install file: "serf.h" as "/usr/local/include/serf-1/serf.h"
Install file: "serf_bucket_types.h" as "/usr/local/include/serf-1/serf_bucket_types.h"
Install file: "serf_bucket_util.h" as "/usr/local/include/serf-1/serf_bucket_util.h"
Install file: "serf-1.pc" as "/usr/local/lib/pkgconfig/serf-1.pc"
scons: done building targets
# cd ..
# tar zxvf sqlite-autoconf-3360000.tar.gz
# cd sqlite-autoconf-3360000
# ./configure --prefix=/usr/local/sqlite
# make
# make install
# tar zxvf subversion-1.14.1.tar.gz
# cd subversion-1.14.1
# ./configure --prefix=/usr/local/svn-server --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-serf=/usr/local/serf --enable-mod-activation --with-apache-libexecdir=/usr/local/apache2/modules --with-apxs=/usr/local/apache2/bin/apxs --without-berkeley-db --with-lz4=internal --with-utf8proc=internal --with-sqlite=/usr/local/sqlite
# make
# make install
# cd ..
配置环境变量
# export PATH=$PATH:/usr/local/svn-server/bin:/usr/local/apache2/bin
# source /etc/profile
# svn --version
svn: error while loading shared libraries: libserf-1.so.1: cannot open shared object file: No such file or directory
# cd /usr/local/svn-server/bin
# ldd svn
 linux-vdso.so.1 =>  (0x00007ffec67ae000)
 libsvn_client-1.so.0 => /usr/local/svn-server/lib/libsvn_client-1.so.0 (0x00007fb16eb46000)
 libsvn_wc-1.so.0 => /usr/local/svn-server/lib/libsvn_wc-1.so.0 (0x00007fb16e88c000)
 libsvn_ra-1.so.0 => /usr/local/svn-server/lib/libsvn_ra-1.so.0 (0x00007fb16e67e000)
 libsvn_diff-1.so.0 => /usr/local/svn-server/lib/libsvn_diff-1.so.0 (0x00007fb16e465000)
 libsvn_ra_local-1.so.0 => /usr/local/svn-server/lib/libsvn_ra_local-1.so.0 (0x00007fb16e25b000)
 libsvn_repos-1.so.0 => /usr/local/svn-server/lib/libsvn_repos-1.so.0 (0x00007fb16e01b000)
 libsvn_fs-1.so.0 => /usr/local/svn-server/lib/libsvn_fs-1.so.0 (0x00007fb16de0e000)
 libsvn_fs_fs-1.so.0 => /usr/local/svn-server/lib/libsvn_fs_fs-1.so.0 (0x00007fb16dbb9000)
 libsvn_fs_x-1.so.0 => /usr/local/svn-server/lib/libsvn_fs_x-1.so.0 (0x00007fb16d965000)
 libsvn_fs_util-1.so.0 => /usr/local/svn-server/lib/libsvn_fs_util-1.so.0 (0x00007fb16d761000)
 libsvn_ra_svn-1.so.0 => /usr/local/svn-server/lib/libsvn_ra_svn-1.so.0 (0x00007fb16d53d000)
 libsasl2.so.3 => /lib64/libsasl2.so.3 (0x00007fb16d320000)
 libsvn_ra_serf-1.so.0 => /usr/local/svn-server/lib/libsvn_ra_serf-1.so.0 (0x00007fb16d0eb000)
 libserf-1.so.1 => not found
 libsvn_delta-1.so.0 => /usr/local/svn-server/lib/libsvn_delta-1.so.0 (0x00007fb16cecc000)
 libsvn_subr-1.so.0 => /usr/local/svn-server/lib/libsvn_subr-1.so.0 (0x00007fb16cbf3000)
 libsqlite3.so.0 => /usr/local/sqlite/lib/libsqlite3.so.0 (0x00007fb16c8d3000)
 libz.so.1 => /lib64/libz.so.1 (0x00007fb16c6bd000)
 libm.so.6 => /lib64/libm.so.6 (0x00007fb16c3bb000)
 libaprutil-1.so.0 => /usr/local/apr-util/lib/libaprutil-1.so.0 (0x00007fb16c191000)
 libexpat.so.1 => /lib64/libexpat.so.1 (0x00007fb16bf67000)
 libapr-1.so.0 => /usr/local/apr/lib/libapr-1.so.0 (0x00007fb16bd31000)
 librt.so.1 => /lib64/librt.so.1 (0x00007fb16bb29000)
 libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007fb16b8f2000)
 libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fb16b6d6000)
 libdl.so.2 => /lib64/libdl.so.2 (0x00007fb16b4d2000)
 libc.so.6 => /lib64/libc.so.6 (0x00007fb16b104000)
 libserf-1.so.1 => not found
 libserf-1.so.1 => not found
 libresolv.so.2 => /lib64/libresolv.so.2 (0x00007fb16aeea000)
 libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x00007fb16ac9d000)
 libkrb5.so.3 => /lib64/libkrb5.so.3 (0x00007fb16a9b4000)
 libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x00007fb16a781000)
 libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00007fb16a57d000)
 libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x00007fb16a36d000)
 /lib64/ld-linux-x86-64.so.2 (0x00007fb16edd9000)
 libserf-1.so.1 => not found
 libfreebl3.so => /lib64/libfreebl3.so (0x00007fb16a16a000)
 libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007fb169f66000)
 libselinux.so.1 => /lib64/libselinux.so.1 (0x00007fb169d3f000)
 libpcre.so.1 => /lib64/libpcre.so.1 (0x00007fb169add000)
# ln -s /usr/local/serf/lib/libserf-1.so.1.3.0 /lib64/libserf-1.so.1
# ln -s /usr/local/subversion/bin/svnserve /usr/bin/svnserve
# ln -s /usr/local/subversion/bin/svn /usr/bin/svn
# svnserve --version
svnserve, version 1.14.1 (r1886195)
   compiled Jun 24 2021, 11:12:48 on x86_64-unknown-linux-gnu

Copyright (C) 2021 The Apache Software Foundation.
This software consists of contributions made by many people;
see the NOTICE file for more information.
Subversion is open source software, see http://subversion.apache.org/

The following repository back-end (FS) modules are available:

* fs_fs : Module for working with a plain file (FSFS) repository.
* fs_x : Module for working with an experimental (FSX) repository.

Cyrus SASL authentication is available.
# svn --version
svn, version 1.14.1 (r1886195)
   compiled Jun 24 2021, 11:12:48 on x86_64-unknown-linux-gnu

Copyright (C) 2021 The Apache Software Foundation.
This software consists of contributions made by many people;
see the NOTICE file for more information.
Subversion is open source software, see http://subversion.apache.org/

The following repository access (RA) modules are available:

* ra_svn : Module for accessing a repository using the svn network protocol.
  - with Cyrus SASL authentication
  - handles 'svn' scheme
* ra_local : Module for accessing a repository on local disk.
  - handles 'file' scheme
* ra_serf : Module for accessing a repository via WebDAV protocol using serf.
  - using serf 1.3.9 (compiled with 1.3.9)
  - handles 'http' scheme
  - handles 'https' scheme

The following authentication credential caches are available:

* GPG-Agent
14.安装PHP
# yum -y install libxml2-devel sqlite-devel libcurl-devel libpng-devel postgresql-devel libzip-devel libjpeg-devel freetype-devel python-devel libXpm-devel
# tar zxvf zlib-1.2.11.tar.gz
# cd zlib-1.2.11
# ./configure --prefix=/usr/local/zlib
# make
# make install
# cd ..
# tar zxvf libpng-1.6.37.tar.gz
# cd libpng-1.6.37
# ./configure --prefix=/usr/local/libpng
# make
# make install
# cd ..
# tar zxvf jpegsrc.v9d.tar.gz
# cd jpeg-9d
# ./configure --prefix=/usr/local/jpeg9
# make
# make install
# cd ..
# tar zxvf libxml2-2.9.10.tar.gz
# cd libxml2-2.9.10
# ./configure --prefix=/usr/local/libxml2 --with-zlib=/usr/local/zlib
# make
# make install
# cd ..
# tar zxvf freetype-2.10.4.tar.gz
# cd freetype-2.10.4
# ./configure --prefix=/usr/local/freetype --with-png
# make
# make install
# cd ..
# tar zxvf libgd-2.2.5.tar.gz
# mkdir -p /usr/local/gd
# cd libgd-2.2.5
# ./configure --prefix=/usr/local/gd --with-jpeg=/usr/local/jpeg9 --with-png=/usr/local/libpng --with-freetype=/usr/local/freetype --with-zlib=/usr/local/zlib
# make
# make install
# cd ..
# tar zxvf cmake-3.21.0-rc1.tar.gz
# cd cmake-3.21.0-rc1
# ./bootstrap
# gmake
# make install
# cd ..
# tar zxvf libzip-1.7.3.tar.gz
# cd libzip-1.7.3
# mkdir build 
# cd build 
# cmake -DCMAKE_INSTALL_PREFIX=/usr ..
# make
# make install
# cd ../..
# tar zxvf php-7.3.27.tar.gz
# cd php-7.3.27
# ./configure --prefix=/usr/local/php --with-config-file-path=/etc --with-apxs2=/usr/local/apache2/bin/apxs --with-pdo-mysql --with-mysqli --with-mysql-sock=/var/lib/mysql/mysql.sock --with-gd=/usr/local/gd --with-iconv --with-freetype-dir=/usr/local/freetype --with-jpeg-dir=/usr/local/jpeg9 --with-png-dir=/usr/local/libpng --with-zlib-dir=/usr/local/zlib --with-libxml-dir=/usr/local/libxml2 --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-ftp --disable-phar --with-openssl=/usr/local/openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-gettext --enable-session --enable-mbstring
# make
# make install
# cp /usr/local/src/php-7.3.27/php.ini-production /etc/php.ini
# cd ..
# vim /usr/local/apache/conf/httpd.conf
  追加
  AddType application/x-httpd-php  .php
  AddType application/x-httpd-php-source .phps
  DirectoryIndex index.html index.php
:wq
# tar zxvf curl-7.76.1.tar.gz
# cd curl-7.76.1
# ./configure --prefix=/usr/local/curl --with-ssl=/usr/local/openssl --with-zlib=/usr/local/zlib
# make
# make install
# cd ..
# cd  php-7.3.27/ext/curl/
# /usr/local/php/bin/phpize
# ./configure --with-php-config=/usr/local/php/bin/php-config --with-curl=/usr/local/curl
# make
# make install
Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-zts-20180731/
# vi /etc/php.ini
添加
extension=/usr/local/php/lib/php/extensions/no-debug-zts-20180731/curl.so
:wq
重启Apache
# service httpd restart
15.安装SvnManager
# cd /usr/local/src
# tar zxvf svnmanager-1.10.tar.gz
# mv svnmanager-1.10 /var/www/html/
# cd /usr/local/php/
# curl -o go-pear.php https://pear.php.net/go-pear.phar
# /usr/local/php/bin/php go-pear.php
Below is a suggested file layout for your new PEAR installation.  To
change individual locations, type the number in front of the
directory.  Type 'all' to change all of them or simply press Enter to
accept these locations.

 1. Installation base ($prefix)                   : /usr/local/php
 2. Temporary directory for processing            : /tmp/pear/install
 3. Temporary directory for downloads             : /tmp/pear/install
 4. Binaries directory                            : /usr/local/php/bin
 5. PHP code directory ($php_dir)                 : /usr/local/php/lib/php
 6. Documentation directory                       : /usr/local/php/docs
 7. Data directory                                : /usr/local/php/data
 8. User-modifiable configuration files directory : /usr/local/php/cfg
 9. Public Web Files directory                    : /usr/local/php/www
10. System manual pages directory                 : /usr/local/php/man
11. Tests directory                               : /usr/local/php/tests
12. Name of configuration file                    : /usr/local/php/etc/pear.conf

1-12, 'all' or Enter to continue: 回车
# mv /usr/local/src/VersionControl_SVN-0.5.2.tgz /usr/local/php/bin/
# ./pear install VersionControl_SVN-0.5.2.tgz
Package "pear.php.net/VersionControl_SVN" dependency "pear.php.net/PEAR" has no releases
install ok: channel://pear.php.net/VersionControl_SVN-0.5.2
# mysql -u root -p
Enter password: you_password
mysql> create database svn_manager;
Query OK, 1 row affected (0.00 sec)
mysql> grant all privileges on svn_manager.* to svn_admin@localhost identified by 'you_password';
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
# cd /var/www/html/svnmanager-1.10
# cp config.php.linux  config.php
# vim /var/www/html/svnmanager/config.php
 $htpassword_cmd = "/usr/local/apache2/bin/htpasswd";
 $svn_cmd = "/usr/local/svn-server/bin/svn";
 $svnadmin_cmd  = "/usr/local/svn-server/bin/svnadmin --config-dir /mnt/svn-data/config";
 //Subversion locations SVN全局设置信息文件所在的目录,默认是在~/.subversion下的
 $svn_config_dir = "/mnt/svn-data/conf";
 //与httpd.conf文件中的SVNParentPath含义相同
 $svn_repos_loc = "/mnt/svn-data/repos";   存放仓库的目录
 $svn_passwd_file = "/mnt/svn-data/conf/passwd";  存放密码的文件
 $svn_access_file = "/mnt/svn-data/conf/authz"; 存放权限分配的文件
 $svn_trash_loc = "/mnt/svn-data/trash";  设置回收站目录,以防误删
 $dsn  =   "mysqli://svn_admin:you_password@localhost/svn_manager";  连接mysql SVN数据库
 //数据库
 $admin_name = "admin"; 初始用户名
 $admin_temp_password = "admin"; 初始密码
:x
Apache配置修改
# vim /usr/local/apache/conf/httpd.conf
<Location /repos>
    DAV svn
    #SVNPath /mnt/svn-data/
    SVNParentPath /mnt/svn-data/repos
    SVNListParentPath on

    AuthType Basic
    AuthName "Subversion repository"
    AuthUserFile "/mnt/svn-data/conf/passwd" 
    AuthzSVNAccessFile "/mnt/svn-data/conf/authz" 

    Require valid-user
    SSLRequireSSL  

</Location>
:x
重启Apache
# service httpd restart
访问
http://svn-manager.keyush.cn/
svnmanager 安装完毕后,使用admin/admin 登陆后,添加新用户时出现“You entered an invalid email address. ” 错误。
解决方法是:修改svnmanager/UserModule/AddPage.tpl 文件
即注释掉第33行
 <com:TEmailAddressValidator ControlToValidate="Email" Display="Dynamic">Invalid e-mail address!</com:TEmailAddressValidator>
改为
 <!--<com:TEmailAddressValidator ControlToValidate="Email" Display="Dynamic">Invalid  e-mail address!</com:TEmailAddressValidator>-->
16.开启HTTPS
购买证书,并把证书文件上传到apache的配置目录下,新建ssl目录中
修改apache配置文件
# vim /usr/local/apache/conf/httpd.conf
 #LoadModule ssl_module modules/mod_ssl.so
 #Include conf/extra/httpd-ssl.conf
取消#
:x
# vim /usr/local/apache2/conf/extra/httpd-ssl.conf
<VirtualHost *:443>    
    ServerName  svn-manager.keyush.cn。                   
    DocumentRoot  /var/www/html/svnmanager-1.10      
    ErrorLog "logs/svnmanager-error_log"
    CustomLog "logs/svnmanager-access_log" common
    <Directory /var/www/html/svnmanager-1.10>
        AllowOverride all
        Options -MultiViews
        Require all granted
    </Directory> 
 
    SSLEngine on  
    SSLProtocol all -SSLv2 -SSLv3 # 添加SSL协议支持协议,去掉不安全的协议。
    SSLCipherSuite HIGH:!RC4:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!EXP:+MEDIUM   # 修改加密套件。
    SSLHonorCipherOrder on
    SSLCertificateFile cert/domain name1_public.crt   # 将domain name1_public.crt替换成您证书文件名。
    SSLCertificateKeyFile cert/domain name1.key   # 将domain name1.key替换成您证书的密钥文件名。
    SSLCertificateChainFile cert/domain name1_chain.crt  # 将domain name1_chain.crt替换成您证书的密钥文件名;证书链开头如果有#字符,请删除。
</VirtualHost>
:x
配置强制https
# vim /usr/local/apache2/conf/extra/httpd-vhosts.conf
对应域名的虚拟主机修改如下

<VirtualHost *:80>
    ServerName svn-manager.keyush.cn
    RewriteEngine on
    RewriteCond %{SERVER_PORT} !^443
    RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [L,R]
</VirtualHost>
:x
配置Apache访问svn节点
# vim /usr/local/apache2/conf/extra/httpd-ssl.conf 
<VirtualHost *:443>
    ServerName   svn.keyush.cn
    DocumentRoot  /mnt/svn-data/repos
    ErrorLog "/usr/local/apache2/logs/svnm-error_log"
    CustomLog "/usr/local/apache2/logs/svnm-access_log" common
    <Directory /mnt/svn-data/repos>
        AllowOverride all
        Options -MultiViews
        Require all granted
    </Directory>

    SSLCertificateFile "/usr/local/apache2/conf/ssl/XXXX_public.crt"
    SSLCertificateKeyFile "/usr/local/apache2/conf/ssl/XXXXX.key"
    SSLCertificateChainFile "/usr/local/apache2/conf/ssl/XXXX_chain.crt"
</VirtualHost>
:x
强制https访问svn节点
# vim extra/httpd-vhosts.conf
<VirtualHost *:80>
    ServerName svn.keyush.cn
    RewriteEngine on
    RewriteCond %{SERVER_PORT} !^443
    RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [L,R]
</VirtualHost>
:x
配置开机自启
# systemctl enable mysqld
# systemctl enable httpd
svnmanager1.10安装完毕后,选择“Repository Admin"-->"Group Privileges",会出现repository的列表,选择其中一个”Select"后,会出现如下错误:
VersionControl_SVN_Exception: "svn_path" is not a valid option
#0 /usr/local/php/lib/php/VersionControl/SVN.php(267): VersionControl_SVN_Command->setOptions(Array)
#1 /usr/local/php/lib/php/VersionControl/SVN.php(226): VersionControl_SVN::init('list', Array)
#2 /opt/apps/web/php/svnmanager/svnmanager/RepositoryModule/GroupPrivilegesEditPage.php(214): VersionControl_SVN::factory(Array, Array)
......
解决方法是编辑/var/www/html/svnmanager/svnmanager/RepositoryModule目录下的

 UserPrivilegesEditPage.php 和 GroupPrivilegesEditPage.php 文件 :

$options = array('fetchmode' => VERSIONCONTROL_SVN_FETCHMODE_ARRAY, 'svn_path' => $svn_cmd);

改成:

$options = array('fetchmode' => VERSIONCONTROL_SVN_FETCHMODE_ARRAY);

目前程序运行良好,但是不知道以后是否会有问题。

 类似资料: