How to upgrade Gitlab 5.4 to 6.0 on CentOS 6 or RHEL6

Last modified: [last-modified]

The upgrade instructions found on Gitlab’s official website are what I followed to upgrade my installation of Gitlab.

The only alterations I’ve made are to match my unique configuration from earlier articles on this website.

If you haven’t already upgrade your Gitlab to 5.4 before proceeding with these instructions. I never wrote a 5.2 -> 5.3 or a 5.3 -> 5.4 upgrade guide. The procedure was fairly straight forward and I just followed the official documents offered by Gitlab and referred to my earlier upgrade posts for 5.0 -> 5.1 and 5.1 -> 5.2.

1. Backup all of your Gitlab Data first. I ran these commands but ended up with an error. I run other separate backups so I wasn’t concerned. You may have better luck.

[[email protected] ~]# su - sa_gitlab
[[email protected] ~]$ cd ~/gitlab
[[email protected] gitlab]$ RAILS_ENV=production bundle exec rake gitlab:backup:create


2. Switch back to root and install a missing dependency and shutdown Gitlab and then switch back to sa_gitlab

[[email protected] gitlab]$ exit

[[email protected] ~]# yum install python-docutils

[[email protected] ~]# service gitlab stop
# Wait 1-2 minutes for everything to shut down

[[email protected] ~]# su - sa_gitlab


3. Download the latest code

[[email protected] ~]$ cd ~/gitlab
[[email protected] gitlab]$ git fetch
[[email protected] gitlab]$ git stash
[[email protected] gitlab]$ git checkout 6-0-stable


4. Update Gitlab Shell

[[email protected] gitlab]$ cd ~/gitlab-shell/
[[email protected] gitlab-shell]$ git fetch
[[email protected] gitlab-shell]$ git checkout v1.7.0


5. Update Gitlab

[[email protected] ~]$ cd ~/gitlab
[[email protected] gitlab]$ bundle install --without development test postgres --deployment
[[email protected] gitlab]$ bundle exec rake db:migrate RAILS_ENV=production
[[email protected] gitlab]$ bundle exec rake migrate_groups RAILS_ENV=production
# When prompted choose 'Yes'

[[email protected] gitlab]$ bundle exec rake migrate_global_projects RAILS_ENV=production
[[email protected] gitlab]$ bundle exec rake migrate_keys RAILS_ENV=production
# When prompted choose 'Yes'

[[email protected] gitlab]$ bundle exec rake migrate_inline_notes RAILS_ENV=production
[[email protected] gitlab]$ bundle exec rake assets:precompile RAILS_ENV=production


6. Backup your old configuration files

[[email protected] gitlab]$ cd config
[[email protected] config]$ mv gitlab.yml gitlab.yml.54
[[email protected] config]$ mv unicorn.rb unicorn.rb.54


7. Create new configuration files

[[email protected] config]$ cp gitlab.yml.example gitlab.yml
[[email protected] config]$ cp unicorn.rb.example unicorn.rb

# Now move all of your settings from the .54 backups we just made into the new files
# There are a lot of new lines in the unicorn.rb that need to be changed from '/home/git' to '/data/apps/sa_gitlab'
# There is no longer a need to comment out the socket line in unicorn.rb


8. Update the init script

[[email protected] config]$ exit

[[email protected] ~]# cd /etc/init.d/
[[email protected] init.d]# mv gitlab gitlab.54
[[email protected] init.d]# curl --output /etc/init.d/gitlab
[[email protected] init.d]# chmod +x /etc/init.d/gitlab
[[email protected] init.d]# vim gitlab

# -------- Make the following edits --------


# -------- Save and close the file --------


9. Start-up Gitlab 6!

[[email protected] init.d]# service gitlab start

# The start-up took a few minutes on my system


That’s it!