Linux安装svn
1. 下载
- 历史版本
- apr历史版本:https://archive.apache.org/dist/apr/
- sqlite历史版本:https://www.sqlite.org/cgi/src/taglist
下载参考:https://blog.csdn.net/hylaking/article/details/78262329
- zlib历史版本:http://www.zlib.net/fossils/
- subversion历史版本:https://archive.apache.org/dist/subversion/
- 具体下载版本
- apr-1.7.0.tar.gz: https://archive.apache.org/dist/apr/apr-1.7.0.tar.gz
- apr-util-1.6.1.tar.gz: https://archive.apache.org/dist/apr/apr-util-1.6.1.tar.gz
- sqlite-autoconf-3330000.tar.gz:http://www.sqlite.org/2020/sqlite-autoconf-3330000.tar.gz
- zlib-1.2.11.tar.xz:http://www.zlib.net/fossils/zlib-1.2.11.tar.gz
- subversion-1.14.0.tar.gz: http://subversion.apache.org/download/
2. 上传之后解压
- tar -zxvf /opt/svn/apr-1.7.0.tar.gz -C /opt/svn
- tar -zxvf /opt/svn/apr-util-1.6.1.tar.gz -C /opt/svn
- tar -zxvf /opt/svn/zlib-1.2.11.tar.gz -C /opt/svn
- tar -zxvf /opt/svn/subversion-1.14.0.tar.gz -C /opt/svn
- tar -zxvf /opt/svn/sqlite-autoconf-3330000.tar.gz -C /opt/svn
3. 安装
- 安装apr
cd /opt/svn/apr-1.7.0
./configure --prefix=/opt/svn/apr-1.7.0
make && make install
可能报错:configure: error: no acceptable C compiler found in $PATH
解决,运行命令:sudo yum install gcc-c++
执行yum命令,centos8再报错
Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
解决
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
yum clean all && yum makecache
如果报错
错误:为 repo 'appstream' 下载元数据失败 : Cannot prepare internal mirrorlist: No URLs in mirrorlist
运行命令:mv /etc/yum.repos.d/CentOS-Linux-AppStream.repo /etc/yum.repos.d/CentOS-Linux-AppStream.repo.bak
再运行:yum clean all && yum makecache
如果报错
错误:为 repo 'baseos' 下载元数据失败 : Cannot prepare internal mirrorlist: No URLs in mirrorlist
运行命令:mv /etc/yum.repos.d/CentOS-Linux-BaseOS.repo /etc/yum.repos.d/CentOS-Linux-BaseOS.repo.bak
再运行:yum clean all && yum makecache
再执行:sudo yum install gcc-c++
- 安装apr-util
cd /opt/svn/apr-util-1.6.1
./configure --prefix=/opt/svn/apr-util-1.6.1 --with-apr=/opt/svn/apr-1.7.0
make
编译报错:xml/apr_xml.c:35:19: 致命错误:expat.h:没有那个文件或目录
解决运行命令:yum install -y expat-devel
https://blog.csdn.net/weixin_43930641/article/details/105269092
make && make install
- 安装zlib
cd /opt/svn/zlib-1.2.11
./configure --prefix=/opt/svn/zlib-1.2.11
make && make install
- 移动sqlite到subversion安装目录里面
mv /opt/svn/sqlite-autoconf-3330000 /opt/svn/subversion-1.14.0/sqlite-amalgamation
- 安装subversion
cd /opt/svn/subversion-1.14.0
./configure --prefix=/opt/svn/subversion-1.14.0 --with-apr=/opt/svn/apr-1.7.0 --with-apr-util=/opt/svn/apr-util-1.6.1 --with-zlib=/opt/svn/zlib-1.2.11 --with-lz4=internal --with-utf8proc=internal
make && make install
4. 添加环境变量
- /etc/profile文件添加export PATH=$PATH:/opt/svn/subversion-1.14.0/bin
- 重新加载资源:source /etc/profile
- 查看是否安装svn成功:svnserve --version
具体命令
vim /etc/profile
export PATH=$PATH:/opt/svn/subversion-1.14.0/bin
source /etc/profile
svnserve --version
5. 配置svn
- 创建svn版本库目录
svnadmin create /opt/svn/myproject
- 修改版本库配置文件svnserve.conf
vim /opt/svn/myproject/conf/svnserve.conf
修改
# 使非授权用户无法访问
anon-access = read
# 使授权用户有写权限
auth-access = write
# 指明密码文件路径
password-db = passwd
# 访问控制文件
authz-db = authz
- 修改passwd文件
vim /opt/svn/myproject/conf/passwd
设置用户密码
[users]
lw = Lw2022
test = Ts2022
- 修改authz文件
vim /opt/svn/myproject/conf/authz
设置权限
[groups]
lwg = lw,test
[/]
@lwg = rw
6. 启动svn
svnserve -d -r /opt/svn/myproject --listen-port 3690
7. 查看是否启动
- 第一种查看端口:netstat -nlp | grep 3690
- 第二种查看应用启动:ps -ef | grep svn
8. 检查端口是否开放
- 防火墙,如果没有启动就不用处理
查看防火墙:systemctl status firewalld
firewall-cmd --add-port=3690/tcp --permanent
- 如果是云服务器,需要开放端口
阿里云服务器开放端口
9. 登陆
svn://8.130.104.71:3690
10. 命令汇总
#!/bin/bash
tar -zxvf /opt/svn/apr-1.7.0.tar.gz -C /opt/svn
tar -zxvf /opt/svn/apr-util-1.6.1.tar.gz -C /opt/svn
tar -zxvf /opt/svn/zlib-1.2.11.tar.gz -C /opt/svn
tar -zxvf /opt/svn/subversion-1.14.0.tar.gz -C /opt/svn
tar -zxvf /opt/svn/sqlite-autoconf-3330000.tar.gz -C /opt/svn
cd /opt/svn/apr-1.7.0
./configure --prefix=/opt/svn/apr-1.7.0
make && make install
sudo yum install gcc-c++
cd /opt/svn/apr-util-1.6.1
./configure --prefix=/opt/svn/apr-util-1.6.1 --with-apr=/opt/svn/apr-1.7.0
make
yum install -y expat-devel
make && make install
cd /opt/svn/zlib-1.2.11
./configure --prefix=/opt/svn/zlib-1.2.11
make && make install
mv /opt/svn/sqlite-autoconf-3330000 /opt/svn/subversion-1.14.0/sqlite-amalgamation
cd /opt/svn/subversion-1.14.0
./configure --prefix=/opt/svn/subversion-1.14.0 --with-apr=/opt/svn/apr-1.7.0 --with-apr-util=/opt/svn/apr-util-1.6.1 --with-zlib=/opt/svn/zlib-1.2.11 --with-lz4=internal --with-utf8proc=internal
make && make install
11. 参考文章
文章来源1:https://blog.csdn.net/Saint_EK/article/details/108039254
参考文章1:https://www.cnblogs.com/code4app/p/7202039.html
参考文章2:https://www.runoob.com/svn/svn-start-mode.html