centos7搭建svn服務器及客戶端設置

centos7貌似預裝了svn服務(有待確認),所以咱們直接啓動該服務便可mysql

1、svn服務端配置(服務器IP假設爲192.168.100.1)linux

步驟1:建立存放代碼庫目錄sql

mkdir -p /var/svn

步驟2:啓動svn服務apache

svnserve -d -r /var/svn

步驟3:建立代碼庫somethingcentos

[root@model ~]# cd /var/svn
[root@model svn]#  
[root@model svn]# 
[root@model svn]# svnadmin create something
[root@model svn]# 
[root@model svn]# 
[root@model svn]# cd something
[root@model something]# 
[root@model something]# 
[root@model something]# ls
conf  db  format  hooks  locks  README.txt
[root@model something]# 
[root@model something]# 
[root@model something]# cd conf
[root@model conf]# 
[root@model conf]# 
[root@model conf]# ls
authz  passwd  svnserve.conf
[root@model conf]# 
[root@model conf]# 

步驟4:配置svnserve.conf文件tomcat

[root@model conf]# 
[root@model conf]# vi svnserve.conf
### This file controls the configuration of the svnserve daemon, if you
### use it to allow access to this repository.  (If you only allow
### access through http: and/or file: URLs, then this file is
### irrelevant.)

### Visit http://subversion.apache.org/ for more information.

[general]
### The anon-access and auth-access options control access to the
### repository for unauthenticated (a.k.a. anonymous) users and
### authenticated users, respectively.
### Valid values are "write", "read", and "none".
### Setting the value to "none" prohibits both reading and writing;
### "read" allows read-only access, and "write" allows complete
### read/write access to the repository.
### The sample settings below are the defaults and specify that anonymous
### users have read-only access to the repository, while authenticated
### users have read and write access to the repository.
# anon-access = read
# auth-access = write

anon-access = none
auth-access = write

### The password-db option controls the location of the password
### database file.  Unless you specify a path starting with a /,
### the file's location is relative to the directory containing
### this configuration file.
### If SASL is enabled (see below), this file will NOT be used.
### Uncomment the line below to use the default password file.
# password-db = passwd

password-db = passwd

### The authz-db option controls the location of the authorization
### rules for path-based access control.  Unless you specify a path
### starting with a /, the file's location is relative to the the
### directory containing this file.  If you don't specify an
### authz-db, no path-based access control is done.
### Uncomment the line below to use the default authorization file.
# authz-db = authz

authz-db = authz

### This option specifies the authentication realm of the repository.
### If two repositories have the same authentication realm, they should
### have the same password database, and vice versa.  The default realm
### is repository's uuid.
# realm = My First Repository

#此選項指定的庫的認證領域
raalm = /var/svn/something
### The force
-username-case option causes svnserve to case-normalize ### usernames before comparing them against the authorization rules in the ### authz-db file configured above. Valid values are "upper" (to upper- ### case the usernames), "lower" (to lowercase the usernames), and ### "none" (to compare usernames as-is without case conversion, which ### is the default behavior). # force-username-case = none [sasl] ### This option specifies whether you want to use the Cyrus SASL ### library for authentication. Default is false. ### This section will be ignored if svnserve is not built with Cyrus ### SASL support; to check, run 'svnserve --version' and look for a line ### reading 'Cyrus SASL authentication is available.' # use-sasl = true ### These options specify the desired strength of the security layer ### that you want SASL to provide. 0 means no encryption, 1 means ### integrity-checking only, values larger than 1 are correlated "svnserve.conf" 71L, 3173C written

步驟5:配置passwd文件服務器

[root@model conf]# vi passwd
### This file is an example password file for svnserve.
### Its format is similar to that of svnserve.conf. As shown in the
### example below it contains one section labelled [users].
### The name and password for each user follow, one account per line.

[users]
# harry = harryssecret
# sally = sallyssecret

user = 123456

~
~
"passwd" 11L, 326C written

