How to Install GitLab on Fedora Server Latest
GitLab is a web-based Git repository management tool that offers features such as git repository hosting, issue tracking, code reviewing, and continuous integration. This tutorial will guide you through the installation of GitLab on a Fedora server.
Prerequisites
Before we start with the installation process, ensure that your system meets the following prerequisites:
- A user account with sudo privileges.
- A running Fedora server with internet connectivity.
- At least 4 GB RAM and 2 CPU cores.
Step 1 - Update System Packages
Ensure that your system is up-to-date by running the following command:
sudo dnf update
Step 2 - Install Dependencies
To install GitLab, you need to ensure that the following dependencies are installed on your system:
- curl
- policycoreutils-python-utils
- postfix
- openssh-server
- openssh-clients
You can install these dependencies by running the following command:
sudo dnf install -y curl policycoreutils-python-utils postfix openssh-server openssh-clients
Step 3 - Install GitLab
There are two ways to install GitLab on your Fedora server: using the Omnibus package or from source.
Install GitLab Using the Omnibus Package
If you want to install GitLab using the Omnibus package, follow these steps:
- Add the GitLab package repository to your system:
sudo curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
- Install the GitLab package:
sudo dnf install -y gitlab-ce
- After installing GitLab, run the following command to configure SELinux:
sudo semanage port -a -t http_port_t -p tcp 80
sudo semanage port -a -t http_port_t -p tcp 443
Install GitLab From Source
If you want to install GitLab from source, follow these steps:
- Install the required packages:
sudo dnf install -y git-core zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python3-certifi
- Clone the GitLab repository:
sudo su - git
cd /home/git
git clone https://gitlab.com/gitlab-org/gitlab-ce.git -b 13-1-stable gitlab
- Install the required gems:
cd /home/git/gitlab
gem install bundler
su - git -c "bundle install --deployment --without development test mysql aws kerberos"
- Create a configuration file by copying the example configuration file:
cd /home/git/gitlab
sudo -u git cp config/gitlab.yml.example config/gitlab.yml
- Initialize the database and activate GitLab:
sudo -u git cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb
sudo -u git cp config/resque.yml.example config/resque.yml
sudo -u git cp config/puma.rb.example config/puma.rb
sudo -u git chmod 0600 config/secrets.yml
sudo -u git cp config/secrets.yml.example config/secrets.yml
sudo -u git chmod 0600 config/database.yml
sudo -u git cp config/database.yml.postgresql config/database.yml
sudo -u git sed -i "s/username:.*/username: gitlab/" config/database.yml
su - git -c "bundle exec rake gitlab:setup RAILS_ENV=production"
sudo -u git bundle exec rake gitlab:setup RAILS_ENV=production
6. Start GitLab:
sudo systemctl start gitlab-runsvdir.service
## Step 4 - Configure GitLab
Open your web browser and go to `http://fqdn` where `fqdn` is your server's fully qualified domain name. You will be prompted to set up the admin account and password for GitLab.
After setting up the admin account, you can start using GitLab.
Congratulations! You have successfully installed GitLab on your Fedora server.