Build SVN Server (SVN Server) under Ubuntu

One: build the environment
View the version information of the Ubuntu system: use the cat /proc/version command, the uname -a command and the sb_release -a command.
Ubuntu:14.04 64位
SVN: Install via apt-get
Two: building steps
1. Uninstall svn
Use the following command to check whether your system has svn installed:
svn
The above shows that it is not installed. If the message shows that it is installed, you can use the following command to uninstall:
sudo apt-get remove --purge subversion
(--purge option means to completely delete the software and related files)
2. Install svn
It is recommended to update z before installation, and then install:
apt-get update
apt-get install subversion
The image above shows that the installation was successful.
You can verify it with the following command:
svn help //--svn help
svn --version //--svn version
svnserve --version //--svn server version
3. Create SVN repository
a: Create the project directory and svn repository:
mkdir  /home/svn
mkdir  /home/svn/repository
chmod -R 777 /home/svn/repository
svnadmin create /home/svn/repository
After executing the command, the following files will be generated under the repository:
Set permissions on db:
chmod -R 777 db
Note:
If the above command is not executed, the following error will be reported:
This is because we use sudo permissions to do the operations. By default, only the root user has write permission to the folder, because the umask of root is 0022, and other users do not have write permission.
b: Set access rights:
Modify the configuration file conf/svnserve.conf
vim /home/svn/repository/conf/svnserve.conf
Note:
1. All lines must be in the top frame, otherwise an error will be reported.
c: Add access user:
vim /home/svn/repository/conf/passwd 
d: Set user permissions:
vim /home/svn/repository/conf/authz
To explain the above:
admin = wang //User Wang belongs to the admin permission group
@admin = rw //The permissions of the admin permission group are read and write
* = r all groups have read permission
 
Three: Test the SVN server
A: Start the server
svnserve -d -r /home/svn [--listen-host 192.168.1.16]
Note:
-d: means run in the background
-r: Specifies the root directory of the server
In this way, when accessing the server, you can directly use "svn://server ip/repository" to access it.
If the server has multiple ips, --listen-host specifies the listening ip address.
We can access the svn server through svn://192.168.1.16 in the svn client
You can check whether svnserve is running with the following command:
ps to | grep svnserve
You can see that the svn server is already running in the background.
B: Stop the server
killall svnserve
ps to | grep svnserve
You can see that the svn server has been shut down.
 
Four: Access the SVN server
The SVN server can be accessed through the TortoiseSVN client:
Create a new folder locally, enter the folder, and use TortoeseSVN to access the previously created SVN server repository.
After entering the svn repository, you can try to commit a folder:
After clicking OK or OK, you will be prompted to enter your svn username and password:
That's it.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326485407&siteId=291194637