Agenda: version-control-exercises.txt

File version-control-exercises.txt, 3.4 KB (added by admin, 7 years ago)
Line 
1Subversion (SVN) and Change Control
2===================================
3
4Notes:
5------
6* Commands preceded with "$" imply that you should execute the command as
7  a general user - not as root.
8* Commands preceded with "#" imply that you should be working as root.
9* Commands with more specific command lines (e.g. "rtr>" or "mysql>")
10  imply that you are executing commands on remote equipment, or within
11  another program.
12* If a command line ends with "\" this indicates that the command continues
13  on the next line and you should treat this as a single line.
14
15Exercises Part I
16================
17
180. Log in to your PC.
19
20Once you are logged in you can continue with these exercises.
21If Subversion is not already installed:
22
23        $ sudo bash                             (become root user)
24
25        # apt-get install subversion            (install subversion)
26
271. Create a root directory for the SVN repository:
28
29        # mkdir /svn
30
312. Create the repository:
32
33        # svnadmin create /svn/myproject
34
353. Create user and password
36
37        # editor /svn/myproject/conf/passwd
38        sysadm = THE_PASSWORD_FROM_CLASS
39
404. Configure access
41
42        # editor /svn/myproject/conf/svnserve.conf
43
44Find the following lines, and remove comments in front of them.
45Don't leave space at the start of the lines!
46
47         auth-access=write
48         password-db=passwd
49
50Exit and save the file.
51
525. Start the service:
53
54        # svnserve -d -r /svn/myproject
55
566. Go to your home directory and create a test file:
57 
58        # cd
59        # editor config.txt
60
61Add some text in the file. Save and exit.
62
637. Import the test file in to the repository: 
64
65        # svn import config.txt svn://localhost/config.txt
66
67You'll be placed in an editor where you can make a comment about the
68file being placed in the repository. At the top of the file add some
69short comment, then save and exit from the file.  Accept the default filename.
70
71You'll likely end up in the "joe" editor. If so, add a comment at the top of the file,
72then press CTRL-K-X to exit and save.
73
74You will be asked for a "root" password - just press RETURN.
75
76Next you'll need to enter the user you created in the password file,
77i.e: sysadm
78
79Then type in the password (from the class)
80
81Finally, you may see a warning about storing unencrypted passwords. For now
82say "yes" to the prompt to continue.
83
84If it all works you should see something like:
85
86        Store password unencrypted (yes/no)? yes
87        Adding          config.txt
88       
89        Committed revision 1.
90
918. List the repository:
92
93        # svn list svn://localhost
94
95You should just see the name of the file we have committed, or:
96
97        config.txt
98
999. Create a local copy of the repository
100       
101        # cd /tmp
102        # svn checkout svn://localhost
103        # cd localhost
104
105The default directory name is "localhost" in this case.
106
10710. Edit and make changes to config.txt
108
109        # editor config.txt
110
11111. Commit the changes you just made in your local repository to the master SVN
112    repository:
113
114        # svn commit
115
116        Again you'll have a change to add some comments. Do this save the file
117        and exit.
118
119        You should see:
120
121        Committed revision 2.
122
123        That's it. You are now using subversion in a local repository:
124
125        /tmp/localhost
126
127        In conjunction with the master repository:
128
129        /svn/myproject
130
13112. Run a few more svn commands on the local copy of the master repository
132
133        As you are in /tmp/localhost if you type:
134
135        # ls -lah
136
137        you'll see a hidden directory ".svn" - This is what tells the svn
138        command that there is a repository. So, if you type:
139
140        # svn list
141
142        You'll get back:
143
144        config.txt
145
146        Try running a few more svn commands:
147
148        # svn log
149        # svn info
150        # svn help
151