The use of a system for version control is a huge convenience when you are managing a personal project, but a real “must” to improve teamwork. Fortunately, install the component “server” Subversion on CentOS is very easy.
Let me introduce the software object of this article with a brief anecdote.
With an increasing number of lines of code and complexity of the project, however, quickly emerged a series of difficult situations to handle:
- Load the updated material on the test server from a single machine development was impractical: often forgot something, and anyway, it was necessary to remember the names of the modified files manually;
- Likewise, distribute among colleagues the most recent listings from going to comb through folders and sub-folders was a little work-in-work;
- It happened very frequently to overwrite each other updated files on the server, wasting precious time and working hours;
- Restore an old version of the same document as a result of any test is not successful it was impossible;
The way out to untangle the skein was presented under the name of the Subversion (SVN). This is an application distributed under the GPL (open source) and then freely used for business purposes, to be installed on a machine “central”.
SVN uses a specific protocol for “dialogue” with the developers’ workstations: Once connected, the client installed on your PC automatically takes care of generating a list of all the modified files and sending them to the server, which stores them in the that, conceptually, is a “database” inside.
Similarly, other clients may require that to receive all the updated material and offer your own.
If two stations had worked on the same document, the infrastructure tries to blend into their new automatically, minimizing wasted time.
And if it becomes necessary to retrieve an old file now deleted or overwritten? No problem: the server stores it all and, thanks to the support of the comments to be inserted parallel to each transaction, locate and recover the material of interest is very simple.
Throughout this article, we illustrate how to set up a central server and the first project. Subsequently, on “Checkout, commit and update from a Windows client: operational guide to TortoiseSVN,” we will see how to interact with it via a client.
CentOS, the Internet and root access
Subversion and several clones are available for virtually any platform. Here, I’ll install on a machine with CentOS Linux distribution. For one thing, so make sure you have a computer operating system governed by this: if not, see “Quick start installation of CentOS.”
also that the computer on which you want to install Subversion is able to access the Internet, at least for the duration of the installation.
Remember that you must perform all the following with root privileges: for convenience, I highly recommend you go directly to the system with that account.
If you prefer to use your user favored, could be sufficient to run the commands sudo proposed putting the string to each of them, but I have not been able to test this scenario
Install the software itself is easy: open an instance of the terminal from Applications -> Accessories-> Terminal and issued yum install subversion-y.
Wait a while and you’re done.
Prepare the folder
You should now proceed with the creation of the parent folder that will contain all the material.
Since this process will be essential to make explicit the various clients, I strongly recommend to create the directory in question at the root (/) and use a name very short (yes, friends experienced Linux users, it is clear that you could also place the folder in a path as you like and use a symbolic link, but we are trying to simplify!).
In this example we will call /repo: to achieve it rapidly, use mkdir/repo or go to GUI via Nautilus.
At this point, we can create our project: run svnadmin create
/repo/mioprogetto1 automatically to prepare all the necessary files and subfolders of the branch to a hypothetical project called, precisely, mioprogetto1
By default, Subversion is configured to allow public read access, but restrict to registered users only writing.
If you are not champions of open source and you wish to limit the vision of the documents only to holders of valid login credentials, continue as follows.
gedit/repo/mioprogetto1/conf/svnserve.conf to open the configuration file of the project you just created and then identified (Find button) the two lines that are worded as follows:
# anon-access = read # auth-access = write
Edit them so that both align with these instructions
anon-access = none auth-access = write
Before you close and save the file, scroll down a few rows down and remove the pound
(#) from line
# password-db=passwd: a change made, you will read only
Let’s create the accounts that are enabled to access the project.
gedit/repo/mioprogetto1/conf/passwd and inserted, one below the other end of the file, the pairs of usernames and passwords in the format username = password
Save and close gedit.
Auto-Start and start the service
At this point, the software should be ready for use. Given service svnserve start to start the service. If everything is working, will be shown an encouraging OK Green.
Set the daemon so that it auto-starts with the operating system with
svnserve (or ticking the check box and clicking on svnserve then the Save button in System -> Administration -> Services)
Open the door on the firewall
Now that the service is operational, we must ensure that it is reachable!
First, we open the port on the firewall: Follow System -> Administration -> Security Level and Firewall to launch the configuration panel.
Click the Add button at the bottom right, enter 3690, press Ok and confirmed repeatedly until you close the tool
Configure the router
If the server’s Internet connection to use a router, you must also configure the same port forwarding (port forwarding) to the car in question (to trace the IP address locally, please refer to the article “Configure IP address and DNS on CentOS”).
The exact procedure varies from model to model. As for the ubiquitous Alice Gate provided on loan by Telecom Italy, there is the article “Open TCP / UDP ports on modem-router Alice Gate 2 Plus and 2 Plus Wi-Fi.” For all other devices, you should refer to the instruction booklet.
This step, of course, is only necessary if you wish to make the service accessible through the Internet: but if the server and various clients that are working are part of the same local area network (LAN), you can ensure a little ‘more security by avoiding Subversion of making visible outside.
Connect from client
At this point, everything should be 100% ready. You just have to connect from a client! The procedure has been shown in the “Checkout, commit and update from a Windows client: operational guide to TortoiseSVN.”
To automatically generate a local copy ..
Being a very flexible software, Subversion exposes many other commands and parameters arrived at this point, however, the basis for starting work in practice has been thrown into doubt.
A last step is interesting but in many cases is the generation and maintenance of a working copy on the server: I have proposed the simple steps in “Run automatically” update “each” commit “with Subversion (SVN)”