Created
July 27, 2025 11:27
-
-
Save devops-school/e595862da9915c14ea7dc5a61d8d89c9 to your computer and use it in GitHub Desktop.
How to install Jfrog Artifactory Automated Installation Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# === Variables === | |
DB_NAME="artifactory" | |
DB_USER="artifactory" | |
DB_PASS="StrongPassword123!" | |
ARTIFACTORY_VERSION="7.117.7" | |
echo "=== JFrog Artifactory $ARTIFACTORY_VERSION Installation Started ===" | |
# === Install Required Packages === | |
if [ -f /etc/redhat-release ]; then | |
echo "Detected RHEL/CentOS" | |
sudo yum install -y wget postgresql-server postgresql-contrib | |
sudo postgresql-setup initdb | |
sudo systemctl enable postgresql | |
sudo systemctl start postgresql | |
elif [ -f /etc/debian_version ]; then | |
echo "Detected Ubuntu/Debian" | |
sudo apt update | |
sudo apt install -y wget postgresql postgresql-contrib | |
sudo systemctl enable postgresql | |
sudo systemctl start postgresql | |
else | |
echo "Unsupported OS" | |
exit 1 | |
fi | |
# === Configure PostgreSQL === | |
echo "Configuring PostgreSQL..." | |
sudo -u postgres psql <<EOF | |
CREATE DATABASE $DB_NAME WITH ENCODING UTF8; | |
CREATE USER $DB_USER WITH PASSWORD '$DB_PASS'; | |
GRANT ALL PRIVILEGES ON DATABASE $DB_NAME TO $DB_USER; | |
EOF | |
# === Download Artifactory === | |
if [ -f /etc/redhat-release ]; then | |
wget -O jfrog-artifactory-pro.rpm "https://releases.jfrog.io/artifactory/artifactory-pro/rpm/jfrog-artifactory-pro-$ARTIFACTORY_VERSION.rpm" | |
sudo yum install -y ./jfrog-artifactory-pro.rpm | |
elif [ -f /etc/debian_version ]; then | |
wget -O jfrog-artifactory-pro.deb "https://releases.jfrog.io/artifactory/artifactory-pro/deb/jfrog-artifactory-pro-$ARTIFACTORY_VERSION.deb" | |
sudo apt install -y ./jfrog-artifactory-pro.deb | |
fi | |
# === Configure system.yaml === | |
echo "Configuring Artifactory to use PostgreSQL..." | |
sudo mkdir -p /opt/jfrog/artifactory/var/etc/ | |
sudo tee /opt/jfrog/artifactory/var/etc/system.yaml > /dev/null <<EOL | |
shared: | |
database: | |
type: postgresql | |
driver: org.postgresql.Driver | |
url: jdbc:postgresql://localhost:5432/$DB_NAME | |
username: $DB_USER | |
password: $DB_PASS | |
EOL | |
# === Start Artifactory === | |
sudo systemctl enable artifactory | |
sudo systemctl start artifactory | |
echo "=== Installation Completed ===" | |
echo "Access Artifactory at: http://<your-server-ip>:8082" | |
echo "Default Admin User: admin" | |
echo "Default Password: password (change on first login)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment