Wednesday, July 06, 2016

Setup gitolite in D-Link DIR-620 router running openwrt

Related image
It's been some while that i flash my D-Link DIR-620 router with openwrt, but never have additional feature except tried to setup a torrent with it. Just tried to setup a gitolite server with it and hope that someone else will find it useful for following information:


  1. Setup USB Storage. In this case i am using a 8gb USB thumb drive using the following command (i have formated my usb drive into ext4 format):
  1. opkg install kmod-usb-storage block-mount kmod-fs-ext4
  2. Setup gitolite in the router using the following step :
  • Install necessary components
  • opkg install git perl perlbase-essential perlbase-getopt perlbase-findbin perlbase-cwd perlbase-config perlbase-file perlbase-data perlbase-bytes perlbase-xsloader openssh-keygen perlbase-hostname perlbase-fcntl perlbase-io perlbase-symbol perlbase-selectsaver perlbase-errno perlbase-base
  • Backup authorized_keys file if exist
  • cp -p /etc/dropbear/authorized_keys /etc/dropbear/authorized_keys_backup
  • Create directory under mnt and mount usb drive
  • mkdir /mnt/usb
  • mount /dev/[sda2]/mnt/usb
  • Move root to usb and create link
  • cd /
  • mv root /mnt/usb
  • ln -s /mnt/usb/root root
  • Download gitolite 
  • cd /root
  • git clone git://github.com/sitaramc/gitolite
  • Install a link to gitolite executable into /usr/bin
  • gitolite/install -ln /usr/bin
  • create gitolite logfile directory
  • mkdir /root/.gitolite
    mkdir /root/.gitolite/logs
  • Copy your ssh public key to root, you may use puttykeygen tools to get the single line public key and paste to a new file via vi command
  • vi yourname.pub
  • Setup gitolite
  • gitolite setup -pk yourname.pub
  • now you can remove the public key file and create a link to /root/.ssh/authorized_keys in /etc/dropbear/authorized_keys
  • rm yourname.pub
  • rm /etc/dropbear/authorized_keys
    ln -s /root/.ssh/authorized_keys /etc/dropbear/authorized_keys
  • now you can admistrate your gitolite by cloning the gitolite-admin repo
  • git clone root@OpenWRTBox:gitolite-admin