40 <section> |
40 <section> |
41 <title>Installing mercurial-server</title> |
41 <title>Installing mercurial-server</title> |
42 <para> |
42 <para> |
43 In what follows, we assume that your username is <systemitem |
43 In what follows, we assume that your username is <systemitem |
44 class="username">jay</systemitem>, that you usually sit at a machine called |
44 class="username">jay</systemitem>, that you usually sit at a machine called |
45 <systemitem class="systemname">my-workstation</systemitem> and you wish to |
45 <systemitem class="systemname">spoon</systemitem> and you wish to |
46 install mercurial-server on <systemitem |
46 install mercurial-server on <systemitem |
47 class="systemname">repository-host</systemitem>. We assume that you have created your SSH public key, set up your SSH agent with this key, and that this key gives you access to <systemitem |
47 class="systemname">jeeves</systemitem>. We assume that you have created your SSH public key, set up your SSH agent with this key, and that this key gives you access to <systemitem |
48 class="systemname">repository-host</systemitem>. |
48 class="systemname">jeeves</systemitem>. |
49 </para> |
49 </para> |
50 <para>First install mercurial-server on <systemitem |
50 <para>First install mercurial-server on <systemitem |
51 class="systemname">repository-host</systemitem>:</para> |
51 class="systemname">jeeves</systemitem>:</para> |
52 <screen><computeroutput>jay@my-workstation:~$ </computeroutput><userinput>scp mercurial-server_0.6.1_amd64.deb repository-host:</userinput> |
52 <screen><computeroutput>jay@spoon:~$ </computeroutput><userinput>scp mercurial-server_0.6.1_amd64.deb jeeves:</userinput> |
53 <computeroutput>mercurial-server_0.6.1_amd64.deb 100% |
53 <computeroutput>mercurial-server_0.6.1_amd64.deb 100% |
54 jay@my-workstation:~$ </computeroutput><userinput>ssh -A repository-host</userinput> |
54 jay@spoon:~$ </computeroutput><userinput>ssh -A jeeves</userinput> |
55 <computeroutput>jay@repository-host:~$ </computeroutput><userinput>sudo dpkg -i mercurial-server_0.6.1_amd64.deb</userinput> |
55 <computeroutput>jay@jeeves:~$ </computeroutput><userinput>sudo dpkg -i mercurial-server_0.6.1_amd64.deb</userinput> |
56 <computeroutput>[sudo] password for jay: |
56 <computeroutput>[sudo] password for jay: |
57 Selecting previously deselected package mercurial-server. |
57 Selecting previously deselected package mercurial-server. |
58 (Reading database ... 144805 files and directories currently installed.) |
58 (Reading database ... 144805 files and directories currently installed.) |
59 Unpacking mercurial-server (from .../mercurial-server_0.6.1_amd64.deb) ... |
59 Unpacking mercurial-server (from .../mercurial-server_0.6.1_amd64.deb) ... |
60 Setting up mercurial-server (0.6.1) ... |
60 Setting up mercurial-server (0.6.1) ... |
61 jay@repository-host:~$ </computeroutput></screen> |
61 jay@jeeves:~$ </computeroutput></screen> |
62 <para> |
62 <para> |
63 mercurial-server is now installed on the repository host. Next, we need to give you permission to access its repositories. |
63 mercurial-server is now installed on the repository host. Next, we need to give you permission to access its repositories. |
64 </para> |
64 </para> |
65 <screen><computeroutput>jay@repository-host:~$ </computeroutput><userinput>ssh-add -L > my-key</userinput> |
65 <screen><computeroutput>jay@jeeves:~$ </computeroutput><userinput>ssh-add -L > my-key</userinput> |
66 <computeroutput>jay@repository-host:~$ </computeroutput><userinput>sudo mkdir -p /etc/mercurial-server/keys/root/jay</userinput> |
66 <computeroutput>jay@jeeves:~$ </computeroutput><userinput>sudo mkdir -p /etc/mercurial-server/keys/root/jay</userinput> |
67 <computeroutput>jay@repository-host:~$ </computeroutput><userinput>sudo cp my-key /etc/mercurial-server/keys/root/jay/my-workstation</userinput> |
67 <computeroutput>jay@jeeves:~$ </computeroutput><userinput>sudo cp my-key /etc/mercurial-server/keys/root/jay/spoon</userinput> |
68 <computeroutput>jay@repository-host:~$ </computeroutput><userinput>sudo -u hg /usr/share/mercurial-server/refresh-auth</userinput> |
68 <computeroutput>jay@jeeves:~$ </computeroutput><userinput>sudo -u hg /usr/share/mercurial-server/refresh-auth</userinput> |
69 <computeroutput>jay@repository-host:~$ </computeroutput><userinput>exit</userinput> |
69 <computeroutput>jay@jeeves:~$ </computeroutput><userinput>exit</userinput> |
70 <computeroutput>Connection to repository-host closed. |
70 <computeroutput>Connection to jeeves closed. |
71 jay@my-workstation:~$ </computeroutput></screen> |
71 jay@spoon:~$ </computeroutput></screen> |
72 <para> |
72 <para> |
73 You can now create repositories on the remote machine and have complete |
73 You can now create repositories on the remote machine and have complete |
74 read-write access to all of them. |
74 read-write access to all of them. |
75 </para> |
75 </para> |
76 </section> |
76 </section> |
77 <section> |
77 <section> |
78 <title>Creating repositories</title> |
78 <title>Creating repositories</title> |
79 <para> |
79 <para> |
80 To store a repository on the server, clone it over. |
80 To store a repository on the server, clone it over. |
81 </para> |
81 </para> |
82 <screen><computeroutput>jay@my-workstation:~$ </computeroutput><userinput>cd my-mercurial-project</userinput> |
82 <screen><computeroutput>jay@spoon:~$ </computeroutput><userinput>cd my-mercurial-project</userinput> |
83 <computeroutput>jay@my-workstation:~/my-mercurial-project$ </computeroutput><userinput>hg clone . ssh://hg@repository-host/repository/name</userinput> |
83 <computeroutput>jay@spoon:~/my-mercurial-project$ </computeroutput><userinput>hg clone . ssh://hg@jeeves/repository/name</userinput> |
84 <computeroutput>searching for changes |
84 <computeroutput>searching for changes |
85 remote: adding changesets |
85 remote: adding changesets |
86 remote: adding manifests |
86 remote: adding manifests |
87 remote: adding file changes |
87 remote: adding file changes |
88 remote: added 119 changesets with 284 changes to 61 files |
88 remote: added 119 changesets with 284 changes to 61 files |
89 jay@my-workstation:~/my-mercurial-project$ </computeroutput><userinput>hg pull ssh://hg@repository-host/repository/name</userinput> |
89 jay@spoon:~/my-mercurial-project$ </computeroutput><userinput>hg pull ssh://hg@jeeves/repository/name</userinput> |
90 <computeroutput>pulling from ssh://hg@repository-host/repository/name |
90 <computeroutput>pulling from ssh://hg@jeeves/repository/name |
91 searching for changes |
91 searching for changes |
92 no changes found |
92 no changes found |
93 <computeroutput>jay@my-workstation:~/my-mercurial-project$ </computeroutput><userinput>cd ..</userinput> |
93 <computeroutput>jay@spoon:~/my-mercurial-project$ </computeroutput><userinput>cd ..</userinput> |
94 jay@my-workstation:~$ </computeroutput></screen> |
94 jay@spoon:~$ </computeroutput></screen> |
95 </section> |
95 </section> |
96 <section> |
96 <section> |
97 <title>Adding other users</title> |
97 <title>Adding other users</title> |
98 <para> |
98 <para> |
99 At this stage, no-one but you has any access to any repositories you |
99 At this stage, no-one but you has any access to any repositories you |
100 create on this system. In order to give anyone else access, you'll need a |
100 create on this system. In order to give anyone else access, you'll need a |
101 copy of their SSH public key; we'll assume you have that key in |
101 copy of their SSH public key; we'll assume you have that key in |
102 <filename>~/sam-key.pub</filename>. To manage access, you make changes to the special <filename |
102 <filename>~/sam-key.pub</filename>. To manage access, you make changes to the special <filename |
103 class='directory'>hgadmin</filename> repository. |
103 class='directory'>hgadmin</filename> repository. |
104 </para> |
104 </para> |
105 <screen><computeroutput>jay@my-workstation:~$ </computeroutput><userinput>hg clone ssh://hg@repository-host/hgadmin</userinput> |
105 <screen><computeroutput>jay@spoon:~$ </computeroutput><userinput>hg clone ssh://hg@jeeves/hgadmin</userinput> |
106 <computeroutput>destination directory: hgadmin |
106 <computeroutput>destination directory: hgadmin |
107 no changes found |
107 no changes found |
108 updating working directory |
108 updating working directory |
109 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
109 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
110 jay@my-workstation:~$ </computeroutput><userinput>cd hgadmin</userinput> |
110 jay@spoon:~$ </computeroutput><userinput>cd hgadmin</userinput> |
111 <computeroutput>jay@my-workstation:~/hgadmin$ </computeroutput><userinput>mkdir -p keys/users/sam</userinput> |
111 <computeroutput>jay@spoon:~/hgadmin$ </computeroutput><userinput>mkdir -p keys/users/sam</userinput> |
112 <computeroutput>jay@my-workstation:~/hgadmin$ </computeroutput><userinput>cp ~/sam-key.pub keys/users/sam/their-workstation</userinput> |
112 <computeroutput>jay@spoon:~/hgadmin$ </computeroutput><userinput>cp ~/sam-key.pub keys/users/sam/their-workstation</userinput> |
113 <computeroutput>jay@my-workstation:~/hgadmin$ </computeroutput><userinput>hg add</userinput> |
113 <computeroutput>jay@spoon:~/hgadmin$ </computeroutput><userinput>hg add</userinput> |
114 <computeroutput>adding keys/users/sam/their-workstation |
114 <computeroutput>adding keys/users/sam/their-workstation |
115 jay@my-workstation:~/hgadmin$ </computeroutput><userinput>hg commit -m "Add Sam's key'"</userinput> |
115 jay@spoon:~/hgadmin$ </computeroutput><userinput>hg commit -m "Add Sam's key'"</userinput> |
116 <computeroutput>jay@my-workstation:~/hgadmin$ </computeroutput><userinput>hg push</userinput> |
116 <computeroutput>jay@spoon:~/hgadmin$ </computeroutput><userinput>hg push</userinput> |
117 <computeroutput>pushing to ssh://hg@repository-host/hgadmin |
117 <computeroutput>pushing to ssh://hg@jeeves/hgadmin |
118 searching for changes |
118 searching for changes |
119 remote: adding changesets |
119 remote: adding changesets |
120 remote: adding manifests |
120 remote: adding manifests |
121 remote: adding file changes |
121 remote: adding file changes |
122 remote: added 1 changesets with 1 changes to 1 files |
122 remote: added 1 changesets with 1 changes to 1 files |
123 jay@my-workstation:~/hgadmin$ </computeroutput></screen> |
123 jay@spoon:~/hgadmin$ </computeroutput></screen> |
124 <para> |
124 <para> |
125 Sam can now read and write to your |
125 Sam can now read and write to your |
126 <uri>ssh://hg@repository-host/repository/name</uri> repository. |
126 <uri>ssh://hg@jeeves/repository/name</uri> repository. |
127 Most other changes to access control can be made simply by making and |
127 Most other changes to access control can be made simply by making and |
128 pushing changes to <filename |
128 pushing changes to <filename |
129 class='directory'>hgadmin</filename>, and you can use Mercurial to |
129 class='directory'>hgadmin</filename>, and you can use Mercurial to |
130 cooperate with other root users in the normal way. |
130 cooperate with other root users in the normal way. |
131 </para> |
131 </para> |
132 <para> |
132 <para> |
133 If you prefer, you could give them access by |
133 If you prefer, you could give them access by |
134 logging into <systemitem class="systemname">repository-host</systemitem>, |
134 logging into <systemitem class="systemname">jeeves</systemitem>, |
135 putting the key in the right place under <filename |
135 putting the key in the right place under <filename |
136 class='directory'>/etc/mercurial-server/keys</filename>, and re-running |
136 class='directory'>/etc/mercurial-server/keys</filename>, and re-running |
137 <userinput>sudo -u hg /usr/share/mercurial-server/refresh-auth</userinput>. |
137 <userinput>sudo -u hg /usr/share/mercurial-server/refresh-auth</userinput>. |
138 However, using <filename |
138 However, using <filename |
139 class='directory'>hgadmin</filename> is usually more convenient if you need to make more than a very few changes; it also makes it easier to share administration with others and provides a log of all changes. |
139 class='directory'>hgadmin</filename> is usually more convenient if you need to make more than a very few changes; it also makes it easier to share administration with others and provides a log of all changes. |