![]() |
VOOZH | about |
We’re so glad you’re here. You can expect all the best TNS content to arrive Monday through Friday to keep you on top of the news and at the top of your game.
Check your inbox for a confirmation email where you can adjust your preferences and even join additional groups.
Follow TNS on your favorite social media networks.
Become a TNS follower on LinkedIn.
Check out the latest featured and trending stories while you wait for your first TNS newsletter.
sudo apt install ca-certificates curl openssh-server apt-transport-https gnupg lsb-release -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose -yAdd your user to the docker group with:
sudo usermod -aG docker $USERLog out and log back in for the changes to take effect. So far, so good. Let’s move on.
docker run --detach \ --hostname HOSTNAME \ --env GITLAB_OMNIBUS_CONFIG="external_url 'http://SERVER'; gitlab_rails['lfs_enabled'] = true;" \ --publish 443:443 --publish 80:80 --publish 22:22 \ --name gitlab \ --restart always \ --volume $GITLAB_HOME/config:/etc/gitlab \ --volume $GITLAB_HOME/logs:/var/log/gitlab \ --volume $GITLAB_HOME/data:/var/opt/gitlab \ --shm-size 256m \ gitlab/gitlab-ee:VERSIONWhere HOSTNAME is the hostname of the server (and must be externally reachable), SERVER is either the IP address or domain of the hosting server, and VERSION is the version number (such as 16.5.3 or latest).\ Next, the Docker Compose file needs to be changed (as some of it no longer functions properly). That new code looks like this:
version: '3.6' services: gitlab: image: gitlab/gitlab-ee:VERSION container_name: gitlab restart: always hostname: 'HOSTNAME' environment: GITLAB_OMNIBUS_CONFIG: | # Add any other gitlab.rb configuration here, each on its own line external_url 'https://SERVER' ports: - '80:80' - '443:443' - '22:22' volumes: - '$GITLAB_HOME/config:/etc/gitlab' - '$GITLAB_HOME/logs:/var/log/gitlab' - '$GITLAB_HOME/data:/var/opt/gitlab' shm_size: '256m'Where HOSTNAME is the hostname of the server (and must be externally reachable), SERVER is either the IP address or domain of the hosting server, and VERSION is the version number (such as 16.5.3 or latest).
sudo nano /etc/ssh/sshd_config
#Port 22Change that line to:
Port 2022Enable port 22 to pass through the firewall with: sudo ufw allow 2022 With the firewall opened, restart SSH with the command:
sudo systemtl restart sshMake sure to test the SSH connection with another login using the command:
ssh USER@SERVER -p 2022
sudo mkdir -p /srv/gitlab
mkdir ~/docker-gitlab
cd ~/docker-gitlab
nano .env
GITLAB_HOME=/srv/gitlab
nano docker-compose.yml
version: '3.6' services: web: image: 'gitlab/gitlab-ee:latest' container_name: 'gitlab-server' restart: always hostname: 'gitlab.example.com' environment: GITLAB_OMNIBUS_CONFIG: | external_url 'https://DOMAIN_OR_IP' gitlab_rails['smtp_enable'] = true gitlab_rails['smtp_address'] = "SMTP_SERVER" gitlab_rails['smtp_user_name'] = "SMTP_SERVER_USERNAME" gitlab_rails['smtp_password'] = "SMTP_SERVER_PASSWORD" gitlab_rails['smtp_domain'] = "DOMAIN" gitlab_rails['smtp_enable_starttls_auto'] = true gitlab_rails['smtp_port'] = 587 gitlab_rails['smtp_authentication'] = "login" gitlab_rails['gitlab_email_from'] = 'FROM_EMAIL' gitlab_rails['gitlab_email_reply_to'] = 'REPLY_EMAIL' # Add any other gitlab.rb configuration here, each on its own line ports: - '80:80' - '443:443' - '22:22' - '587:587' volumes: - '$GITLAB_HOME/config:/etc/gitlab' - '$GITLAB_HOME/logs:/var/log/gitlab' - '$GITLAB_HOME/data:/var/opt/gitlab' shm_size: '256m'Save and close the file.
sudo cat /srv/gitlab/config/initial_root_password
export GITLAB_HOME=/srv/gitlabDeploy the container with this (make sure to change anything in bold to suit your needs):
docker run --detach \ --hostname HOSTNAME \ --publish 443:443 --publish 80:80 --publish 22:22 \ --name gitlab \ --restart always \ --volume $GITLAB_HOME/config:/etc/gitlab \ --volume $GITLAB_HOME/logs:/var/log/gitlab \ --volume $GITLAB_HOME/data:/var/opt/gitlab \ --shm-size 256m \ gitlab/gitlab-ee:latestOne of the above methods should work to get GitLab deployed. If you still have problems, you may change the outward-facing SSH port to something like 10022, so that option would look like —publish 10022:22. Finally, if you still have problems getting GitLab to deploy, here’s another option:
docker run -d -p 22:22 -p 80:80 -p 443:443 \ --name gitlab --hostname gitlab.example.com \ --restart unless-stopped --shm-size 256m \ -v gitlab_config:/etc/gitlab -v gitlab_logs:/var/log/gitlab \ -v gitlab_data:/var/opt/gitlab gitlab/gitlab-ce:14.7.0-ce.0