Article directory
- Preface
- 1. Install SVN service on Ubuntu
- 2. Modify configuration file
-
- 2.1 Modify the svnserve.conf file
- 2.2 Modify passwd file
- 2.3 Modify authz file
- 3. Start the svn service
- 4. Intranet penetration
-
- 4.1 Install cpolar intranet penetration
- 4.2 Create tunnel mapping local port
- 5. Test public network access
- 6. Configure a fixed public network TCP port address
-
- 6.1 Reserve a fixed public network TCP port address
- 6.2 Configure a fixed public network TCP port address
- 7. Use fixed TCP port address for remote SVN service
Foreword
As there are more and more documents, storing all the information on your own computer can be confusing and not conducive to sharing. In this case, consider uploading the data to SVN for unified management, so that other people can easily check various data.
When SVN is installed in a local area network, remote access to the database or code will be restricted. In order to access the intranet SVN database from the public network, [cpolar] (blog – cpolar Jiidian Cloud) can solve this problem very well. Requirements: cpolar is a tool that can expose intranet services to the public network for access.
SVN is divided into server and client. The server is mainly used for data storage. The client is mainly a graphical tool to connect to the server to obtain server data. The following describes how to install the server on the Ubuntu system and access it remotely through the client.
1. Install SVN service on Ubuntu
Enter the installation command on the command line:
sudo apt install subversion
Check the svn version. If the version information appears, the installation is successful:
svnserve --version
Create a repository and execute the following series of commands
cd /opt sudo mkdir svn cdsvn sudo mkdir repository
After creation, enter the following command to create the warehouse
sudo svnadmin create /opt/svn/repository
After successful creation, we will find a series of files in the repository directory, including:
- The conf folder contains configuration files, including SVN username permissions and passwords;
- The db contains different versions of the documents, codes and other data we uploaded to the SVN server.
What needs to be noted here is to release permissions on the db folder, otherwise the client may not be able to connect to the SVN server.
Enter the following command to release permissions on the db folder. After the release is successful, the db folder will turn green.
sudo chmod -R 777 db
2. Modify configuration file
First modify the files in the conf folder under the repository file
2.1 Modify the svnserve.conf file
This file mainly sets our SVN access method. Enter the editing command:
sudo vim svnserve.conf
Press the i
key to enter editing
Unlock the # comments of the four parameters
Then press the Esc key
to exit editing, enter :wq
to save and exit.
2.2 Modify passwd file
This file is mainly to add the user name and password, enter the command to edit:
sudo vim passwd
Press i
to edit
Add the following information, the account password can be customized!
After adding, press Esc key to exit, enter :wq
to save and exit.
2.3 Modify authz file
This file is mainly for permission management of logged-in users. Enter the following command to edit:
sudo vim authz
Press i
to edit
Add the following information
Then Esc key
to exit editing, enter :wq
to save and exit.
3. Start svn service
Enter the following command to start svn
sudo svnserve -d -r /opt/svn/
4. Intranet penetration
Above we installed the svn server on the local Ubuntu virtual machine, but currently it can only be accessed under the LAN. If you leave the LAN, you will not be able to connect to svn. However, we can use cpolar to achieve public network access, breaking through the limitations of the LAN, without requiring a public network IP or setting up a router.
cpolar official website: https://www.cpolar.com/
4.1 Install cpolar intranet penetration
- Supports one-click script installation command
curl -L https://www.cpolar.com/static/downloads/install-release-cpolar.sh | sudo bash
- token authentication
Log in to the cpolar official website backend, click Verify on the left to view your authentication token, and then paste the token into the command line:
cpolar authtoken xxxxxxx
- Add services to the system
sudo systemctl enable cpolar
- Start cpolar service
sudo systemctl start cpolar
4.2 Create tunnel mapping local port
After successfully starting the cpolar service, we access the local 9200 port [http://127.0.0.1:9200] on the browser and log in to the cpolar web UI management interface.
After successfully logging in, click Tunnel Management – Create Tunnel on the left dashboard to create a TCP protocol tunnel pointing to the local port 3690:
- Tunnel name: It can be customized. Be careful not to duplicate the existing tunnel name.
- Protocol: tcp
- Local address: 3690
- Domain name type: Choose a random domain name for free
- Region: Select China VIP
Click Create
After the tunnel is successfully created, click Status on the left – Online Tunnel List. You can see that the tunnel just created has generated a corresponding public network address. Copy it.
5. Test public network access
Official website to download the svn client: https://tortoisesvn.net/downloads.html
After SVN is installed, right-click on the desktop, click svncheckout, enter the cpolar public network address we copied, and then click ok
Enter the account password we created earlier
Then right click, then svn update will appear, click it, if no error appears, the connection is successful.
6. Configure a fixed public network TCP port address
Since the tunnel created using cpolar above uses a random public network address, this address is a random temporary address and will change within 24 hours, which is not conducive to long-term remote access.
For better connection, we can configure a second-level subdomain name for it. This address is a fixed address and will not change randomly.
It should be noted that configuring a fixed TCP port address requires upgrading cpolar to the Professional Edition package or above. [cpolar supports 21-day money back guarantee]
6.1 Reserve a fixed public network TCP port address
Log in to the cpolar official website, click Reserve on the left, and select the reserved TCP address. Let’s first reserve a fixed port address for the remote SVN.
- Region: Select China VIP
- Description: Notes, which can be customized
Click Keep
After the address is successfully reserved, the system will generate the corresponding fixed public address and copy it.
6.2 Configure a fixed public network TCP port address
Access port 9200 on the browser, http://127.0.0.1:9200/, log in to the cpolar web ui management interface, click Tunnel Management – Tunnel List on the left dashboard, find the svn tunnel, and click Edit on the right
Modify the tunnel information and configure the successfully reserved fixed tcp address into the tunnel.
- Port type: modified to fixed tcp port
- Reserved tcp address: fill in the successfully reserved address
Click Update
After the tunnel is successfully updated, click the status on the left dashboard – Online Tunnel List, find the Minecraft Tunnel, and you can see that the public network address has been updated to a fixed TCP address.
7. Use fixed TCP port address for remote SVN service
Right click to open relocate
Modify the connection address to a fixed tcp address. Click OK after modification.
Then right-click svn update and click. If no error occurs, the connection is successful.
Reprinted from cpolar pole cloud article: Linux builds SVN server and penetrates the intranet to achieve remote access to the public network