How to Install Harbor on CentOS 7


  • You must have Alibaba Cloud Elastic Compute Service (ECS) activated and verified your valid payment method. If you are a new user, you can get a free account in your Alibaba Cloud account. If you don’t know about how to setup your ECS instance, you can refer to this tutorial or quick-start guide. Your ECS instance must have at least 1GB RAM and 1 Core processor.
  • A domain name registered from Alibaba Cloud. If you have already registered a domain from Alibaba Cloud or any other host, you can update its domain nameserver records.
  • Domain name must be pointed to your Alibaba Cloud ECS’s IP address
  • Server’s hostname is set up.
  • Access to VNC console in your Alibaba Cloud or SSH client installed in your PC

Setting Up Your Alibaba Cloud ECS Instance

Add a User with Root Privileges

In the first step, you will add a new user and give it sudo privileges. Sudo privileges will allow this username to make administrative changes on system when required. This user will be used to login from via SSH for everyday use. Once you have added this user, to keep your server secure from various attacks, you will disable the remote root access to root user.

#  adduser aareez
#  passwd aareez
#  visudo
#  usermod -aG wheel aareez
#  groups aareez
#  su - aareez
#  whoami

Install wget

You will need to install wget to download files from URL. Execute the following command:

#  sudo yum install wget

Install nano-editor

You will need to install nano edit files. Execute the following command:

#  sudo yum install nano

Install epel-release

You will need to install epel-release to import epel repository. Execute the following command:

#  sudo yum install epel-release

Update Your CentOS 7 System

Before proceeding with installation of any kind of package, use the following command to update your CentOS system. To execute this command, remember to login from non-root user with sudo privileges.

#  sudo yum clean all
#  sudo yum -y update

Install yum-utils

You will need to install yum-utils to import yum utils.

#  sudo yum install yum-utils

Installing Docker CE and Docker Compose

Install Docker CE

To install Docker ce and Docker compose, I recommend you to login as root user.

#  su - root
#  yum-config-manager --add-repo
#  yum install docker-ce

Install python-pip

You will also need to install python-pip. Execute the following command:

#  yum install python-pip

Install Docker Compose

You will need to install docker-compose. Execute the following command to get latest version of docker-compose.

#  pip install docker-compose
#  systemctl start docker
#  docker run hello-world

Installing Harbor

Before installing Harbor, switch to your own user with sudo rights. In my case, username is aareez, replace it with your username in the following command.

#  su - aareez
#  wget
#  wget
#  tar -xvf harbor-online-installer-v1.2.0.tgz
#  tar -xvf harbor-offline-installer-v1.2.0.tgz

Generate SSL Certificate

I recommend generating an SSL certificate for your Harbor instance; otherwise, it will use http by default and you will need to add — insecure-registry to your client’s Docker daemon.

#  mkdir cert && cd cert 
# openssl req -sha256 -x509 -days 365 -nodes -newkey rsa:4096 -keyout -out

Configuring Harbor

Switch to your own created user with sudo rights. In my case, username is aareez.

#  su - aareez
#  cd harbor
#  sudo nano harbor.cfg
hostname =
ui_url_protocol = https
ssl_cert = /root/cert/
ssl_cert_key = /root/cert/
#  sudo ./
#  sudo docker-compose up -d



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website: