1. SVN client access
1. Software installation and directory creation
Check if the system is installed
rpm -qa subversion
If not installed directly
yum -y install subversion
Check the installed version
svnserve –version
Create a directory:
mkdir -p /home/data/svn/svnrepos
ln -s / home / data / svn / var / svn
Close selinux
vim /etc/selinux/config
SELINUX=disabled
2. Create a new project to create a project library
svnadmin create /var/svn/svnrepos
svnadmin create /var/svn/code
3. Copy and edit configuration files
mkdir -p /var/svn/conf
cd / var / svn / conf
cp ../conf/svnrepos/authz ../conf/svnrepos/passwd ./
Edit the general permission table
vi authz #Permission table
[groups]
admin = administrator
users = test
[/] #[/] indicates the root directory of the warehouse, add a directory to it
@admin = rw #@admin means user group
@users = r
* =
[code:/]
@admin = rw
@users = r
#R stands for readable
#W stands for writable
Edit password table
vi passwd
[users]
#Format username = password
Administrator = 123456
test = 123456
Edit project configuration file
vi /var/svn/svnrepos/conf/svnserve.conf
auth-access = write #Authorized users can write
password-db = /home/data/svn/conf/passwd
authz-db = /home/data/svn/conf/authz
realm = /home/data/svn/svnrepos #The path where the authorized project is located
The code warehouse configuration is the same as above, just modify the authorization path to the corresponding path.
4. Add self-start
cd /etc/init.d/
I came svnd
#!/bin/sh
# chkconfig: 2345 10 90
# description: svn server
SVN_HOME=/var/svn
if [ ! -f "/usr/bin/svnserve" ]
then
echo "svnserver startup: cannot start"
exit
be
case "$1" in
start)
echo "Starting svnserve…"
/usr/bin/svnserve -d --listen-port 3690 -r $SVN_HOME
echo "Finished!"
;;
stop)
echo "Stoping svnserve…"
killall svnserve
echo "Finished!"
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: svn { start | stop | restart } "
exit 1
esac
chmod u+x svnd
chkconfig --add svnd
5. Turn on firewall permissions
firewall-cmd --zone=public --add-port=3690/tcp --permanent
firewall-cmd --reload
Client access address svn://10.26.1.251:3690/svnrepos
2. Add http access:
1. Install apache and modules
yum install subversion httpd mod_dav_svn
2. Create a configuration file:
vim /etc/httpd/conf.d/subversion.conf
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
<Location />
DAV svn
SVNParentPath /home/data/svn
AuthType Basic
AuthName "Authorization Realm"
AuthUserFile /home/data/svn/conf/httppasswd
AuthzSVNAccessFile /home/data/svn/conf/authz
Require valid-user
</Location>
If you create a new library, directly use svnadmin create /var/svn/xxx to add the directory and then give the corresponding permissions in the same operation as in the above steps
chown -R apache:apache /var/svn/code
chown -R apache:apache /var/svn/svnrepos
3. Add http access user
Initially add users
htpasswd -bc /var/svn/conf/httppasswd admin 123456
Create a new user or modify an existing user password in the original password file
htpasswd -b /var/svn/conf/httppasswd test 123456
delete users
htpasswd -D /var/svn/conf/httppasswd test
4. Start apache and add self-start
systemctl enable httpd
systemctl start httpd
5. Turn on the firewall
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload
Visit: http://10.26.1.251//svn/project
Three, install the svnmanager management tool
- Install php and necessary packages
yum groupinstall "PHP Support"
yum install php-mysql php-mbstring
# Install VersionControl_SVN
/usr/bin/pear install -f –alldeps VersionControl_SVN
- Modify the permissions of the svn parent directory to allow apache to have control permissions on all svn directories and conf configuration file directories
chown -R apache.apache /home/data/svn
- Unzip svnmanager
yum install unzip
unzip svnmanager-1.10.zip -d / var / www / html
cd / var / www / html
mv svnmanager-1.10 svnmanager && chown -R apache.apache svnmanager
- Configure apache
vim /etc/httpd/conf/httpd.conf
#Add page directory
<Directory "/var/www/html/svnmanage">
AllowOverride None
Order deny,allow
Deny from all
Allow from all
</Directory>
- Install mariadb and configuration
yum install mariadb-server
systemctl start mariadb
systemctl enable mariadb
initialization
mysql_secure_installation
Log in and create a database
mysql -uroot -p
> create database svnmanager;
> grant all privileges on svnmanager.* to svnadmin@localhost identified by 'newpassword';
> flush privileges;
> quit;
- Edit configuration file
# language setting
$lang = "en_US.UTF-8";
# Set the location of the binary file
//Shell command's
$htpassword_cmd = "/usr/bin/htpasswd";
$svn_cmd = "/usr/bin/svn";
$svnadmin_cmd = "/usr/bin/svnadmin";
# Set Svn configuration file directory, Svn parent directory, Svn http authentication file, permission control file
//Subversion locations
$svn_config_dir = "/var/svn/svnconf";
$svn_repos_loc = "/var/svn/svnrepos";
$svn_passwd_file = "/var/svn/htpasswd";
$svn_access_file = "/var/svn/accessfile";
# Set the location of the svn protocol password file
$svnserve_user_file="";
# Set up mysql data connection
$dsn = "mysqli://svnadmin:newpassword@localhost/svnmanager";
Note: The data file will be created automatically when you enter it for the first time and the page will be displayed normally after refresh
You need to re-create the administrator account password, otherwise you cannot use it after logging out
Error resolution:
VersionControl_SVN_Exception: "svn_path" is not a valid option
The solution is to edit the /var/www/html/svnmanager/svnmanager/RepositoryModule directory
UserPrivilegesEditPage.php and GroupPrivilegesEditPage.php files:
$options = array('fetchmode' => VERSIONCONTROL_SVN_FETCHMODE_ARRAY, 'svn_path' => $svn_cmd);
Change to:
$options = array('fetchmode' => VERSIONCONTROL_SVN_FETCHMODE_ARRAY);