How to Migrate GitLab from Old server to New Server?

Tudip Technologies
2 min readMay 21, 2022

--

When migrating Gitlab to a new server, you might face many problems like incompatible versions, different OS (so different latest Gitlab version), etc. Before migrating the Gitlab to the new server, we have to make sure that Gitlab in both servers have the same edition and version (e.g If an old server has Gitlab Community edition with version 11.9 then the new server must have the Gitlab Community edition with the 11.9 version) The best way of doing this is to upgrade the old server to the same latest Gitlab version, then back up the Gitlab, followed by the transfer of the backup to the new server. Install the same latest Gitlab version in the new server, and restore it. We have the Gitlab on Linode server and now we move it to the AWS EC2 instance. We follow the below steps for migration.

Steps for Gitlab Migration to AWS server:

1. Check the version of Gitlab on Linode server.

gitlab-rake gitlab:env:info

2. Update the Gitlab to the latest version with the following commands.

apt-get update
apt-get install gitlab-ce
gitlab-ctl reconfigure
gitlab-ctl restart

3. First, we’ll need to back up the gitlab at the Linode server.

gitlab-rake gitlab:backup:create

4. Then, we have to transfer it to the AWS server (EC2 instance) via SCP.

scp /var/opt/gitlab/backups/XXXXXXXXX_gitlab_backup.tar root@NEW_SERVER_IP:/root/

5. At the AWS server, install the latest version of Gitlab as per the steps mentioned in the blog ‘Gitlab Installation On Ubuntu’.

6. After the installation of Gitlab on AWS server, run the Gitlab reconfigure for the first time.

Read more: https://tudip.com/blog-post/migrate-gitlab-to-new-server/

--

--