Subversion (SVN) and Change Control =================================== Notes: ------ * Commands preceded with "$" imply that you should execute the command as a general user - not as root. * Commands preceded with "#" imply that you should be working as root. * Commands with more specific command lines (e.g. "rtr>" or "mysql>") imply that you are executing commands on remote equipment, or within another program. * If a command line ends with "\" this indicates that the command continues on the next line and you should treat this as a single line. Exercises Part I ================ 0. Log in to your PC. Once you are logged in you can continue with these exercises. If Subversion is not already installed: $ sudo bash (become root user) # apt-get install subversion (install subversion) 1. Create a root directory for the SVN repository: # mkdir /svn 2. Create the repository: # svnadmin create /svn/myproject 3. Create user and password # editor /svn/myproject/conf/passwd sysadm = THE_PASSWORD_FROM_CLASS 4. Configure access # editor /svn/myproject/conf/svnserve.conf Find the following lines, and remove comments in front of them. Don't leave space at the start of the lines! auth-access=write password-db=passwd Exit and save the file. 5. Start the service: # svnserve -d -r /svn/myproject 6. Go to your home directory and create a test file: # cd # editor config.txt Add some text in the file. Save and exit. 7. Import the test file in to the repository: # svn import config.txt svn://localhost/config.txt You'll be placed in an editor where you can make a comment about the file being placed in the repository. At the top of the file add some short comment, then save and exit from the file. Accept the default filename. You'll likely end up in the "joe" editor. If so, add a comment at the top of the file, then press CTRL-K-X to exit and save. You will be asked for a "root" password - just press RETURN. Next you'll need to enter the user you created in the password file, i.e: sysadm Then type in the password (from the class) Finally, you may see a warning about storing unencrypted passwords. For now say "yes" to the prompt to continue. If it all works you should see something like: Store password unencrypted (yes/no)? yes Adding config.txt Committed revision 1. 8. List the repository: # svn list svn://localhost You should just see the name of the file we have committed, or: config.txt 9. Create a local copy of the repository # cd /tmp # svn checkout svn://localhost # cd localhost The default directory name is "localhost" in this case. 10. Edit and make changes to config.txt # editor config.txt 11. Commit the changes you just made in your local repository to the master SVN repository: # svn commit Again you'll have a change to add some comments. Do this save the file and exit. You should see: Committed revision 2. That's it. You are now using subversion in a local repository: /tmp/localhost In conjunction with the master repository: /svn/myproject 12. Run a few more svn commands on the local copy of the master repository As you are in /tmp/localhost if you type: # ls -lah you'll see a hidden directory ".svn" - This is what tells the svn command that there is a repository. So, if you type: # svn list You'll get back: config.txt Try running a few more svn commands: # svn log # svn info # svn help