Thursday, November 12, 2009

Git on a ReadyNAS NV+

Git is a "free & open source, distributed version control system designed to handle everything from small to very large projects with speed and efficiency".

Installing git on a ReadyNAS NV+ is fairly straightforward if you are familiar with the linux command line. First you will need a remote shell with which to login and execute commands. In my previous post I described installing SSH on ReadyNAS.

You can then use the linux APT (Advanced Package Tool) command to install git. APT is a convenient way to install software packages using the command line. Before you do that you need to install APT, but it's easy to do and worth it. Finding and installing APT is the same as it was for SSH, which I described in my previous post (so go read that post).

Now that APT is installed, ensure that your /etc/apt/sources.list contains the following:

deb readynas/
deb sarge/updates main contrib non-free
deb sarge-backports main contrib non-free
deb sarge main contrib non-free

deb-src sarge/updates main contrib non-free
deb-src sarge-backports main contrib non-free
deb-src sarge main contrib non-free

If you know how to use vi, editing this file won't be difficult. I've never been desperate enough to learn vi, so I cat'd the file into a new file under /c/home/ and edited there with emacs, then copied it back and verified the permissions.

  1. apt-get update
  2. apt-get install git-core
  3. apt-get clean
Oh my gosh, it's that simple. Now execute git:

$ git

Thanks to this forum post for the above information.

To read about setting up your remote git repository over ssh you might want to look at one of these two posts:

SSH on a ReadyNAS NV+

Running SSH was a step along the way of me becoming more familiar with SSH and running a remote git repository on my ReadyNAS NV+. Note that there are security concerns with opening SSH on your ReadyNAS device and exposing password authentication. It would be fairly trivial to launch a password attach over the SSH connection.

SSH defaults to use passwords for authentication. The password is set to your ReadyNAS admin password at the time you install SSH on your ReadyNAS. If this password is to be saved on disk somewhere, for example as part of an SSH configuration on the machine from which you are contacting the ReadyNAS, you may choose to temporarily change your ReadyNAS admin password before installing SSH, and then change the ReadyNAS admin password back afterwards. If you ever need to change the SSH password on the ReadyNAS, just reinstall SSH from System > Update in the ReadyNAS admin browser application.

  1. Get the SSH bin file from the ReadyNAS web site. Click the Add-ons for RAIDiator 4.1.3+ link and scroll to the EnableRootSSH link. Download the bin file and store it on your local computer.

  2. Log in as admin on your ReadyNAS using a browser

  3. Update your ReadyNAS firmware (optional). This is under System > Update. Just click the Check for Updates button.

  4. Click the Local tab and click Choose File to find the EnableRootSSH.bin file that you previously downloaded. Upload this and follow the prompts.

After a reboot SSH will be installed and ready to use. To login execute the following:

# Use the hostname or IP address of the ReadyNAS
$ ssh [email protected]

Then type the ReadyNAS admin password that existed at the time SSH was installed.

On my ReadyNAS, my share volumes are under /c and user volumes are under /c/home.

$ cd /c; ls -1

SSH can be configured to use public private keys as well. Refer to my later post and OpenSSH Public Key Authentication for more details.

Security Alert: Opening up your NAS to SSH with password authentication on a public network is a bad idea. In my situation I'm behind a firewall and simply using SSH for the convenience and to play around with the protocol.