| 1 | <sect2> |
| 2 | <title>Setting up a CVS server.</title> |
| 3 | |
| 4 | <para>We will discuss setting up a CVS server using OpenSSH as the |
| 5 | remote access method. Other access methods, including :pserver: and |
| 6 | :server: will not be used for write access to the CVS repository. The |
| 7 | :pserver: method sends clear text passwords over the network and the |
| 8 | :server: method is not supported in all CVS ports. Instructions for |
| 9 | anonymous, read only CVS access using :pserver: can be found at the |
| 10 | end of this section.</para> |
| 11 | |
| 12 | <para>Configuration of our CVS server consists of four steps:</para> |
| 13 | |
| 14 | <sect3><title>1. Create a repository.</title> |
| 15 | <para>Create a new CVS repository with the following commands, |
| 16 | logged in as root:</para> |
| 17 | <para><screen><userinput> |
| 18 | mkdir /cvsroot && |
| 19 | chmod 1777 /cvsroot && |
| 20 | export CVSROOT=/cvsroot |
| 21 | cvs init</userinput></screen></para></sect3> |
| 22 | |
| 23 | <sect3><title>2. Import source code into the repository.</title> |
| 24 | <para>Import a source module into the repository with the following |
| 25 | commands, issued from a user account on the same machine as the CVS |
| 26 | repository:</para> |
| 27 | |
| 28 | <para><screen><userinput> |
| 29 | export CVSROOT=/cvsroot && |
| 30 | cd sourcedir && |
| 31 | cvs import -m "repository test" cvstest vendortag releasetag |
| 32 | </userinput></screen></para></sect3> |
| 33 | |
| 34 | <sect3><title>3. Verify local repository access.</title> |
| 35 | <para>Test access to the CVS repository from the same user account |
| 36 | with the following command:</para> |
| 37 | |
| 38 | <para><screen><userinput> |
| 39 | cvs co cvstest |
| 40 | </userinput></screen></para></sect3> |
| 41 | |
| 42 | <sect3><title>4. Verify remote repository access.</title> |
| 43 | <para>Test access to the CVS repository from a remote machine using a |
| 44 | user account that has ssh access to the CVS server with the following |
| 45 | commands: |
| 46 | <note><para>Replace "servername" with the IP address or host name |
| 47 | ofthe CVS repository machine. You will be prompted for the user's |
| 48 | shellaccount password before CVS checkout can |
| 49 | continue.</para></note></para> |
| 50 | |
| 51 | |
| 52 | <para><screen><userinput> |
| 53 | export CVS_RSH=/usr/bin/ssh && |
| 54 | cvs -d:ext:servername:/cvsroot co cvstest |
| 55 | </userinput></screen></para></sect3> |
| 56 | </sect2> |
| 57 | <sect2> |
| 58 | <title>Configuring CVS for anonymous read only access.</title> |
| 59 | |
| 60 | <para>CVS can be set up to allow anonymous read only access using the |
| 61 | :pserver: method by logging on as root and executing the following |
| 62 | commands:</para> |
| 63 | |
| 64 | <para><screen><userinput> |
| 65 | (grep anonymous /etc/passwd || useradd anonymous -s /bin/false) && |
| 66 | echo anonymous: > /cvsroot/CVSROOT/passwd && |
| 67 | echo anonymous > /cvsroot/CVSROOT/readers |
| 68 | </userinput></screen></para> |
| 69 | |
| 70 | <para>If you use inetd, the following command will add the pserver |
| 71 | entry to /etc/inetd.conf:</para> |
| 72 | |
| 73 | <para><screen><userinput> |
| 74 | echo "2401 stream tcp nowait root /usr/bin/cvs cvs -f \ |
| 75 | --allow-root=/cvsroot pserver" >> /etc/inetd.conf |
| 76 | </userinput></screen></para> |
| 77 | |
| 78 | <para>Issue a killall -HUP inetd to reread the changed inetd.conf |
| 79 | file.</para> |
| 80 | |
| 81 | <para>If you use xinetd, the following command will add the pserver |
| 82 | entry to /etc/xinetd.conf:</para> |
| 83 | |
| 84 | <para><screen><userinput> |
| 85 | cat >> /etc/xinetd.conf << "EOF" |
| 86 | service cvspserver |
| 87 | { |
| 88 | port = 2401 |
| 89 | socket_type = stream |
| 90 | protocol = tcp |
| 91 | wait = no |
| 92 | user = root |
| 93 | passenv = PATH |
| 94 | server = /usr/bin/cvs |
| 95 | server_args = -f --allow-root=/cvsroot pserver |
| 96 | } |
| 97 | EOF |
| 98 | </userinput></screen></para> |
| 99 | <para>Issue a killall -HUP xinetd to reread the changed xinetd.conf |
| 100 | file.</para> |
| 101 | |
| 102 | <para>Testing anonymous access to the new repository requires an account |
| 103 | on another machine that can reach the CVS server via network. No |
| 104 | account on the CVS repository is needed. To test anonymous access to |
| 105 | the CVS repository log in to another machine as an unprivileged user |
| 106 | and execute the following command:</para> |
| 107 | |
| 108 | <para><screen><userinput> |
| 109 | cvs -d:pserver:anonymous@servername:/cvsroot co cvstest |
| 110 | </userinput></screen><note><para>Replace "servername" with the IP |
| 111 | address or hostname of the CVS server</para></note></para> |
| 112 | |
| 113 | </sect2> |
| 114 | |
| 115 | |