In order to setup your local GitLab CE instance (inside ESXi), you need:
- Working ESXi
- Bitnami Gitlab *.OVA file (link)
- Local DNS is a bonus
VM
After you download the OVA file, open ESXi web UI, create a new VM and select Deploy a VM from UVF file, give it a name and select/drag the OVA file into the box. Follow on screen instructions.
Static IP/ DHCP
Now that you have the VM up an running, you have to make a decision, if you want to use DHCP or static IP for that box. If your choice is DHCP, setup your DHCP service to assign same IP to your VM MAC address every time, so that you can setup the URL/hostname in Gitlab. If you pick static IP, open the VM console in ESXi (or ssh to the box if enabled). You should see the login and password, use it. You might be asked to change the default password.
Now follow the instructions from here:
- check your interface name:
ip a
it should be something likeens32
- navigate to network settings directory
cd /etc/systemd/network
- copy network config file
sudo cp 99-dhcp.network 25-wired.network
- edit the network settings file:
[Match]
Name=ens32 (your interface neame here)
[Network]
Address=10.0.0.9/24 (desired IP address and netmask)
Gateway=10.0.0.1
DNS=10.0.0.1
- save file and restart the VM
Hostname, DNS
At this point you should have IP setup done and dusted, it's a good idea to give your GitLab instance some meaningful name to access, like gitlab.local
In order to do it, you need a local DNS server. Add an A record, pointing to your VM IP address, and a name.
Try accessing your GitLab instance using your newly created domain name. There are two problems.
- SSL is not set up and the browser is complaining about self signed certificate
- Server is redirecting to IP address, not using the domain name
To fix the second issue, follow those instructions (link), or run
sudo /opt/bitnami/apps/gitlab/bnconfig --machine_hostname NAME
where NAME is your domain name.
Rename or remove the bnconfig file to avoid the hostname being reset after reboot!
SSL
The last part is setting up SSL. As we are using the server in a local network, self signed certificate is enough.
You need:
- server.key
- server.crt
Copy both files to the server (I'm using WinSCP), copy both files to /etc/gitlab/ssl/
change owner to root:root and chmod 600.
Last two steps are - trigger gitlab script reconfigure and restart gitlab service.
mv server.* /etc/gitlab/ssl/
chown root:root /etc/gitlab/ssl/
chmod 600 /etc/gitlab/ssl/
gitlab-ctl reconfigure
gitlab-ctl restart
Git.exe and SSL
Execute git config --list --show-origin
to find out the location of your git config files. Then edit it and add:
[http]
sslCAInfo=[your location]\\cert.pem
Gotcha's
I use local DNS server, but the Bitnami image used Google's 8.8.8.8 and 8.8.4.4 DNS by default. Modifying the network setup wasn't enough. I had to manually edit /etc/resolv.conf
file to add my DNS server.