Installing Gitlab
Dependencies
sudo apt install curl openssh-server ca-certificates postfix
Postfix local only config
We configure for local only due to testing purposes. Do step one before actually installing the postfix
package.
Setup a Local Only Email Server (Linux, Unix, Mac)
1 - Point [Link] to your machine
Most of programs will not accept an email using just @localhost as domain. So, edit /etc/hosts file to
make the domain [Link] point to your machine, including this content to the file:
[Link] [Link]
2 - Install Postfix
Ubuntu: sudo apt-get install postfix
MacOSX: Postfix is already installed by default.
3 - Configure Postfix to Local only
During postfix install process, the configure text dialog will display five options:
General type of mail configuration:
No configuration
Internet Site
Internet with smarthost
Satellite system
Local only
Select "Local Only".
For the domain name, use the default suggested and finish the install.
4 - Configure a Catch-all Address
Enabling this, you can use any email address ending with "@localhost" or "@[Link]".
Example: here, my unique account is rael@[Link]. But while testing systems, I can use any
address like joe@[Link], foo@[Link], etc, because all will be redirected to
rael@[Link]
If not exists, create file /etc/postfix/virtual: sudo nano /etc/postfix/virtual
Add the following 2 lines content, replacing with your user account:
@localhost <your-user>
@[Link] <your-user>
Save and close the file.
Configure postifx to read this file:
Open /etc/postfix/[Link]: sudo nano /etc/postfix/[Link]
And check if this line is enabled, or add it if not exists: virtual_alias_maps =
hash:/etc/postfix/virtual
Activate it: sudo postmap /etc/postfix/virtual
Reload postfix: sudo systemctl restart postfix
If you're under non systemd distro, like Ubuntu 14.04, service restart command probably is: ssudo
service postfix reload
5 - Install Thunderbird
Ubuntu: sudo apt-get install thunderbird
6 - Configure Thunderbird
Skip the welcome screen (click in the button to use existing accounts);
Click in the Settings button at top right (similar to Chrome settings) then click on Preferences >
Account Settings
Under Account Actions choose "Add Other Account"
Select "Unix Mailspool (Movemail)"
Your account will be <your-user>@localhost (of course, replace <your-user> with your user
account). Don't use <your-user>@(none), use <your-user>@localhost
Ingoing and Outgoing server will be: localhost
Restart (close and reopen) Thunderbird.
7 - Start your Mail Spool file
This step have two purposes: test your install and stop the Unable to locate mail spool file. message.
Using Thunderbird, send new email to <your-user>@localhost, replacing <your-user> with your user
account
Click on "Get Mail"
Test catch-all: send new email to averagejoe@localhost
Click on "Get Mail" and you'll see the message at Inbox.
Add The Repository and Install
Firs switch to root with the sudo su then execute:
curl -sS [Link] | bash
After this step is done run sudo apt-get install gitlab-ce
When the installation is done run
sudo gitlab-ctl reconfigure
The script will run and set up your configuration for Gitlab. It will also start up Gitlab when it's done.
In the future, when you want to start and stop Gitlab, you can use the following commands.
gitlab-ctl start
gitlab-ctl stop
After the sudo gitlab-ctl reconfigure is done verify with netstat -ntap that everything is working.
Loging In
Open the hostname or IP address of your server in a web browser. In my case, the URL is
[Link]
Additional
If the Loging In step fails try the following:
First, open Gitlab's configuration file:
sudo nano /etc/gitlab/[Link]
Near the top is the external_url configuration line. Update it to match your own domain:
/etc/gitlab/[Link]
external_url '[Link] (either put testingBed or localhost or [Link] here)
Save and close the file. Then run the command to reconfigure Gitlab:
sudo gitlab-ctl reconfigure
This will initialize GitLab using information it can find about your server. This is a completely
automated process, so you will not have to answer any prompts.
Adjusting the Firewall Rules
Before you can access the GitLab for the first time, you will need to ensure that your firewall rules are
permissive enough to allow normal web traffic. If you followed the guide linked in the prerequisites,
you will have a ufw firewall enabled.
The bellow is an example
View the current status of your active firewall by typing:
sudo ufw status
Output
Status: active
To Action From
-- ------ ----
OpenSSH ALLOW Anywhere
OpenSSH (v6) ALLOW Anywhere (v6)
As you can see, the current rules allow SSH traffic through, but access to other services is restricted.
Since GitLab is a web application, we should allow HTTP access in.
Since the protocol to port mapping for HTTP is available in the /etc/services file, we can allow that
traffic in by name. If you didn't already have OpenSSH traffic enabled, you should allow that traffic
now too:
sudo ufw allow http
sudo ufw allow OpenSSH
If you check the ufw status command again, you should see access configured to at least these two
services:
sudo ufw status
Output
Status: active
To Action From
-- ------ ----
OpenSSH ALLOW Anywhere
80 ALLOW Anywhere
OpenSSH (v6) ALLOW Anywhere (v6)
80 (v6) ALLOW Anywhere (v6)