步驟6:配置authz文件less

[root@model conf]# 
[root@model conf]# vi authz
### This file is an example authorization file for svnserve.
### Its format is identical to that of mod_authz_svn authorization
### files.
### As shown below each section defines authorizations for the path and
### (optional) repository specified by the section name.
### The authorizations follow. An authorization line can refer to:
###  - a single user,
###  - a group of users defined in a special [groups] section,
###  - an alias defined in a special [aliases] section,
###  - all authenticated users, using the '$authenticated' token,
###  - only anonymous users, using the '$anonymous' token,
###  - anyone, using the '*' wildcard.
###
### A match can be inverted by prefixing the rule with '~'. Rules can
### grant read ('r') access, read-write ('rw') access, or no access
### ('').

[aliases]
# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average

[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe

admin = user
# [
/foo/bar] # harry = rw # &joe = r # * =

[/]
user = rw
# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r

[something:/]
@admin = rw
~ ~ ~ ~ ~ ~ "authz" 35L, 1093C written

此處的意思是用戶usr_0對目錄[/](代碼庫something的根目錄)下的全部文件,具備讀(r)和寫(w)的權限maven

步驟7:關閉防火牆及防火牆開機自啓動ide

systemctl stop firewalld.service
systemctl disable firewalld.service

至此,svn服務端配置完畢

2、svn客戶端配置(客戶端IP假設爲192.168.100.2)

步驟1:關閉防火牆

[root@localhost svn]# 
[root@localhost svn]# systemctl stop firewalld.service
[root@localhost svn]# 
[root@localhost svn]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
[root@localhost svn]# 

步驟2:建立客戶端svn上提取文件存放目錄

[root@localhost /]# 
[root@localhost /]# mkdir /svn
[root@localhost /]# 
[root@localhost /]# 

步驟3:登陸svn服務器並檢出something庫中的文件

[root@localhost svn]# 
[root@localhost svn]# 
[root@localhost svn]# svn co --username user --password 123456 svn://192.168.100.1/something

-----------------------------------------------------------------------
注意!  你的密碼,對於認證域:

   <svn://192.168.100.1:3690> /var/svn/something

只能明文保存在磁盤上!  若是可能的話,請考慮配置你的系統,讓 Subversion
能夠保存加密後的密碼。請參閱文檔以得到詳細信息。

你能夠經過在「/root/.subversion/servers」中設置選項「store-plaintext-passwords」爲「yes」或「no」,
來避免再次出現此警告。
-----------------------------------------------------------------------
保存未加密的密碼(yes/no)?n
A    something/package
A    something/package/apache-maven-3.5.0-bin.tar.gz
A    something/package/mysql-5.6.37-linux-glibc2.12-x86_64.tar.gz
A    something/package/jdk-8u141-linux-x64.gz
A    something/package/apache-tomcat-7.0.79.tar.gz
取出版本 6。
[root@localhost svn]# 
[root@localhost svn]# ls
something
[root@localhost svn]# 
[root@localhost svn]# 

更新svn版本庫

[root@localhost package]# 
[root@localhost package]# 
[root@localhost package]# svn up /svn/something
正在升級 '/svn/something':
認證領域: <svn://192.168.100.1:3690> /var/svn/something
「user」的密碼: 

-----------------------------------------------------------------------
注意!  你的密碼,對於認證域:

   <svn://192.168.100.1:3690> /var/svn/something

只能明文保存在磁盤上!  若是可能的話,請考慮配置你的系統,讓 Subversion
能夠保存加密後的密碼。請參閱文檔以得到詳細信息。

你能夠經過在「/root/.subversion/servers」中設置選項「store-plaintext-passwords」爲「yes」或「no」,
來避免再次出現此警告。
-----------------------------------------------------------------------
保存未加密的密碼(yes/no)?n
D    jenkins.war
更新到版本 7。
[root@localhost package]# 
[root@localhost package]# 
[root@localhost package]# 
相關文章
相關標籤/搜索