GNU/Linux >> Linux Esercitazione >  >> Ubuntu

Come installare JFrog Artifactory su Ubuntu 20.04 LTS

JFrog Artifactory è un'applicazione di gestione del repository open source che può essere integrata con strumenti di integrazione e distribuzione continua. È uno strumento multipiattaforma che consente a DevOps di gestire più repository di pacchetti. Fornisce alta disponibilità e replica multisito per automatizzare la pipeline e consentire rilasci più rapidi.

In questo tutorial, ti mostreremo come installare JFrog Artifactory su Ubuntu 20.04.

Prerequisiti

  • Un server che esegue Ubuntu 20.04.
  • Un nome di dominio valido puntato al tuo server.
  • Sul tuo server è configurata una password di root.

Installa JFrog Artifactory

Per impostazione predefinita, JFrog Artifactory non è disponibile nel repository predefinito di Ubuntu 20.04. Quindi dovrai aggiungere il repository JFrog Artifactory al tuo sistema.

Innanzitutto, installa il pacchetto Gnupg2 con il seguente comando:

apt-get install gnupg2 -y

Quindi, scarica e aggiungi la chiave GPG con il seguente comando:

wget -qO - https://api.bintray.com/orgs/jfrog/keys/gpg/public.key | apt-key add -

Quindi, aggiungi il repository JFrog Artifactory con il seguente comando:

echo "deb https://jfrog.bintray.com/artifactory-debs bionic main" | tee /etc/apt/sources.list.d/jfrog.list

Una volta aggiunto il repository, aggiorna il repository e installa JFrog Artifactory con il seguente comando:

apt-get update -y
apt-get install jfrog-artifactory-oss -y

Una volta che l'installazione è stata completata con successo, dovresti ottenere il seguente output:

************ SUCCESS ****************
The Installation of Artifactory has completed successfully.

NOTE: It is highly recommended to use Artifactory with an external database (MySQL, Oracle, Microsoft SQL Server, PostgreSQL, MariaDB).
      For details about how to configure the database, refer to https://service.jfrog.org/installer/Configuring+the+Database

Start Artifactory with:
> systemctl start artifactory.service

Check Artifactory status with:
> systemctl status artifactory.service


Installation directory was set to /opt/jfrog/artifactory
You can find more information in the log directory /opt/jfrog/artifactory/var/log
System configuration templates can be found under /opt/jfrog/artifactory/var/etc
Copy any configuration you want to modify from the template to /opt/jfrog/artifactory/var/etc/system.yaml

Triggering migration script, this will migrate if needed ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for systemd (245.4-4ubuntu3) ...

Quindi, avvia il servizio Artifactory e abilitalo all'avvio al riavvio del sistema con il seguente comando:

systemctl start artifactory
systemctl enable artifactory

Successivamente, verifica lo stato del servizio Artifactory utilizzando il seguente comando:

systemctl status artifactory

Dovresti ottenere il seguente output:

