Installing GitLab on FreeBSD 10

Source :

1. Update system

2. Install dependencies

Add this to /etc/rc.conf:

3. Create git user

Create user git :

Add git user to redis group :

4. Set up Postgres database

As root, make sure that Postgres is running:

Set up the database:

When logged into the database:

Then type exit to drop back to the root user. Try connecting to the new database with the git user:

If this succeeds, quit the database session by typing \q or hitting CTRL-D.

5. Install and set up Redis

Back up the original Redis config file:

Edit /usr/local/etc/redis.conf to obtain:


And we restart Redis:

6. Install and set up GitLab

Change to git home directory:

Clone GitLab source:

Go to GitLab source folder:

Copy the example GitLab config:

Edit the GitLab configuration file:

The option host: should be set to your domain, e.g. “”.
The line bin_path: should be set to FreeBSD’s git location: /usr/local/bin/git.
Change /home/ to be /usr/home/ (home is a symbolic link that doesn’t work)

As root:

Make folder for satellites and set the right permissions:

Make sure GitLab can write to the tmp/pids/ and tmp/sockets/ directories:

Make sure GitLab can write to the public/uploads/ directory:

Copy the example Unicorn config:

Set the number of workers to at least the number of cores:

Copy the example Rack attack config:

Configure Git global settings for git user, useful when editing via web

Copy Redis connection settings:

Configure Redis to use the modified socket path:

Copy database config:

Install Ruby Gems:

7. GitLab Shell

Run the rake task for installing gitlab-shell:

Edit the gitlab-shell config:

8. Initialise Database

Initialize Database and Activate Advanced Features:

9. Init script

Download the FreeBSD init script as root:

10. Check Configuration and Compile Assets

If this all passes (all green and/or no errors are reported), then go ahead and compile all of the assets for GitLab. This can take ~10-15 minutes on a smaller machine, so don’t panic if it takes a while!

11. Start GitLab service

As root:

12. Nginx

You might want to create /usr/local/etc/nginx/conf.d/ and include it in nginx.conf first.

Edit /usr/local/etc/nginx/conf.d/gitlab.conf and replace with your FQDN. Make sure to read the comments in order to properly set up SSL.

Add nginx user to git group:

Finally start nginx with:


504 – Gateway Timed Out errors

  • Check the logs! Look in /home/git/gitlab/log for clues.
  • Check what’s running! The command sockstat -4l usually gives an idea of which services are running on which ports. (Redis uses port 6379, Unicorn uses port 8080, and Postgres uses port 5432).

What it usually boils down to:

  • GitLab’s assets haven’t been precompiled (there is a command above)
  • Postgres isn’t running or the database isn’t set up properly
  • Redis isn’t running
  • Nginx isn’t set up properly

Unicorn / nginx: “Failed to set accept_filter=httpready”

This is to do with an HTTP buffering kernel module in FreeBSD that some HTTP servers expect to be loaded. Run this:

Author: stratus

Laisser un commentaire