1. Steps to install gitlab on Ubuntu:
- install dependencies
Open the command line window through the shortcut key ctrl+alt+T, and then run the following two lines of commands
sudo apt update
sudo apt-get upgrade
sudo apt-get install curl openssh-server ca-certificates postfix
If this step encounters the following prompt interface, please press Tab to switch to the "OK" button, and then press Enter.
2. Run the installation package installation command and install gitlab online through wget. Please copy the corresponding installation package address from the official website of gitlab
Install command:
wget --content-disposition https://packages.gitlab.com/gitlab/gitlab-ce/packages/ubuntu/focal/gitlab-ce_15.5.2-ce.0_amd64.deb/download.deb
sudo dpkg -i gitlab-ce_15.5.2-ce.0_amd64.deb
If an error related to openssh-server is reported when running dpkg, please execute the following three commands first:
sudo apt --fix-broken install
sudo apt-get update
sudo apt-get upgrade
After running the sudo dpkg installation command, if the following interface appears, the gitlab installation is successful!
3. Configure gitlab
If there is an error that vim cannot recognize, just run the following two lines of commands
sudo rm /var/lib/dpkg/lock*
sudo apt-get update && sudo apt-get install vim
View the current gitlab webpage ip and port number:
sudo vim /etc/gitlab/gitlab.rb
If there is a permission problem when running the above command, run the following command:
#chmod -R 755 /var/log/gitlab
At this time, run sudo vim /etc/gitlab/gitlab.rb to enter the gitlab configuration file modification interface, enter i to enter the edit mode, and then find the external_url field (usually on line 32), change it to the IP and The port number:
After the modification, enter esc to exit the editor, and then enter: wq to save. Next, restart the service with the following command.
# Stop gitlab service sudo gitlab-ctl stop
# Start the gitlab service sudo gitlab-ctl reconfigure
# Restart all gitlab components sudo gitlab-ctl restart
# Start all gitlab components sudo gitlab-ctl start
# Enable boot self-start sudo systemctl enable gitlab-runsvdir.service
4. Initialize root password
# 1) Switch to the corresponding path: cd /opt/gitlab/bin/
# 2) Open the console: sudo gitlab-rails console -e production
# 3) Query user account information and assign it to u: u=User.where(id:1).first
# 4) Set the password for this username: u.password='12345678'
# 5) Confirm password: u.password_confirmation='12345678'
# 6) Save information: u.save
# 7) Exit: exit
After the above operations, you can log in to gitlab through http://192.168.116.128:8077.
2. Gitlab registers new users
After the above two steps, a new account is registered. At this time, you need to wait for the root management to review and approve the account before the account can be used, otherwise you cannot log in to the gitlab platform.
- Set Chinese interface