? artifactory.service - Artifactory service
     Loaded: loaded (/lib/systemd/system/artifactory.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2020-06-07 12:42:39 UTC; 40s ago
    Process: 15671 ExecStart=/opt/jfrog/artifactory/app/bin/artifactoryManage.sh start (code=exited, status=0/SUCCESS)
   Main PID: 17974 (java)
      Tasks: 0 (limit: 9522)
     Memory: 2.4M
     CGroup: /system.slice/artifactory.service
             ? 17974 /opt/jfrog/artifactory/app/third-party/java/bin/java -Djava.util.logging.config.file=/opt/jfrog/artifactory/app/artifacto>

Jun 07 12:42:38 ubuntu2004 su[18380]: (to artifactory) root on none
Jun 07 12:42:38 ubuntu2004 su[18380]: pam_unix(su:session): session opened for user artifactory by (uid=0)
Jun 07 12:42:38 ubuntu2004 su[18380]: pam_unix(su:session): session closed for user artifactory
Jun 07 12:42:38 ubuntu2004 su[18534]: (to artifactory) root on none
Jun 07 12:42:38 ubuntu2004 su[18534]: pam_unix(su:session): session opened for user artifactory by (uid=0)
Jun 07 12:42:39 ubuntu2004 su[18534]: pam_unix(su:session): session closed for user artifactory
Jun 07 12:42:39 ubuntu2004 su[18655]: (to artifactory) root on none
Jun 07 12:42:39 ubuntu2004 su[18655]: pam_unix(su:session): session opened for user artifactory by (uid=0)
Jun 07 12:42:39 ubuntu2004 su[18655]: pam_unix(su:session): session closed for user artifactory
Jun 07 12:42:39 ubuntu2004 systemd[1]: Started Artifactory service.

A questo punto, Artifactory è installato e in ascolto sulla porta 8082. Ora puoi procedere al passaggio successivo.

Configura Nginx come proxy inverso

Successivamente, dovrai configurare Nginx come proxy inverso per JFrog. Innanzitutto, installa il server web Nginx con il seguente comando:

apt-get install nginx -y

Dopo aver installato Nginx, crea un nuovo file di configurazione dell'host virtuale Nginx con il seguente comando:

nano /etc/nginx/sites-available/jfrog.conf

Aggiungi le seguenti righe:

upstream jfrog {
  server 127.0.0.1:8082 weight=100 max_fails=5 fail_timeout=5;
}

server {
  listen          80;
  server_name     jfrog.linuxbuz.com;

  location / {
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://jfrog/;
  }
}

Salva e chiudi il file, quindi attiva l'host virtuale Nginx con il seguente comando:

ln -s /etc/nginx/sites-available/jfrog.conf /etc/nginx/sites-enabled/

Quindi, verifica Nginx per eventuali errori di sintassi con il seguente comando:

nginx -t

Dovresti vedere il seguente output:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Infine, riavvia il servizio Nginx per implementare le modifiche:

systemctl restart nginx

A questo punto, Nginx è configurato per servire il sito JFrog. Ora puoi procedere al passaggio successivo.

Proteggi JFrog con Let's Encrypt SSL

Si consiglia di proteggere JFrog con Let's Encrypt SSL. Innanzitutto, aggiungi il repository Certbot con il seguente comando:

apt-get install software-properties-common -y
add-apt-repository ppa:ahasenack/certbot-tlssni01-1875471

Quindi, aggiorna il repository e installa il client Certbot con il seguente comando:

apt-get update -y
apt-get install certbot python3-certbot-nginx -y

Una volta installato il client Certbot, esegui il seguente comando per scaricare e installare Let's Encrypt SSL per il tuo sito web:

certbot --nginx -d jfrog.linuxbuz.com

Ti verrà chiesto di fornire la tua email valida e di accettare i termini del servizio come mostrato di seguito:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): [email protected]

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for jfrog.linuxbuz.com
Waiting for verification...
Cleaning up challenges
Deploying Certificate to VirtualHost /etc/nginx/sites-enabled/jfrog.conf

Quindi, seleziona se reindirizzare o meno il traffico HTTP su HTTPS:

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2

Digita 2 e premi invio per avviare il processo. Una volta installato il certificato, dovresti vedere il seguente output:

Redirecting all traffic on port 80 to ssl in /etc/nginx/sites-enabled/jfrog.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://jfrog.linuxbuz.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=jfrog.linuxbuz.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/jfrog.linuxbuz.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/jfrog.linuxbuz.com/privkey.pem
   Your cert will expire on 2020-09-07. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the "certonly" option. To non-interactively renew *all* of
   your certificates, run "certbot renew"
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

 - We were unable to subscribe you the EFF mailing list because your
   e-mail address appears to be invalid. You can try again later by
   visiting https://act.eff.org.

Accedi all'interfaccia utente Web di Artifactory

Ora apri il tuo browser web e digita l'URL https://jfrog.linuxbuz.com. Verrai reindirizzato alla seguente pagina:

Fornisci il nome utente predefinito come "amministratore" e la password come "password" e fai clic su Accedi pulsante. Dovresti vedere la seguente pagina:

Ora, fai clic su Ottieni Iniziato pulsante. Dovresti vedere la schermata di reimpostazione della password:

Imposta la nuova password amministratore e fai clic su Avanti pulsante. Dovresti vedere la seguente schermata:

Imposta il tuo URL di base e fai clic su Avanti pulsante. Dovresti vedere la seguente schermata:

Seleziona il repository desiderato e fai clic su Avanti pulsante. Dovresti vedere la pagina seguente:

Ora, fai clic sul pulsante Fine. Dovresti vedere la dashboard di Artifactory nella schermata seguente:

Conclusione

Nella guida sopra, abbiamo imparato come installare JFrog Artifactory su Ubuntu 20.04. Abbiamo anche imparato come proteggere JFrog con Let's Encrypt SSL. Spero che ora tu possa installare facilmente JFrog nell'ambiente di produzione. Sentiti libero di chiedermi se hai domande.


Ubuntu
  1. Come installare Docker su Ubuntu 22.04 / 20.04 LTS

  2. Come installare PlayOnLinux su Ubuntu 20.04 LTS

  3. Come installare MariaDB in Ubuntu 20.04 LTS

  4. Come installare Ansible su Ubuntu 20.04 LTS / 21.04

  5. Come installare Minikube su Ubuntu 20.04 LTS / 21.04

Come installare Ubuntu Server 18.04 LTS

Come installare e configurare JFrog Artifactory su Ubuntu 20.04

Come installare Vai su Ubuntu 22.04 LTS

Come installare Vai su Ubuntu 18.04 LTS

Come installare Vai su Ubuntu 20.04 LTS

Come installare JFrog Artifactory su Ubuntu 20.04 LTS