================================
©Copyright Sweet Potato Yao 2022-01-14
Sweet Potato Yao's Blog - CSDN Blog
1. Check if svn is installed
rpm -qa subversion
Second, yum installs the svn server (not the latest version)
Svn yum command to install directly
Direct installation is not the latest version of svn, just: version 1.7.14, the current latest version is: svn-1.14
Please see below for the latest version installation
yum -y install subversion
已安装:
subversion.x86_64 0:1.7.14-16.el7
作为依赖被安装:
apr.x86_64 0:1.4.8-7.el7 apr-util.x86_64 0:1.5.2-6.el7 subversion-libs.x86_64 0:1.7.14-16.el7
完毕!
3. Install the latest version of svn
1. Check the suitable version of the Centos system
http://opensource.wandisco.com/centos/
In case of Centos7, it is:
http://opensource.wandisco.com/centos/7/
适合的版本如下:
Name↓ Last Modified: Size: Type:
svn-1.7/ 2014-Aug-07 08:16:37 - Directory
svn-1.8/ 2014-Aug-07 08:16:37 - Directory
svn-1.9/ 2014-Aug-07 08:16:37 - Directory
svn-1.10/ 2018-Apr-25 12:31:52 - Directory
svn-1.11/ 2018-Nov-22 09:45:38 - Directory
svn-1.12/ 2019-Mar-04 09:24:57 - Directory
svn-1.13/ 2019-Dec-09 08:20:28 - Directory
svn-1.14/ 2021-Feb-24 06:00:18 - Directory
2. Add the latest version library of svn
vi /etc/yum.repos.d/wandisco-svn.repo
Added content to the wandisco-svn.repo file:
svn-1.14 is used here, which is the latest version
[WandiscoSVN]
name=Wandisco SVN Repo
baseurl=http://opensource.wandisco.com/centos/$releasever/svn-1.14/RPMS/$basearch/
enabled=1
gpgcheck=0
3. Uninstall the old version of svn
If you have an older version installed, uninstall it first
yum remove subversion
Delete execution result:
删除:
subversion.x86_64 0:1.7.14-16.el7
Next, clear the installation cache
yum clean all
4. Install the latest version of svn
yum -y install subversion
Results of the:
已安装:
subversion.x86_64 0:1.14.1-1
作为依赖被安装:
libserf.x86_64 0:1.3.9-1.el7
替代:
subversion-libs.x86_64 0:1.7.14-16.el7
5. Check the svn version
svnserve --version
Results of the:
[root@host-100 ~]# svnserve --version
svnserve,版本 1.14.1 (r1886195)
编译于 Jan 6 2022,14:30:34 在 x86_64-redhat-linux-gnu
The latest version of svn: 1.14.1
Fourth, check the svn installation location
which svnserve
Results of the:
/usr/bin/svnserve
5. Create the svn project repository directory
svnRepos is a custom directory
cd /
mkdir -p /var/svnRepos
You can also add one more layer of folders:
mkdir -p /var/svnRepos/项目名称
Six, svn project initialization
If you are not the root user, use sudo before the command
#修改目录拥有者
sudo chown -R java:java /var/svnRepos
#svn初始化
svnadmin create /var/svnRepos
Results of the:
[java@host-100 var]$ svnadmin create /var/svnRepos
[java@host-100 conf]$ cd /var/svnRepos
[java@host-100 svnRepos]$ ll
总用量 8
drwxrwxr-x. 2 java java 76 1月 7 10:17 conf
drwxrwsr-x. 6 java java 233 1月 7 10:17 db
-r--r--r--. 1 java java 2 1月 7 10:17 format
drwxrwxr-x. 2 java java 231 1月 7 10:17 hooks
drwxrwxr-x. 2 java java 41 1月 7 10:17 locks
-rw-rw-r--. 1 java java 246 1月 7 10:17 README.txt
conf folder to store configuration files
Three important files under the conf folder:
authz: authority control file
passwd: account password file
svnserve.conf: SVN service configuration file, configuration account and authority file
Seven, svn configuration user and password
Edit the passwd file:
cd /var/svnRepos/conf
vi passwd
The configuration format is: username=password
如:
[users]
# harry = harryssecret
# sally = sallyssecret
readUser=123456
appUser=123456
Eight, svn configuration permissions
Edit the authz file:
vi authz
Add users and permissions at the bottom of the file . The
format is: username = permissions
Permissions:
r: indicates read authority
w: indicates write authority
rw: indicates readable and writable authority
[/]: indicates svn root directory, [/] can be changed to a specific folder directory, restricting certain users to certain files folder read and write permissions
示例:
[/]
appUser=rw
*=
[/aa]
readUser=r
appUser=rw
*=
The last line *= indicates that other users do not have any permissions
Another configuration method is to use user grouping (not tested and verified)
[groups]
appGroup=appUser
readGroup= readUser
[/]
@appGroup=rw
@readGroup=r
*=
Nine, svn configuration service file
vi svnserve.conf
Add the following configuration under [general] (you can also open the corresponding option on the configuration, but the space after the # should be deleted):
#在[general]模块最下面增加的内容
#匿名访问的权限,可以是read,write,none,设置为none表示不能读写
anon-access=none
#授权用户可写
auth-access=write
#密码数据库配置
password-db=passwd
#访问控制数据库配置
authz-db=authz
#存储库的身份验证域。
#如果两个存储库具有相同的身份验证域,则它们应该
#拥有相同的密码数据库,反之亦然。默认领域是存储库的uuid。
#此处填写路径,这样就不会有相同的
#就是连接时提示的名称,如/var/svnRepos可修改为:我的svn仓库
realm=/var/svnRepos
#强制用户名大小写,默认是否
#lower,则全部变成小写;upper则全部变成大写;none则比较大小写。
# force-username-case = none
Ten, svn start
Check if svn is started:
ps -ef | grep svnserve
Start svn (port defaults to 3690)
svnserve -d -r /var/svnRepos
Modify the port to start:
svnserve -d -r /var/svnRepos --listen-port=9369
Specify the configuration file to start:
svnserve -d -r /var/svnRepos --listen-port=9369 --config-file=/var/svnRepos/conf/svnserve.conf
-d: indicates the daemon
-r: svn root directory
--listen-port=9369: specifies the port
--config-file: specifies the configuration file
View svn process
ps -ef | grep svnserve
kill svn process
kill -9 [pid]
11. Open the svn firewall port
svn defaults to port 3690
to open the telnet service:
firewall-cmd --permanent --add-service=telnet
Open ports:
默认的端口
firewall-cmd --permanent --zone=public --add-port=3690/tcp
自定义的端口
firewall-cmd --permanent --zone=public --add-port=9369/tcp
Make the port valid:
firewall-cmd --reload
View all open ports on the firewall
firewall-cmd --zone=public --list-ports
Other commands:
查看防火墙状态:
firewall-cmd --state
关闭防火墙
systemctl stop firewalld.service
禁止防火墙开机启动
systemctl disable firewalld.service
Twelve, svn settings boot start
Add svnserve.service configuration file
vi /lib/systemd/system/svnserve.service
File additions:
[Unit]
Description=SVN Server service
After=network.target
[Service]
Type=forking
ExecStart= /usr/bin/svnserve -d -r /var/svnRepos --listen-port=9369 --config-file=/var/svnRepos/conf/svnserve.conf
Restart=on-abort
[Install]
WantedBy=multi-user.target
set startup
systemctl enable svnserve.service
Results of the:
[java@host-100 system]$ sudo systemctl enable svnserve.service
Created symlink from /etc/systemd/system/multi-user.target.wants/svnserve.service to /usr/lib/systemd/system/svnserve.service.
other commands
启动svn
systemctl start svnserve.service
停止svn
systemctl stop svnserve.service
重启svn
systemctl restart svnserve.service
13. Solution for insufficient permissions when svn starts
Check the svn service status:
systemctl status svnserve.service
svnserve[166290]: svnserve: E000013: cannot open file "/var/svnRepos/conf/svns... not enough
[root@host-100 /]# systemctl status svnserve.service
● svnserve.service - SVN Server service
Loaded: loaded (/usr/lib/systemd/system/svnserve.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since 五 2022-01-07 11:07:11 CST; 11s ago
Process: 166290 ExecStart=/usr/bin/svnserve -d -r /var/svnRepos --listen-port=9369 --config-file=/var/svnRepos/conf/svnserve.conf (code=exited, status=1/FAILURE)
1月 07 11:07:11 host-100 systemd[1]: Starting SVN Server service...
1月 07 11:07:11 host-100 svnserve[166290]: svnserve: E000013: 不能打开文件“/var/svnRepos/conf/svns…限不够
1月 07 11:07:11 host-100 systemd[1]: svnserve.service: control process exited, code=exited status=1
1月 07 11:07:11 host-100 systemd[1]: Failed to start SVN Server service.
1月 07 11:07:11 host-100 systemd[1]: Unit svnserve.service entered failed state.
1月 07 11:07:11 host-100 systemd[1]: svnserve.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
svn startup permission is not enough solution
The file /etc/selinux/config must first add writable permissions
chmod -v u+w /etc/selinux/config
Edit file:
vi /etc/selinux/config
Modification (requires server restart)
SELINUX=enforcing
for:
SELINUX=disabled
Take back the writable permission of the file /etc/selinux/config
chmod -v u-w /etc/selinux/config
chmod -R 777 svnserve.conf
restart the server
reboot -f
Fourteen, svn client tortoisesvn download and svn checkout
download windows svn client
tortoisesvn download address
https://tortoisesvn.net/downloads.html
The download address is a little bit below, there is a Chinese language installation package
After the installation is complete, create a new folder, in the folder, right-click the mouse, and there is a command [SVN Checkout] to check out the project.
Enter the svn address:
The port defaults to 3690, I changed it to 9369, remember to change it to your own port
svn://ip地址:端口
示例:
svn://192.168.1.10:9369/
15. Eclise svn subclipse plugin download and installation
Eclise svn plugin subclipse requirements:
Requirements - current master
Eclipse 4.2 (Juno) or later
Java 8 or later
Subversion 1.10 - 1.14 JavaHL client libraries
Subclipse download address:
https://github.com/subclipse/subclipse/releases
Description address:
https://github.com/subclipse/subclipse/wiki
Only download subclipse-4.3.3.zip and install without JavaHL, it will report an error, it is recommended to install online, or download and install both together.
(Time is precious, sharing is not easy, donate and give back, ^_^)
================================
©Copyright Sweet Potato Yao 2022-01-14