Contents
- Introduction
- Resources
- Installing git On The Soekris 4501
- Configuring git On The Voyage SDK VM
- Creating a Bare git Repository
Introduction
In a previous article, we installed cgit on a Soekris 4501 fractional horsepower server, and we left off with pointing the browser at our shiny new install showing a “No repositories found” message. Not a big surprise, since we don’t have git installed, and there are no repositories to browse.
In this tutorial, we’ll go over the very simple steps required to install and configure git, and we’ll be setting up a repository as well. If it all works, you’ll be running git on your Soekris 4501 in about 15 minutes.
One thing to note is that the Soekris 4501 is a pretty old bit of hardware, and has no hard drive. I got around this by doing an nfs mount of a directory on my DLink DNS-323 NAS box. This article assumes you have some basic Linux skills and can set up nfs if I tell you where git expects to put its repositories on the Soekris 4501.
Resources
- The git website.
- The Soekris website
- The Voyage Linux website
Installing git On The Soekris 4501
This really could not be easier. We’re not using apt-get directly because we want to avoid using up valuable space on the CF card that the Soekris 4501 uses. Here’s the basic recipe using wget:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# Grab the git package right from a nearby Debian Mirror, then install it # # Run this section as a standard user that has write permissions on the packages # directory. You can't run as root because we disabled root access to the nfs # shares... mkdir -p /home/nfs/Soekris4501/packages/git cd /home/nfs/Soekris4501/packages/git wget http://ftp.ca.debian.org/debian/pool/main/g/git/git_1.7.2.5-3_i386.deb wget http://ftp.ca.debian.org/debian/pool/main/e/expat/libexpat1_2.0.1-7_i386.deb wget http://ftp.ca.debian.org/debian/pool/main/libe/liberror-perl/liberror-perl_0.17-1_all.deb wget http://ftp.ca.debian.org/debian/pool/main/p/perl/perl_5.10.1-17squeeze3_i386.deb wget http://ftp.ca.debian.org/debian/pool/main/p/perl/perl-modules_5.10.1-17squeeze3_all.deb wget http://ftp.ca.debian.org/debian/pool/main/d/db4.7/libdb4.7_4.7.25-9_i386.deb wget http://security.debian.org/debian-security/pool/updates/main/c/curl/libcurl3-gnutls_7.21.0-2.1+squeeze1_i386.deb wget http://ftp.ca.debian.org/debian/pool/main/c/ca-certificates/ca-certificates_20090814+nmu3squeeze1_all.deb wget http://ftp.ca.debian.org/debian/pool/main/o/openssl/openssl_0.9.8o-4squeeze7_i386.deb # You need to be root to run this part, though. We've got all the .deb files # in one directory, and the -R option figures out the install order! dpkg -i -R git |
That’s it for the install portion of the tutorial – next we’ll configure git
Configuring git On The Soekris 4501
The first thing we need to do is set up a user called git on this machine.
|
1 2 3 4 5 6 7 8 9 |
# Add the git user - this leaves the user pith no password or home dir, which is fine. useradd -c git git # Create the bare repository directory in the /var/www/git nfs share, and give ownership # to the git user mkdir -p /var/www/git/repos chown -R git:git /var/www/git |
We’d like to be able to log in as git over ssh, and the best way to do that is to use
for your userid on all the machines you use. For every account you plan to use to access
the git server from, you’ll need to get the public key of that account on to the
git server.
|
1 2 3 4 5 6 7 8 9 10 |
# Create the directory where the git user will store ssh keys mkdir -p /home/git/.ssh touch /home/git/.ssh/authorized_keys chown -R git:git /home/git/.ssh chmod 700 /home/git/.ssh chmod 600 /home/git/.ssh/* # Copy (append) your public key to /home/git/.ssh/authorized_keys - how you do it # is up to you... |
As noted in the script above, you’ll need to figure out how to get your public key
into the authorize_keys file. That way it’s up to you to decide on the
most secure way of doing it.
Creating a Bare git Repository
That’s just about all there is to it, except for a recipe to create a bare repository. This
little script creates a repository (you can change the name) in /var/www/git/repos
and initializes it.
|
1 2 3 4 5 6 7 8 9 10 |
# Run this script as root - we disabled logins for the git user. # # Set REPONAME to whatever you want the new name to be REPONAME=myrepo mkdir -p /var/www/git/repos/$REPONAME cd /var/www/git/repos/$REPONAME git --bare init chown -R git:git /var/www/git/repos/$REPONAME |
Now point your browser at this address (yours might be a bit different)
192.168.xx.yy/cgit
.. and this time you’ll see the default myrepo repository. There’s nothing in it yet, so
the next step is to set up a client to allow us to interact with our repository.