Here's a complete summary of the readme file:
This guide covers installing and configuring Keycloak 26.1.1 with Let's Encrypt SSL on Ubuntu 22.04.
Before running the installation script, you MUST replace:
YOUR_DOMAIN
with YOUR domainYOUR_EMAIL
with YOUR emailCLOUDFLARE_API_TOKEN
with YOUR Cloudflare API tokenyour_secure_password
with YOUR strong database password
The installation script automates:
- System updates and required dependencies installation
- Keycloak 26.1.1 download and setup
- PostgreSQL database configuration
- Nginx as a reverse proxy with Let's Encrypt SSL
- Cloudflare DNS verification for SSL
- UFW firewall configuration
- Systemd service for Keycloak
- Ubuntu 22.04 LTS server
- A user with sudo privileges
- Domain pointed to your server
- Cloudflare DNS account with the domain added
- Download the installation script to your server
- Modify the script to update domain name, database password, email address, and Cloudflare API token
- To generate a Cloudflare API token:
- Log in to your Cloudflare account
- Go to My Profile > API Tokens
- Create a token with Zone:DNS:Edit permissions for your specific domain
- To generate a Cloudflare API token:
- Make the script executable:
chmod +x keycloak_install.sh
- Run the script:
./keycloak_install.sh
By default, Keycloak doesn't create an initial admin user. To create the first admin user:
sudo -u keycloak /opt/keycloak/bin/kc.sh bootstrap-admin user
This command creates a temporary admin user and displays the credentials in the console. Use these credentials to log in to the Keycloak Admin Console at https://your-domain/admin/ and then create permanent admin users.
- CRITICAL: After installation, remove the Cloudflare API token from
/etc/letsencrypt/cloudflare/credentials.ini
- Verify you've properly replaced the default database password in
/opt/keycloak/conf/keycloak.conf
- Consider disabling HTTP once HTTPS is working correctly
- Review all configuration files to ensure no default values remain
- Keycloak configuration:
/opt/keycloak/conf/keycloak.conf
- Nginx site configuration:
/etc/nginx/sites-available/keycloak
- Systemd service:
/etc/systemd/system/keycloak.service
- Cloudflare credentials:
/etc/letsencrypt/cloudflare/credentials.ini
Check service status:
sudo systemctl status keycloak
View logs:
sudo journalctl -u keycloak
Verify Nginx configuration:
sudo nginx -t
Check if ports are open:
sudo ufw status
For future upgrades, download the new version and follow a similar installation process, ensuring to back up your configuration and database first.