Jul 31, 2017 No Comments 服务器迁移(2)---svn 和submin ##程序安装 ###1、安装apache 检查apache是否安装 ``` rpm -qa|grep httpd ``` 使用yum安装apache ``` yum -y install httpd ``` 启动apache测试apache是否可用 注意:在centos7中使用systemctl替换了service ``` systemctl start httpd.service systemctl status httpd.service ``` 浏览器输入IP查看是否能显示以下页面 ##2、安装SVN 检查svn是否安装 ``` rpm -qa|grep subversion ``` 阿里云已经安装了svn,如果没有安装使用 yum install subversion 命令安装 使用命令查看版本 ``` svnserve --version ``` 记住版本号svnserve,版本 1.7.14 (r1542130) 安装apache对svn的支持模块 ``` yum install mod_dav_svn ``` 安装完成后apache的modules目录下会多两个文件 ``` mod_authz_svn.so mod_dav_svn.so ``` 安装python对svn的支持 ``` yum install subversion-python ``` ###3、安装submin * Submin 提供了基于 Web浏览器的 Subversion 版本控制系统的管理接口,功能包括用户、用户组的管理、路径权限的设置以及创建新的资料库等等。兼容各种浏览器。 安装所需要的包 ``` yum -y install httpd subversion mod_dav_svn subversion-python apr-util-sqlite apr-util ``` * mod_dav_svn 是apache支持svn所需要用的model aprutilsqlite 是apache支持sqlite数据库所需要用的model 2.2 安装submin ``` wget http://supermind.nl/submin/current/submin-2.2.1-1.tar.gz tar xf submin-2.2.1-1.tar.gz cd submin-2.2.1-1 python setup.py install ``` 验证安装 ``` submin2-admin Submin ``` 配置submin ``` submin2-admin /usr/local/submin/ initenv 992747643@qq.com ``` 邮箱很重要, submin会将管理员设置初始口令的链接发到这邮箱中,/usr/local/submin这个目录不要提前建,安装命令的向导一步步设置就可以了,说明很清楚. ``` Submin can enable features for you automatically. Please answer which features you want to enable. You can choose to enable: 'svn', 'git', 'trac', 'apache' and 'nginx'. Which features do you want to enable? [svn, git, apache, nginx]> svn Please provide a location for the Subversion repositories. For new Subversion repositories, the default setting is ok. If the path is not absolute, it will be relative to the submin environment. If you want to use an existing repository, please provide the full pathname to the Subversion parent directory (ie. /var/lib/svn). Path to the repository? [svn]> /opt/svn/ Please provide a hostname that can be used to reach the web interface. This hostname will be used in communication to the user (a link in email, links in the web interface). The hostname should be a FQDN, so instead of 'foo' it should be 'foo.example.com'. Please correct if the default is incorrect. Hostname? [SVN]> *.pashanhoo.com The HTTP path tells Submin where the website is located relative to the root. This is needed for proper working of the website. Submin will be accesible from /submin, Subversion will be accessible from /svn. If you use Trac, it will be accessible from /trac. HTTP base? [/]> Submin will send emails for password resets and for commit message (if enabled). You can set the sender email address that Submin will use. The default might work in some places, but not all. Email from envelope? [Submin ]> 992747643@qq.com ``` 注意:设置svn目录时,设置svn库的路径,默认的是在/var/lib/svn 我设置在/opt/svn 这个目录一定要让apache有写入权限,否则就会有问题。因为http是apache用户启动的,所以需要设置为 ``` chown -R apache.apache /opt/svn ``` 2.5 生成Apache配置文件 ``` submin2-admin /usr/local/submin/ apacheconf create all ``` 建立软链接配置apache,注意Apache版本 ``` ln -fs /usr/local/submin/conf/apache-2.4-webui-cgi.conf /etc/httpd/conf.d/ ln -fs /usr/local/submin/conf/apache-2.4-svn.conf /etc/httpd/conf.d/ cat /usr/local/submin/conf/apache-svn.conf >>/etc/httpd/conf.d/subversion.conf ``` 症断submin ``` submin2-admin /usr/local/submin/ diagnostics ``` 关闭Git支持 ``` submin2-admin /usr/local/submin config set vcs_plugins svn ``` 重启服务: ``` systemctl restart httpd ``` 三、邮箱支持 Submin可以支持通过smtp来发送邮件,也可以用本地的postfix来发送。管理员邮箱在配置submin的时候我们已经设置过了。 Submin是通过/usr/lib/python2.7/site-packages/submin/email/fallback.py来发送邮件 ![](https://www.91vps.cc/usr/uploads/2017/07/2002511547.png) 首先是通过SMTP来发送,如果发送失败,则通过本地的sendmail 3.1 SMTP配置 ``` submin2-admin /opt/submin config set smtp_hostname smtp.exmail.qq.com submin2-admin /opt/submin config set smtp_port 25 submin2-admin /opt/submin config set smtp_username 992747643@qq.com submin2-admin /opt/submin config set smtp_password ***** submin2-admin /opt/submin config set smtp_from "svn <992747643@qq.com>" submin2-admin /opt/submin config set commit_email_from "svn <992747643@qq.com>" ``` 3.2 配置sendmail(可选) ``` yum install sendmail sendmail-cf -y ps aux |grep sendmail cd /etc/mail mv sendmail.cf sendmail.cf.bak m4 sendmail.mc > sendmail.cf echo "xxxxxxx" |mail -s Test 992747643@qq.com ``` ##数据迁移 备份svn存储库 ``` #压缩备份 svnadmin dump /home/workhome/svn/repository | gzip > ~/repository-backup.gz ``` 恢复svn存储库 ``` #建立新的svn存储库 svnadmin create /home/workhome/svn/newrepository ``` 最后更新于 2017-07-31 22:49:50 并被添加「」标签,已有 4726 位童鞋阅读过。 本站使用「署名 4.0 国际」创作共享协议,可自由转载、引用,但需署名作者且注明文章出处