Overview
Component | Description |
---|---|
OS | Ubuntu Server 24.04 |
Artifactory OSS | Installed via official APT repo |
Database | PostgreSQL 16 (from PGDG repo) |
JDBC Driver | PostgreSQL 42.7.5 |
DB Connection | TCP (127.0.0.1:5432 ) |
- Install PostgreSQL 16
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo gpg --dearmor -o /usr/share/keyrings/postgresql.gpg
echo "deb [signed-by=/usr/share/keyrings/postgresql.gpg] http://apt.postgresql.org/pub/repos/apt noble-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
sudo apt update
sudo apt install -y postgresql-16
- Set Up PostgreSQL for Artifactory
sudo su - postgresql
psql
CREATE USER artifactory WITH PASSWORD 'StrongPassw0rd!';
CREATE DATABASE artifactory WITH OWNER=artifactory ENCODING='UTF8';
GRANT ALL PRIVILEGES ON DATABASE artifactory TO artifactory;
\q
- Install Artifactory OSS via APT
wget -qO - https://releases.jfrog.io/artifactory/api/gpg/key/public | sudo gpg --dearmor -o /usr/share/keyrings/jfrog.gpg
echo "deb [signed-by=/usr/share/keyrings/jfrog.gpg] https://releases.jfrog.io/artifactory/artifactory-debs noble main" | sudo tee /etc/apt/sources.list.d/jfrog.list
sudo apt update
sudo apt install -y jfrog-artifactory-oss
- Configure Artifactory to Use PostgreSQL
sudo vi /opt/jfrog/artifactory/var/etc/system.yaml
shared:
database:
type: postgresql
driver: org.postgresql.Driver
url: "jdbc:postgresql://localhost:5432/artifactory"
username: artifactory
password: StrongPassw0rd!
- Install PostgreSQL JDBC Driver
cd /opt/jfrog/artifactory/var/bootstrap/artifactory/tomcat/lib
sudo curl -LO https://jdbc.postgresql.org/download/postgresql-42.7.5.jar
- Start and Enable Artifactory
sudo systemctl enable artifactory
sudo systemctl restart artifactory
- Install NGINX and Certbot
sudo apt update
sudo apt install certbot python3-certbot-nginx nginx
- Create Initial NGINX Config (HTTP Redirect for Certbot)
sudo nano /etc/nginx/sites-available/artifactory
server {
listen 80;
server_name artifactory.maksonlee.com;
location ^~ /.well-known/acme-challenge/ {
root /var/www/html;
}
return 301 https://$host$request_uri;
}
Enable the config and reload NGINX:
sudo ln -s /etc/nginx/sites-available/artifactory /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
- Request and Install SSL Certificate
sudo certbot --nginx -d artifactory.maksonlee.com
Certbot will:
- Use the HTTP block to validate the domain
- Add
listen 443 ssl;
server block with SSL config
- Update the HTTPS Block for Reverse Proxy to Artifactory
Edit the same config again:
sudo nano /etc/nginx/sites-available/artifactory
Within the server
block that listens on port 443 (HTTPS), replace the existing location /
block with the following:
location / {
proxy_pass http://localhost:8082;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
}
After making these changes, test the NGINX configuration for syntax errors:
sudo nginx -t
If the test is successful, reload NGINX to apply the changes:
sudo systemctl reload nginx
- Set Custom Base URL in Artifactory
- Log in to Artifactory.
- Navigate to:
Admin > Configuration > General
. - Set the Custom Base URL to
https://artifactory.example.com
. - Save the changes.
This ensures that Artifactory generates correct URLs when behind a reverse proxy.