
We decided, like with a friend, to start a startup not a startup, but a website for the soul. Decided - it means it will be launched. The budget ... And let's not buy another 2 cups of beer, and we will launch it. In general, the money for the domain and the virtual hosting on the tree. So we are “adults” people, and we’ve gotten used to doing everything thoroughly, we need a version control system and uploading. It was decided to raise the subversion repository with the possibility of distributing access to it to several developers with different logins on valuehost. But we have shared hosting with all its limitations, what to do?
The necessary conditions:
There are only two of them (in general): the availability of ssh-access to the server of the hoster, and the ability to walk on this SSH key.
By the way, the hoster does not have to be valuehost.ru, look at the example with valuehost in the article and translate to your situation, the meaning is the same everywhere.
')
Determine whether subversion is installed:
[megauser@megaserver ~]$ svn
-bash: svn: command not found
[megauser@megaserver ~]$ svnserve
-bash: svnserve: command not found
Not installed, then install it under your account.
If Subversion is already installed in your case, skip all the steps.
to point 4 "Configuring the repository and access to it."
Install Subversion
First of all, we look to see if it is possible to build programs from sources:
[megauser@megaserver ~]$ make
-bash: make: command not found
[megauser@megaserver ~]$ gcc
-bash: gcc: command not found
There is no possibility, then you have to build programs on another machine
with the same OS as the hoster:
[megauser@megaserver ~]$ uname -srm
FreeBSD 6.3-RELEASE i386
We find a machine with the same OSes, where we have access, or, for example,
we put the necessary OS on the home computer. It is necessary that on this
the machine you had write access to the directory in which you plan to install
subversion on the server host. In our case, it was the directory / pub / home / megauser / myroot
We collected subversion without any tricks, just like in the manual for the case of necessity
just a simple svnserve server, without svn integration into apache:
wget subversion.tigris.org/downloads/subversion-1.5.1.tar.gz
wget subversion.tigris.org/downloads/subversion-deps-1.5.1.tar.gz
tar xvzf subversion-1.5.1.tar.gz
tar xvzf subversion-deps-1.5.1.tar.gz
cd subversion-1.5.1
./configure --prefix=/pub/home/megauser/myroot --enable-all-static --disable-mod-activation --without-apache --without-apxs --without-serf --without-berkeley-db --with-ssl
make
make install
(Note: currently the latest version of subversion is 1.5.4, but at the time of our
action was only 1.5.1, so the example is based on it, we think that we can take 1.5.4
without any changes, but just in case read CHANGELOG)
Everything, SVN is assembled and installed along the path we need, we take it to the server of the host:
tar cvzf ~/builded-svn.tgz /pub/home/megauser/myroot/
Then we go to the SSH hoster console:
[megauser@megaserver ~]$ wget your.server/builded-svn.tgz
( , scp)
[megauser@megaserver ~]$ tar xvzf builded-svn.tgz
Everything, SVN is installed, it remains only to add / pub / home / megauser / myroot / bin to
the PATH environment variable so that you can run the svn command without specifying the full
ways to her. Add to ~ / .bashrc or ~ / .profile or a similar string in the file
export PATH=~/myroot/bin:${PATH}
Check it out and test the functionality of the newly installed SVN:
[megauser@megaserver ~]$ svn
Type 'svn help' for usage.
[megauser@megaserver ~]$ svnserve
You must specify exactly one of -d, -i, -t or -X.
Type 'svnserve --help' for usage.
If the answers are different - act on the situation until everything is settled. This completes the installation.
Configure the repository and access to it
First of all, create a repository:
svnadmin create /pub/home/megauser/myrepo
Describe how to fill in the repository initial structure of projects, how to configure the necessary hooks and the like, I will not,
there is
svnbook.red-bean.com/nightly/ru/index.htmlThen we configure the key access via the svn + ssh protocol to our repository:
(on the valuehost server, there was SSH in the “ssh.com” version, and not “openssh”, as happens on linux systems, respectively, our examples are for the “ssh.com” version,
but using the appropriate manuals you can easily do the same for linux).
On working computers of future users of the repository, create key pairs, save the public one in the format “ssh.com”, and upload it to the server
the hostname in ~ / .ssh2 / id_rsa_ <virtual_user_name> .pub, gives file rights 0600 so that ssh does not get scared and does not reject the user with this key for the reason
high availability of the file with the key.
Then create the file ~ / .ssh2 / authorization with the same access rights - 0600. In the file write the following:
Key id_rsa_user1.pub
Options command="/pub/home/megauser/myroot/bin/svnserve -t -r /pub/home/megauser/myrepo --tunnel-user=user1", no-port-forwarding, no-x11-forwarding, no-agent-forwarding, no-pty
Key id_rsa_user2.pub
Options command="/pub/home/megauser/myroot/bin/svnserve -t -r /pub/home/megauser/myrepo --tunnel-user=user2", no-port-forwarding, no-x11-forwarding, no-agent-forwarding, no-pty
That is, for each svn-user - two lines. In this particular example, we created two SVN users, user1 and user2.
Note that user1 and user2, and not your original login to the server of the host, will be used as authors of commits to the repository,
what we actually needed.
Everything, the repository and access to it is set up, to check on a work computer in PuTTY (or another ssh-client) session with the same parameters as your regular access session to the server of the host,
but with the private key that you generated recently for svn, and the public part of which was placed in ~ / .ssh2 / id_rsa_.pub.
Start this session, if everything is ok, then you should see something like this
( success ( 2 2 ( ) ( edit-pipeline svndiff1 absent-entries commit-revprops depth log-revprops partial-replay ) ) )
This means that everything is fine, you can take Tortoise or any other SVN client, and connect to svn + ssh: //server.of.your.hoster.ru/
using the necessary private keys.
To make you suffer less - here is the
archive with our directory / pub / home / megauser / myroot /
In addition to SVN, it still has VIM, MC, rsync and a simple release script, with which we post the committed changes to the combat location of the server.
Here is a gift, use your health :)
ps: the questions "why do you need this, is there ...." should not be asked. I wanted to do so