# Installation and Configuration Guide There are two possibilities when installing Harbor. - **Online installer:** The online installer downloads the Harbor images from Docker hub. For this reason, the installer is very small in size. - **Offline installer:** Use the offline installer if the host to which are are deploying Harbor does not have a connection to the Internet. The offline installer contains pre-built images so it is larger than the online installer. You download the installers from the **[official release](https://github.com/goharbor/harbor/releases)** page. This guide describes how to install and configure Harbor by using either the online or offline installer. The installation processes are almost the same. If you are upgrading from a previous version of Harbor, you might need to update the configuration file and migrate your data to fit the database schema of the later version. For information about upgrading, see the **[Harbor Upgrade and Migration Guide](migration_guide.md)**. In addition, the Harbor community created instructions describing how to deploy Harbor on Kubernetes. If you want to deploy Harbor to Kubernetes, see [Harbor on Kubernetes](kubernetes_deployment.md). ## Harbor Components The table below lists the components that are deployed when you deploy Harbor. |Component|Version| |---|---| |Postgresql|9.6.10-1.ph2| |Redis|4.0.10-1.ph2| |Clair|2.0.8| |Beego|1.9.0| |Chartmuseum|0.9.0| |Docker/distribution|2.7.1| |Docker/notary|0.6.1| |Helm|2.9.1| |Swagger-ui|3.22.1| ## Deployment Prerequisites for the Target Host Harbor is deployed as several Docker containers. You can therefore deploy it on any Linux distribution that supports Docker. The target host requires Docker, and Docker Compose to be installed. ### Hardware The following table lists the minimum and recommended hardware configurations for deploying Harbor. |Resource|Minimum|Recommended| |---|---|---| |CPU|2 CPU|4 CPU| |Mem|4 GB|8 GB| |Disk|40 GB|160 GB| ### Software The following table lists the software versions that must be installed on the target host. |Software|Version|Description| |---|---|---| |Docker engine|version 17.06.0-ce+ or higher|For installation instructions, see [docker engine doc](https://docs.docker.com/engine/installation/)| |Docker Compose|version 1.18.0 or higher|For installation instructions, see [docker compose doc](https://docs.docker.com/compose/install/)| |Openssl|latest is preferred|Used to generate certificate and keys for Harbor| ### Network ports Harbor requires that the following ports be open on the target host. |Port|Protocol|Description| |---|---|---| |443|HTTPS|Harbor portal and core API accept HTTPS requests on this port. You can change this port in the configuration file.| |4443|HTTPS|Connections to the Docker Content Trust service for Harbor. Only required if Notary is enabled. You can change this port in the configuration file.| |80|HTTP|Harbor portal and core API accept HTTP requests on this port. You can change this port in the configuration file.| ## Installation Procedure The installation procedure involves the following steps: 1. Download the installer. 2. Configure the **harbor.yml** file. 3. Run the **install.sh** script with the appropriate options to install and start Harbor. ## Download the Installer 1. Go to the [Harbor releases page](https://github.com/goharbor/harbor/releases). 1. Select either the online or offline installer for the version you want to install. 1. Use `tar` to extract the installer package: - Online installer:
bash $ tar xvf harbor-online-installer-version.tgz- Offline installer:
bash $ tar xvf harbor-offline-installer-version.tgz## Configure Harbor You set system level parameters for Harbor in the `harbor.yml` file that is contained in the installer package. These parameters take effect when you run the `install.sh` script to install or reconfigure Harbor. After the initial deployment and after you have started Harbor, you perform additional configuration in the Harbor Web Portal. ### Required Parameters The table below lists the parameters that must be set when you deploy Harbor. By default, all of the required parameters are uncommented in the `harbor.yml` file. The optional parameters are commented with `#`. You do not necessarily need to change the values of the required parameters from the defaults that are provided, but these parameters must remain uncommented. At the very least, you must update the `hostname` parameter. **IMPORTANT**: Harbor does not ship with any certificates. In versions up to and including 1.9.x, by default Harbor uses HTTP to serve registry requests. This is acceptable only in air-gapped test or development environments. In production environments, always use HTTPS. If you enable Content Trust with Notary to properly sign all images, you must use HTTPS. You can use certificates that are signed by a trusted third-party CA, or you can use self-signed certificates. For information about how to create a CA, and how to use a CA to sign a server certificate and a client certificate, see **[Configuring Harbor with HTTPS Access](configure_https.md)**.
Parameter | Sub-parameters | Description and Additional Parameters |
---|---|---|
hostname |
None | Specify the IP address or the fully qualified domain name (FQDN) of the target host on which to deploy Harbor. This is the address at which you access the Harbor Portal and the registry service. For example, 192.168.1.10 or reg.yourdomain.com . The registry service must be accessible to external clients, so do not specify localhost , 127.0.0.1 , or 0.0.0.0 as the hostname. |
https |
Use HTTPS to access the Harbor Portal and the token/notification service. Always use HTTPS in production environments and environments that are not air-gapped. |
|
port |
The port number for HTTPS. The default is 443. | |
certificate |
The path to the SSL certificate. | |
private_key |
The path to the SSL key. | |
harbor_admin_password |
None | Set an initial password for the Harbor administrator. This password is only used on the first time that Harbor starts. On subsequent logins, this setting is ignored and the administrator's password is set in the Harbor Portal. The default username and password are admin and Harbor12345 . |
database |
Use a local PostgreSQL database. You can optionally configure an external database, in which case you can disable this option. | |
password |
Set the root password for the local database. You must change this password for production deployments. | |
max_idle_conns |
The maximum number of connections in the idle connection pool. If set to <=0 no idle connections are retained. The default value is 50. If it is not configured the value is 2. | |
max_open_conns |
The maximum number of open connections to the database. If <= 0 there is no limit on the number of open connections. The default value is 100 for the max connections to the Harbor database. If it is not configured the value is 0. | |
data_volume |
None | The location on the target host in which to store Harbor's data. You can optionally configure external storage, in which case disable this option and enable storage_service . The default is /data . |
clair |
updaters_interval |
Set an interval for Clair updates, in hours. Set to 0 to disable the updates. The default is 12 hours. |
jobservice |
max_job_workers |
The maximum number of replication workers in the job service. For each image replication job, a worker synchronizes all tags of a repository to the remote destination. Increasing this number allows more concurrent replication jobs in the system. However, since each worker consumes a certain amount of network/CPU/IO resources, set the value of this attribute based on the hardware resource of the host. The default is 10. |
notification |
webhook_job_max_retry |
Set the maximum number of retries for web hook jobs. The default is 10. |
chart |
absolute_url |
Set to enabled for Chart to use an absolute URL. Set to disabled for Chart to use a relative URL. |
log |
Configure logging. | |
level |
Set the logging level to debug , info , warning , error , or fatal . The default is info . |
|
local |
Set the log retention parameters:
|
|
external_endpoint |
Enable this option to forward logs to a syslog server.
|
|
proxy |
Configure proxies to be used by Clair, the replication jobservice, and Harbor. Leave blank if no proxies are required. | |
http_proxy |
Configure an HTTP proxy, for example, http://my.proxy.com:3128 . |
|
https_proxy |
Configure an HTTPS proxy, for example, http://my.proxy.com:3128 . |
|
no_proxy |
Configure when not to use a proxy, for example, 127.0.0.1,localhost,core,registry . |
Parameter | Sub-Parameters | Description and Additional Parameters |
---|---|---|
http |
Do not use HTTP in production environments. Using HTTP is acceptable only in air-gapped test or development environments that do not have a connection to the external internet. Using HTTP in environments that are not air-gapped exposes you to man-in-the-middle attacks. | |
port |
Port number for HTTP | |
external_url |
None | Enable this option to use an external proxy. When enabled, the hostname is no longer used. |
storage_service |
By default, Harbor stores images and charts on your local filesystem. In a production environment, you might want to use another storage backend instead of the local filesystem. The parameters listed below are the configurations for the registry. See *Configuring Storage Backend* below for more information about how to configure a different backend. | |
ca_bundle |
The path to the custom root CA certificate, which is injected into the trust store of registry and chart repository containers. This is usually needed if internal storage uses a self signed certificate. | |
filesystem |
The default is filesystem , but you can set azure , gcs , s3 , swift and oss . For information about how to configure other backends, see Configuring a Storage Backend below. Set maxthreads to limit the number of threads to the external provider. The default is 100. |
|
redirect |
Set disable to true when you want to disable registry redirect |
|
external_database |
Configure external database settings, if you disable the local database option. Harbor currently only supports POSTGRES. | |
harbor |
Configure an external database for Harbor data.
|
|
clair |
Configure an external database for Clair.
|
|
notary_signer |
Configure an external database for the Notary signer database
|
|
notary_server |
|
|
external_redis |
Configure an external Redis instance. | |
host |
Hostname of the external Redis instance. | |
port |
Redis instance port. | |
password |
Password to connect to the external Redis instance. | |
registry_db_index |
Database index for Harbor registry. | |
jobservice_db_index |
Database index for jobservice. | |
chartmuseum_db_index |
Database index for Chart museum. | |
uaa |
Enable UAA to trust the certificate of a UAA instance that is hosted via a self-signed certificate. | |
ca_file |
The path to the self-signed certificate of the UAA instance, for example /path/to/ca . |