Download Keycloak v25.0.5 on GitHub.
https://github.com/keycloak/keycloak/releases/tag/25.0.5
Keycloak Configuration
# Basic settings for running in production. Change accordingly before deploying the server.
# Database
# The database vendor.
db=postgres
# The username of the database user.
db-username=postgres
# The password of the database user.
db-password=PswdPswdPswd1$9$4$5$
# The full database JDBC URL. If not provided, a default URL is set based on the selected database vendor.
db-url=jdbc:postgresql://localhost:6002/db_keycloak
# Observability
# If the server should expose healthcheck endpoints.
health-enabled=false
# If the server should expose metrics endpoints.
metrics-enabled=false
# HTTP
http-port=8081
# The file path to a server certificate or certificate chain in PEM format.
#https-certificate-file=${kc.home.dir}conf/server.crt.pem
# The file path to a private key in PEM format.
#https-certificate-key-file=${kc.home.dir}conf/server.key.pem
# The proxy address forwarding mode if the server is behind a reverse proxy.
# proxy=reencrypt
proxy=edge
# Do not attach route to cookies and rely on the session affinity capabilities from reverse proxy
# spi-sticky-session-encoder-infinispan-should-attach-route=false
# Hostname for the Keycloak server.
hostname=your_ip_public
Init User Admin
$ sudo ./kcadm.sh config credentials --server http://localhost:8081 --realm master --user admin
Disabled SSL Requirement
$ sudo ./kcadm.sh update realms/master -s sslRequired=NONE
Run Keycloak Production
$ sudo ./kc.sh start --http-enabled=true --http-port=8081 --proxy=edge --proxy-headers=forwarded --hostname-strict=false
Install Keycloak as Service on Linux
$ cd /etc/systemd/system
$ sudo touch keycloak.service
$ sudo nano keycloak.service
[Unit]
Description=The Keycloak Server
After=syslog.target network.target
[Service]
Environment=LAUNCH_JBOSS_IN_BACKGROUND=1
EnvironmentFile=/opt/keycloak/conf/keycloak.conf
User=root
Group=root
LimitNOFILE=102642
ExecStart=/opt/keycloak/bin/kc.sh start --http-enabled=true --http-port=8081 --proxy=edge --proxy-headers=forwarded --hostname-strict=false
StandardOutput=null
[Install]
WantedBy=multi-user.target
Reload Daemon Service System
$ sudo systemctl daemon-reload
Enable Keycloak as Service
$ sudo systemctl enable keycloak
Start Keycloak
$ sudo systemctl start keycloak
Stop Keycloak
$ sudo systemctl stop keycloak
Source :
https://www.google.com/search?q=keycloak+kcadm+config+credentials+realm+master+user+admin
https://github.com/keycloak/keycloak/issues/30866
https://stackoverflow.com/questions/44521735/keycloak-admin-cli-unable-to-authenticate
https://stackoverflow.com/questions/38337895/globally-disable-https-keycloak
https://author-adarshtripathi1998.medium.com/how-can-i-install-keycloak-as-a-service-3fc8b423a9f4

Comments
Post a Comment