Installing GitLab on FreeBSD 10

Source :

1. Update system

pkg update pkg upgrade

2. Install dependencies

pkg install sudo bash icu cmake pkgconf git go nginx node ruby ruby21-gems logrotate redis postgresql94-server postgresql94-contrib postfix krb5 gem install bundler --no-ri --no-rdoc

Add this to /etc/rc.conf:

# GitLab services redis_enable="YES" postgresql_enable="YES" gitlab_enable="YES" # Web server nginx_enable="YES" # Postfix/Sendmail postfix_enable="YES" sendmail_enable="NO" sendmail_submit_enable="NO" sendmail_outbound_enable="NO" sendmail_msp_queue_enable="NO"

3. Create git user

Create user git :

pw add user -n git -m -s /usr/local/bin/bash -c "GitLab"

Add git user to redis group :

pw user mod git -G redis

4. Set up Postgres database

As root, make sure that Postgres is running:

service postgresql start

Set up the database:

# Initialize First start of PG DB service postgresql initdb # Initialise Postgres db service postgresql start # Log in to Postgres user account su - pgsql # Connect to Postgres database psql -d template1

When logged into the database:

# Create a user for GitLab template1=# CREATE USER git CREATEDB; # Create the GitLab production database & grant all privileges on database template1=# CREATE DATABASE gitlabhq_production OWNER git encoding='UTF8'; # Create extension CREATE EXTENSION pg_trgm; # Quit the database session template1=# \q

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

su - git psql -d gitlabhq_production CREATE EXTENSION pg_trgm;

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:

cp /usr/local/etc/redis.conf /usr/local/etc/redis.conf.orig

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

unixsocket /usr/local/var/run/redis/redis.sock unixsocketperm 770 daemonize yes pidfile /var/run/redis/ port 6379 tcp-backlog 511 timeout 0 tcp-keepalive 0 loglevel notice logfile /var/log/redis/redis.log databases 16 save 900 1 save 300 10 save 60 10000 stop-writes-on-bgsave-error yes rdbcompression yes rdbchecksum yes dbfilename dump.rdb dir /var/db/redis/ slave-serve-stale-data yes slave-read-only yes repl-diskless-sync no repl-diskless-sync-delay 5 repl-disable-tcp-nodelay no slave-priority 100 appendonly no appendfilename "appendonly.aof" appendfsync everysec no-appendfsync-on-rewrite no auto-aof-rewrite-percentage 100 auto-aof-rewrite-min-size 64mb aof-load-truncated yes lua-time-limit 5000 slowlog-log-slower-than 10000 slowlog-max-len 128 latency-monitor-threshold 0 notify-keyspace-events "" hash-max-ziplist-entries 512 hash-max-ziplist-value 64 list-max-ziplist-entries 512 list-max-ziplist-value 64 set-max-intset-entries 512 zset-max-ziplist-entries 128 zset-max-ziplist-value 64 hll-sparse-max-bytes 3000 activerehashing yes client-output-buffer-limit normal 0 0 0 client-output-buffer-limit slave 256mb 64mb 60 client-output-buffer-limit pubsub 32mb 8mb 60 hz 10 aof-rewrite-incremental-fsync yes


mkdir -p /usr/local/var/run/redis chown redis:redis /usr/local/var/run/redis chmod 755 /usr/local/var/run/redis

And we restart Redis:

service redis restart

6. Install and set up GitLab

Page 1 of 3 | Next page