系统:openEuler20.03
1.安装SVN
[root@localhost ~]# yum install subversion -y [root@localhost ~]# svnserve --version svnserve, version 1.12.2 (r1863366) compiled Jun 9 2022, 09:19:10 on x86_64-openEuler-linux-gnu
2.创建版本库
[root@localhost ~]# mkdir -p /var/svn/project [root@localhost ~]# svnadmin create /var/svn/project
3.修改密码文件
[root@localhost ~]# cd /var/svn/project/conf/ [root@localhost conf]# ll total 20K -rw------- 1 root root 1.1K Dec 6 14:18 authz -rw------- 1 root root 885 Dec 6 14:18 hooks-env.tmpl -rw------- 1 root root 309 Dec 6 14:18 passwd -rw------- 1 root root 4.3K Dec 6 14:18 svnserve.conf [root@localhost conf]# vim passwd [users] admin = 123456 test = 123456
4.修改权限文件
/
表示根目录,/test
表示仓库目录下的子目录,rw
代表用户可以进行读写权限
[root@localhost conf]# vim authz [/] admin = rw test = rw
5.修改服务配置文件
-
anon-access
,表示匿名用户是否访问, -
auth-access
,表示授权用户可以读写, -
password-db
,表示用户密码文件, -
authz-db
,表示权限控制文件
[root@localhost conf]# vim svnserve.conf [general] anon-access = none # none/read/write auth-access = write password-db = passwd authz-db = authz
6.启动服务
[root@localhost conf]# systemctl start svnserve Failed to start svnserve.service: Unit svnserve.service not found.
报错找不到服务
7.手动配置systemctl管理SVN服务
[root@localhost ~]# vim /usr/lib/systemd/system/svnserve.service [Unit] Description=Subversion protocol daemon After=syslog.target network.target [Service] Type=forking #EnvironmentFile=/etc/sysconfig/svnserve ExecStart=/usr/bin/svnserve -d -r /var/svn [Install] WantedBy=multi-user.target
保存退出
8.启动SVN并加入开机自启
[root@localhost conf]# systemctl enable svnserve Created symlink /etc/systemd/system/multi-user.target.wants/svnserve.service → /usr/lib/systemd/system/svnserve.service. [root@localhost conf]# systemctl start svnserve [root@localhost conf]# systemctl status svnserve ● svnserve.service - Subversion protocol daemon Loaded: loaded (/usr/lib/systemd/system/svnserve.service; enabled; vendor preset: disabled) Active: active (running) since Tue 2022-12-06 14:33:03 CST; 3s ago Process: 7799 ExecStart=/usr/bin/svnserve -d -r /var/svn (code=exited, status=0/SUCCESS) Main PID: 7800 (svnserve) Tasks: 1 Memory: 1.5M CGroup: /system.slice/svnserve.service └─7800 /usr/bin/svnserve -d -r /var/svn Dec 06 14:33:03 localhost.localdomain systemd[1]: Starting Subversion protocol daemon... Dec 06 14:33:03 localhost.localdomain systemd[1]: Started Subversion protocol daemon.
9.其他机器测试SVN
[root@test2 ~]# svn co svn://192.168.137.16/project Authentication realm: <svn://192.168.137.16:3690> 6a3c7b8c-3baa-4b3a-8632-7ae0720d4f82 Password for 'root': Authentication realm: <svn://192.168.137.16:3690> 6a3c7b8c-3baa-4b3a-8632-7ae0720d4f82 Username: admin Password for 'admin': ----------------------------------------------------------------------- ATTENTION! Your password for authentication realm: <svn://192.168.137.16:3690> 6a3c7b8c-3baa-4b3a-8632-7ae0720d4f82 can only be stored to disk unencrypted! You are advised to configure your system so that Subversion can store passwords encrypted, if possible. See the documentation for details. You can avoid future appearances of this warning by setting the value of the 'store-plaintext-passwords' option to either 'yes' or 'no' in '/root/.subversion/servers'. ----------------------------------------------------------------------- Store password unencrypted (yes/no)? yes Checked out revision 0. [root@test2 ~]# ll drwxr-xr-x 3 root root 4096 Dec 5 23:58 project