GitLab is much more powerful git repository manager than the previously described SCM-Manager. Furthermore it has its own CI environment, issue tracking, code review and wiki. At this time I show you GitLab installation process on Ubuntu Server and the first steps.
Installation
Go to GitLab download page , choose your OS version and follow the instructions.
In our case(Ubuntu Server) select the latest Ubuntu package. When I was written this tutorial, the installation instruction contains two steps:
- Install GitLab dependencies
- GitLab installation
Important! For this tutorial purposes change default GitLab HTTP port to 9093. The default GitLab port is 80. We are going to install few more tools, so to avoid conflicts, we will change every default ports configuration.
Install GitLab dependencies
Run below command to install GitLab dependencies (you don’t have to install postfix server if you don’t need)
sudo apt-get install curl openssh-server ca-certificates postfix
Alternative
sudo apt-get install curl openssh-server ca-certificates
Install GitLab
Add repository and install GitLab.
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash sudo apt-get install gitlab-ce
After installation you will see:
gitlab: To configure and start GitLab, RUN THE FOLLOWING COMMAND: sudo gitlab-ctl reconfigure
To finish installation you need to reconfigure GitLab:
sudo gitlab-ctl reconfigure
After that you should see something like:
Running handlers complete Chef Client finished, 221/308 resources updated in 01 minutes 39 seconds gitlab Reconfigured!
Change default GitLab port number 80 to 9093
Edit the GitLab configuration file.
sudo nano /etc/gitlab/gitlab.rb
Find and change the line
external_url 'http://ubuntu-tutorial'
to:
external_url 'http://ubuntu-tutorial:9093'
To take effect run:
sudo gitlab-ctl reconfigure
Starting, stopping and restarting GitLab service in Ubuntu
sudo gitlab-ctl start
sudo gitlab-ctl stop
sudo gitlab-ctl restart
GitLab first run
Open GitLab web console
http://<GITLAB_SERVER_IP_ADDRESS>:90903/
In my case:
http://192.168.1.56:9093/
First time root user password change
When you run GitLab web console the first time, you have to set root user password. Set welcome1 as root password.
Adding tutorial user
Login as root user and go to administration panel (1). Scroll down and click New User (2). Type user information (3) and click the Create user(4) button.
Set the tutorial user password to welcome1 on the first login attempt.
Adding projects group and the owner
Go to administration panel (1). Scroll down and click New Group(2). Enter better-coding-tutorials as Group path (3) and click Create group (4).
The next step is to add tutorial user as projects owner (5,6,7). If everything is ok you see that the tutorial user is a member of better-coding-tutorials group (8).
First GitLab repository
Login as tutorial user and click New Project(1). Select better-coding-tutorials as projects group(2), 01-gitlab-test as name(3) and click Create project (4).
Testing the repository
Copy repository address(1) and make an initial push to repository.
cd /tmp git clone http://ubuntu-tutorial:9093/better-coding-tutorials/01-gitlab-test.git cd 01-gitlab-test touch README.md git add README.md git commit -m "add README" git push -u origin master
As you can see the commit appears in remote repository(1), but the user is unknown(2).
To fix it just configure your git client and do another commit.
git config --global user.email tutorial@better-coding.com git config --global user.name Tutorial cd /tmp/01-gitlab-test echo "Test readme" > README.md git add README.md git commit -m "Sample README" git push -u origin master