Setting up a git server on a Readynas NV
Sunday, March 20th, 2011So, over the last few days, I’ve been slowly setting up a git server to use for a personal project I’m working on. I figured I’d share a few lessons I’ve learned along the way. Please note that this is not intended to be a step-by-step tutorial. I’m writing this from memory, and I almost certainly left a piece or two out along the way.
Before doing anything else, backup your data. You can buy a 1TB external USB drive for about $100. You have no excuse for not backing up. Readynas does not clearly indicate backup progress, but you can get an idea by watching the USB volume size. If you want the backup to run in a reasonable time, make sure you disable the instant USB disconnect option. Expect your backup to run around 5 hours per 100 GB of data.
Make sure that once you complete the backup that you physically disconnect the device. The backup is mapped into the native linux filesystem. As such, you could - in theory - delete your backup if you screw up badly enough when acting as root.
Lesson 1:
You’ll need root access. Go download and install the EnableRootSSH add-on from Netgear. Your default password will be your admin password.
Lesson 2:
You’ll want apt-get. Go install the APT addon from Netgear. To pull down versions of the various packages which work for the hardware/software configuration on the box, you’ll have to modify your backports. The version of debian installed on the box (”sarge”) is quite a bit out of date and is not really supported by debian any more. I don’t have the links I used any more, but you should be able to find them on the netgear site with a bit of searching in the forums.
Lesson 3:
The newest git version that has been backported is fairly old. Some common commands like “git init –bare” do not seem to be supported. “git svn import” does not function. The first can be worked around, but the second prevents interaction with Subversion as far as I can tell.
I’m probably going to end up building git from source in the near future. If anyone wants to hear how that goes, let me know. I also ended up building subversion from source, which may fix some of the issues with “git svn”.
Lesson 4:
- You need to create users for anyone who’s going to access the server. I recommend creating the users through your Frontview web portal for safety sake. You could manually create them from your root SSH session, but I have not tried this.
- Make sure you create a home directory for them. You can do this by running the following commands:
mkdir /home/username/ chown username:users /home/username
- After creating the user, anyone you want to be able to access your repository over SSH needs to be able to login. By default, users created by Frontview do not have a shell. You’ll need to switch them from “/bin/false” to “/bin/bash” in “/etc/passwd”.
- You can confirm a valid user setup by login in via ssh (from your root session if so desired.) “ssh user@your-readynas -v”. The “-v” add verbose output for figuring out what - if anything - went wrong.