Gitlab installation - gem rails fails

I’m using Ubuntu 16.10 and was trying to update my Gitlab from 6.8 to 7 and everything went wrong. Now I have removed it and is trying to install a new version but ran into a problem with Gem (Ruby?).

When I try install it

$ sudo apt install gitlab

I get an error after some time:

Could not find gem ‘rails (>= 4.2.7.1, ~> 4.2.7)’ in any of the gem sources listed in your Gemfile.

After trying several things over several hours I gave up!
I started all over… Removed gitlab* and postgresql. Rebooted and installed gitlab again. Now I got another error:

Could not find gem ‘pg (~> 0.18.2)’ in any of the gem sources listed in your Gemfile.
Tried to install pg manually:

$ sudo gem install pg
Successfully installed pg-0.20.0

But still sudo apt upgrade gives the same error: "Could not find gem ‘pg’

How can I prevent gitlab from installing Prostgresql and use MariaDB instead?

Closing this and creating a new with updated info…