Skip to main content

A Comprehensive Guide to Installing and Configuring Harbor

Title: A Comprehensive Guide to Installing and Configuring Harbor


Important info Docker CE should be installed beforehand

Chapter 1: Downloading the Harbor Installation Package

Before installing Harbor, you need to download the Harbor installer package. There are two types of Harbor installation packages: offline and online.

In this guide, we'll use the offline installer for Harbor installation. Follow the steps below to download the Harbor offline installer to your system.

  1. Navigate to the working directory to download the Harbor offline installer:
cd /tmp
  1. Use the following curl command to download the Harbor offline installer:
curl -s https://api.github.com/repos/goharbor/harbor/releases/latest | grep browser_download_url | cut -d '"' -f 4 | grep '\.tgz$' | wget -i -
  1. Once downloaded, unpack the Harbor offline installer using the tar command:
tar -xzvf harbor-offline-installer-v2.6.1.tgz
#change v2.6.1 if not its not the version you downloaded it
  1. Move the 'harbor' directory to '/opt', so your Harbor installation directory becomes '/opt/harbor':
sudo mv harbor /opt/

Chapter 2: Configuring Harbor Installation

After downloading the Harbor offline installer, configure the Harbor installation using the 'harbor.yml' configuration file included in the Harbor package.

  1. Navigate to the Harbor installation directory '/opt/harbor':
cd /opt/harbor
  1. Copy the Harbor configuration template 'harbor.yml.tmpl' to 'harbor.yml':
cp harbor.yml.tmpl harbor.yml
  1. Edit the 'harbor.yml' configuration file using the nano editor:
sudo nano harbor.yml
  1. Modify the detailed configurations as follows:
  • hostname: Set the domain name for the Harbor installation.
  • https: Configure HTTPS settings.
  • harbor_admin_password: Set the initial password for Harbor admin.
  • database: Configure Harbor database settings.

Save the file and exit the editor when finished.

For more detailed information about the YAML configuration options, refer to the Harbor documentation here.

Chapter 3: Installing Harbor using Installer Script and Docker Compose

Once the Harbor offline installer is downloaded and the 'harbor.yml' configuration file is configured, you can start the Harbor installation using the 'install.sh' installer script available in the Harbor installation directory '/opt/harbor'.

  1. Ensure your current working directory is '/opt/harbor':
cd /opt/harbor
  1. Execute the Harbor installation script 'install.sh' with sudo privileges:
sudo ./install.sh

The installation script checks system requirements and proceeds with Harbor installation. It ensures Docker Engine and Docker Compose are installed on the system.

After the installation, verify Harbor by checking the container services and accessing the Harbor image registry via a web browser.

Chapter 4: Managing Harbor Image Registry

Learn basic management of the Harbor Image Registry, including adding users, setting up projects, logging in via Docker CLI, and uploading images to Harbor.

  1. Creating Harbor Users:

    • Navigate to the 'Users' section under 'Administration' in the Harbor Administration Dashboard.
    • Click on 'NEW USER' and provide user details.
  2. Adding User to Harbor Project:

    • Go to the 'Projects' section and select the desired project.
    • Click on 'Members' and then 'USERS' to add users to the project.
  3. Logging in to Harbor via Docker Client:

    • Use the Docker CLI to log in to the Harbor image registry.
    • Execute the command:
      docker login https://repo.j551n.com/
      
    • Enter your username and password when prompted.

After successfully logging in, you can interact with Harbor via Docker CLI, including pushing and pulling images.

This guide provides a comprehensive overview of downloading, configuring, installing, and managing Harbor for your containerized environment.