Install Harbor in Ubuntu



Install Harbor in Ubuntu

Install Harbor in Ubuntu

Harbor is an open source trusted cloud native registry project that stores, signs, and scans content. Harbor extends the open source Docker Distribution by adding the functionalities usually required by users such as security, identity and management.

Here are the steps outline in my video. I have also added step to debug and ensure that the installation goes successfully.

A) Prerequisites installation
sudo su
apt update && sudo apt -y full-upgrade
apt install apt-transport-https ca-certificates curl software-properties-common

B) Install Docker
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg –dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo “deb [arch=$(dpkg –print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable” | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
apt update
apt upgrade -y
apt-cache policy docker-ce

apt install docker-ce -y
systemctl status docker
OPTIONAL: If docker is not started
sudo systemctl start docker && sudo systemctl enable docker
Add your system use to the Docker Group.
usermod -aG docker $USER
newgrp docker

Check if a reboot is required after system upgrade.
[ -f /var/run/reboot-required ] && sudo reboot -f

Check versions
docker version
docker compose version
OPTIONAL: If docker-compse is not avaiable
curl -s https://api.github.com/repos/docker/compose/releases/latest|grep browser_download_url|grep docker-compose-linux-x86_64 | cut -d ‘”‘ -f 4|wget -qi –
chmod +x docker-compose-linux-x86_64
sudo mv docker-compose-linux-x86_64 /usr/local/bin/docker-compose
rm docker-compose-linux-x86_64.sha256

Make sure docker-compose still works
docker compose version

C) Download Harbor Installer
Download Harbor installer
curl -s https://api.github.com/repos/goharbor/harbor/releases/latest | grep browser_download_url | cut -d ‘”‘ -f 4 | grep ‘.tgz$’ | wget -i –
tar zxvf harbor-offline-installer-v*.tgz
cd harbor
ls -al

D) Configure Harbor
Let’s Encrypt
sudo apt install certbot -y
sudo certbot certonly –standalone -d “harbor.xybernetics.com” –preferred-challenges http –agree-tos -n -m “[email protected]” –keep-until-expiring
After this, you will have certificates at /etc/letsencrypt/live/harbor.xybernetics.com/

Self signed certificate
mkdir -p certs
openssl req
-newkey rsa:4096 -nodes -sha256 -keyout certs/harbor.key
-addext “subjectAltName = DNS:harbor.xybernetics.com”
-x509 -days 365 -out certs/harbor.crt

sudo cp certs/harbor.* /etc/ssl/certs/

nano harbor.yml.tmpl
Change these parameters
– “hostname”
– “harbor_admin_password”
– “database” paramters.
– https
* Comment out https if you are not using it.
* If you are using https, this is what it should look like.
https:
# https port for harbor, default is 443
port: 443
# The path of cert and key files for nginx
certificate: /etc/ssl/certs/harbor.crt
private_key: /etc/ssl/certs/harbor.key

Save as this filename (drop the .tmpl)
harbor.yml

Verify configurations
cat harbor.yml

E) Install Harbor
docker image ls
docker container ls
./install.sh
docker image ls
docker container ls

F) Test Harbor web access
http://IP_ADDRESS
OR
https://IP_ADDRESS

Default credentials
Username: admin
Password: Harbour12345

#docker #harbor #ubuntu