Installation#
Recommendation: Install directly using the system's built-in package management tools, such as yum, dnf, apt, etc., instead of using containers or other methods.
Reason: Using containers will make GitLab management more complex. Deploying directly on the machine allows for disk expansion if space is insufficient and instance type changes if resources are insufficient.
Complex factors:
- Docker management
- Docker-compose configuration
- Disk mounting
- Port mapping (conflict between port 22 on the host machine and port 22 in the GitLab container)
- Domain configuration
Configuration#
Domain and SSL Configuration#
Make changes to gitlab.rb according to the documentation.
external_url 'https://example.com'
// The # at the beginning of the following lines has been manually removed
letsencrypt['enable'] = false
nginx['enable'] = true
nginx['redirect_http_to_https'] = true
nginx['ssl_certificate']
nginx['ssl_certificate_key']
These two items do not need to be modified. Just rename the SSL files to example.com.crt and example.com.key and place them in /etc/gitlab/ssl. They will be automatically recognized.
Applying for SSL#
Several methods:
- If the domain is hosted by a cloud provider, you can apply directly.
- Use free SSL certificate services, such as letsencrypt freessl.cn
My approach:
- Register and verify with freessl.cn
- Add the domain
- Perform DNS verification
- Apply for the certificate using acme.sh
Startup#
After completing the configuration, manually execute the following:
gitlab-ctl reconfigure // Reconfigure
gitlab-ctl start // Start
Password:
cat /etc/gitlab/initial_root_password
User recommendation: After logging in as an administrator, configure a user with administrator privileges. Avoid using the root user.