| 1 | Subversion (SVN) and Change Control Exercises |
|---|
| 2 | |
|---|
| 3 | Notes: |
|---|
| 4 | ------ |
|---|
| 5 | * Commands preceded with "$" imply that you should execute the command as |
|---|
| 6 | a general user - not as root. |
|---|
| 7 | * Commands preceded with "#" imply that you should be working as root. |
|---|
| 8 | * Commands with more specific command lines (e.g. "RTR-GW>" or "mysql>") |
|---|
| 9 | imply that you are executing commands on remote equipment, or within |
|---|
| 10 | another program. |
|---|
| 11 | |
|---|
| 12 | Exercises |
|---|
| 13 | --------- |
|---|
| 14 | |
|---|
| 15 | Exercises Part I |
|---|
| 16 | ---------------- |
|---|
| 17 | |
|---|
| 18 | 0. Log in to your PC or open a terminal window as the root user. |
|---|
| 19 | |
|---|
| 20 | Once you are logged in you can continue with these exercises. |
|---|
| 21 | If Subversion is not already installed: |
|---|
| 22 | |
|---|
| 23 | $ apt-get install subversion |
|---|
| 24 | |
|---|
| 25 | 1. Create a root directory for the SVN repository: |
|---|
| 26 | |
|---|
| 27 | # mkdir /svn |
|---|
| 28 | |
|---|
| 29 | 2. Create the repository: |
|---|
| 30 | |
|---|
| 31 | # svnadmin create /svn/arocarchive |
|---|
| 32 | |
|---|
| 33 | 3. Create user and password |
|---|
| 34 | |
|---|
| 35 | # editor /svn/arocarchive/conf/passwd |
|---|
| 36 | aroc = YourPassword |
|---|
| 37 | |
|---|
| 38 | 4. Configure access |
|---|
| 39 | |
|---|
| 40 | # editor /svn/arocarchive/conf/svnserve.conf |
|---|
| 41 | |
|---|
| 42 | Remove comments and don't leave space at the start of the lines: |
|---|
| 43 | |
|---|
| 44 | auth-access=write |
|---|
| 45 | password-db=passwd |
|---|
| 46 | |
|---|
| 47 | 5. Start the service: |
|---|
| 48 | |
|---|
| 49 | # svnserve -d -r /svn/arocarchive |
|---|
| 50 | |
|---|
| 51 | 6. Go to your home directory and create a test file: |
|---|
| 52 | |
|---|
| 53 | # cd |
|---|
| 54 | # editor config.txt |
|---|
| 55 | |
|---|
| 56 | Maybe type some text in the file. Save and exit. |
|---|
| 57 | |
|---|
| 58 | 7. Import the test file in to the repository: |
|---|
| 59 | |
|---|
| 60 | # svn import config.txt svn://localhost/config.txt |
|---|
| 61 | |
|---|
| 62 | You'll be placed in an editor where you can make a comment about the |
|---|
| 63 | file being placed in the repository. At the top of the file add some |
|---|
| 64 | short comment, then save and exit from the file. Accept the default filename. |
|---|
| 65 | |
|---|
| 66 | Next you'll need to enter in a root password, the username you defined and |
|---|
| 67 | the password for the user. |
|---|
| 68 | |
|---|
| 69 | Finally, you may see a warning about storing unencrypted passwords. For now |
|---|
| 70 | say "yes" to the prompt to continue. |
|---|
| 71 | |
|---|
| 72 | If it all works you should see something like: |
|---|
| 73 | |
|---|
| 74 | Sore password unencrypted (yes/no)? yes |
|---|
| 75 | Adding config.txt |
|---|
| 76 | |
|---|
| 77 | Committed revision 1. |
|---|
| 78 | |
|---|
| 79 | 8. List the repository: |
|---|
| 80 | |
|---|
| 81 | # svn list svn://localhost |
|---|
| 82 | |
|---|
| 83 | You should just see the name of the file we have committed, or: |
|---|
| 84 | |
|---|
| 85 | config.txt |
|---|
| 86 | |
|---|
| 87 | 9. Create a local copy of the repository |
|---|
| 88 | |
|---|
| 89 | # cd /tmp |
|---|
| 90 | # svn checkout svn://localhost |
|---|
| 91 | # cd localhost |
|---|
| 92 | |
|---|
| 93 | The default directory name is "localhost" in this case. |
|---|
| 94 | |
|---|
| 95 | 10. Edit and make changes to config.txt |
|---|
| 96 | |
|---|
| 97 | # editor config.txt |
|---|
| 98 | |
|---|
| 99 | 11. Commit the changes you just made in your local repository to the master SVN |
|---|
| 100 | repository: |
|---|
| 101 | |
|---|
| 102 | # svn commit |
|---|
| 103 | |
|---|
| 104 | Again you'll have a change to add some comments. Do this save the file |
|---|
| 105 | and exit. |
|---|
| 106 | |
|---|
| 107 | You should see: |
|---|
| 108 | |
|---|
| 109 | Committed revision 2. |
|---|
| 110 | |
|---|
| 111 | That's it. You are now using subversion in a local repository: |
|---|
| 112 | |
|---|
| 113 | /tmp/localhost |
|---|
| 114 | |
|---|
| 115 | In conjunction with the master repository: |
|---|
| 116 | |
|---|
| 117 | /svn/arocarchive |
|---|
| 118 | |
|---|
| 119 | 12. Run a few more svn commands on the local copy of the master repository |
|---|
| 120 | |
|---|
| 121 | As you are in /tmp/localhost if you type: |
|---|
| 122 | |
|---|
| 123 | # ls -lah |
|---|
| 124 | |
|---|
| 125 | you'll see a hidden directory ".svn" - This is what tells the svn |
|---|
| 126 | command that there is a repository. So, if you type: |
|---|
| 127 | |
|---|
| 128 | # svn list |
|---|
| 129 | |
|---|
| 130 | You'll get back: |
|---|
| 131 | |
|---|
| 132 | config.txt |
|---|
| 133 | |
|---|
| 134 | Try running a few more svn commands: |
|---|
| 135 | |
|---|
| 136 | # svn log |
|---|
| 137 | # svn info |
|---|
| 138 | # svn help |
|---|
| 139 | |
|---|
| 140 | |
|---|
| 141 | |
|---|
| 142 | |
|---|
| 143 | |
|---|
| 144 | |
|---|
| 145 | |
|---|