前面的文章有写过svn版本管理工具的安装是基于svn的安装包进行安装,对于svn与apache的结合还得下svn和apache的模块进行结合过程比较繁琐,今天来介绍下通过centos的yum来安装svn能够快速安装svn,安装过程大致分成4个部分:1、svn的安装和版本库的建立,2、apache的安装和配置,3、svnmanager的安装和配置 4、mysql的安装。如果不需要安装svnmanager进行管理svn只需要安装1和2过程即可。let's do it...
一、svn的安装和版本库的建立
1、安装软件
yum install subversion mysql-server httpd mod_dav_svn mod_perl sendmail wget gcc-c++ make unzip perl* ntsysv vim-enhanced httpd php php-mysql php-pear php-mbstring
2、创建svn仓库和修改配置
mkdir /home/svn
svnadmin create /home/svn/project
修改svnserve.conf、authz、passwd文件如下:
vi /home/svn/project/conf/svnserve.conf
[general]
anon-access = none
auth-access = write
password-db = /home/svn/project/conf/passwd
authz-db = /home/svn/project/conf/authz
vi /home/svn/project/conf/authz
[groups]
[project:/]
zhangyaowen = rw
vi /home/svn/project/conf/passwd
[users]
zhangyaowen=zhangyaowen
配置完毕可以启动测试svn安装是否成功
启动svn:svnserve -d -r /home/svn
ps -aux|grep svnserve
关闭 kill -9 ID号
访问地址:
http://172.30.11.46/project
二、配置apache
修改/etc/httpd/conf.d/php.conf
#add by wen
DAV svn
SVNPath /home/svn/
AuthType Basic
AuthName "svn for project"
AuthUserFile /home/svn/project/conf/httpPwd
AuthzSVNAccessFile /home/svn/project/conf/authz
Satisfy all
Require valid-user
修改/home/svn目录所属用户和所属组
创建文件 touch /home/svn/project/conf/httpPwd
chown -R apache:apache /home/svn
启动apache并验证svn
service httpd start
http://172.30.11.46/project
通过http命令添加用户名和密码:htpasswd /home/svn/project/conf/httpPwd zhangyaowen 然后在输入一次密码zhangyaowen即可
三、安装和配置svnmanager
下载svnmanager解压并放置到/var/www/html/下
配置/etc/httpd/conf/httpd.conf
#add by zhangyaowen svnmanager
AllowOverride None
Order deny,allow
Deny from all
Allow from all
四、 创建svnmanager database
1、修改配置,如果不需要修改可以忽略此步骤:
使用的mysql数据库 如果不用修改mysql的数据保存目录直接启动创建svnmanager用户和密码即可如果有需要修改mysql的my.cnf目录可以做一下配置:
datadir=/app/mysql
socket=/app/mysql/mysql.sock
[mysqld]
datadir=/app/mysql
socket=/app/mysql/mysql.sock
[mysql]
socket=/app/mysql/mysql.sock
[client]
socket=/app/mysql/mysql.sock
[mysqldump]
socket=/app/mysql/mysql.sock
[mysqladmin]
socket=/app/mysql/mysql.sock
其中socket等于的路径就是socket文件的位置,我们只要修改my.cnf文件,告诉mysql,mysqldump,mysqladmin等mysql服务的socket位置在哪里就可以。在/etc/my.cnf文件中添加如下内容,并重启mysqls服务,即可解决mysql,mysqldump,mysqladmin的“Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'”问题。如果我们是通过php去链接mysql所以还需要修改/etc/php.ini连接配置svnmanager用的是mysqli进行连接mysql所以修改如下:
vi /etc/php.ini,找到mysqli.default_socket = ""这一行修改为mysqli.default_socket = "/app/mysql/mysql.sock"
2、启动数据库
service mysqld restart
mysqladmin -u root password 123456 创建用户初始化密码
mysql -uroot -p 123456 登录mysql
创建数据库
mysql -uroot -p
执行
create database svn;
grant all on svn.* to svnmanager@localhost identified by "svnmanager123456";
flush privileges;
quit;
3、修改php配置:
vim /var/www/html/svnmanager/config.php
$htpassword_cmd = "/usr/bin/htpasswd";
$svn_cmd = "/usr/bin/svn";
$svnadmin_cmd = "/usr/bin/svnadmin";
//Subversion locations
$svn_config_dir = "/home/svn/project/conf";
$svn_repos_loc = "/home/svn";
$svn_passwd_file = "/home/svn/project/conf/httpPwd";
$svn_access_file = "/home/svn/project/conf/authz";
$svn_trash_loc = "/app/trash";
$svnserve_user_file="";
$smtp_server = "smtp.126.com";
$dsn = "mysqli://svnmanager:svnmanager123456@localhost/svn";
$admin_name = "admin";
$admin_temp_password = "admin";
重启apache service httpd restart
访问:http://172.30.11.46/svnmanager,首次登陆用户名密码为admin
http://172.30.11.46/svn/project
参考:https://note.youdao.com/share/?id=0d013f5bc29ca0f63c1c14a3b86ce661&type=note#/
转载至链接:https://my.oschina.net/javazyw/blog/1861301