If you need an inhouse git server and you have a small team only, then Stash from Atlassian might be something for you. We use it for several months now and I can say we are pretty happy with it.
Here’s how to install it on a Ubuntu 12.04 box:
Prerequisites
Stash is running on Java, so you need to install a JRE. OpenJDK is supported.
Git is also needed, of course:
You also need MySQL in case you want to run the database on the same server:
Prepare User and Directories
Stash needs its own user, whose home directory is used as a data store. I therefore chosed to locate this directory under /srv/
:
Install Files
I chosed to host installation in /opt/
:
Set STASH_HOME
You need to tell Stash where its home directory is located. Add following line to /opt/atlassian-stash-2.11.3/bin/setenv.sh
IPv4
Stash now already starts, but I noticed it listens on IPv6 ports only. To enable the regular IPv4 ports, open ``/opt/atlassian-stash-2.11.3/bin/setenv.sh` again and add the following parameter to the appropriate Java call:
Try Stash the First Time
Now, Stash is ready for a first try. Start it by
And open http://<your-server>:7990/setup
to see if it’s working.
You can stop it by
Automatic Startup
We want to have Stash being started automatically once the server is rebooted.
First, create a generic name for the application directory (this will upgrading to a newer version easier later on):
Download the startup script provided by Atlassian and save it as /etc/init.d/stash
. Adjust following lines to match our installation:
And enable it via:
Finally, we need to set the JAVA_HOME
environment variable. Add this line to ` /etc/environment`:
Install JDBC Driver
Stash doesn’t come with a JDBC driver, so you have to download this separately from the MySQL home page. Then, copy it to the stash installation directory:
Prepare Database
Finally, you need to create a database for Stash:
End
These steps were enough to setup a basic Stash server for our needs. Check the manual for more installation options and details.