A Comprehensive Guide to Installing and Configuring Harbor
Title: A Comprehensive Guide to Installing and Configuring Harbor
Important info Docker 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.
cd /tmp
- 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 -
- Once downloaded, unpack the Harbor offline installer using the tar command:
tar -xzvf harbor-offline-installer-v2.6.1.tgz
- 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.
cd /opt/harbor
- Copy the Harbor configuration template 'harbor.yml.tmpl' to 'harbor.yml':
cp harbor.yml.tmpl harbor.yml
- Edit the 'harbor.yml' configuration file using the nano editor:
sudo nano harbor.yml
- 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.
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'.
- Ensure your current working directory is '/opt/harbor':
cd /opt/harbor
- 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.
-
Creating Harbor Users:
- Navigate to the 'Users' section under 'Administration' in the Harbor Administration Dashboard.
- Click on 'NEW USER' and provide user details.
-
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.
-
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.