Rabu, 18 September 2019

Keycloak ubuntu 18.04 OK









Setup Keycloak Server on Ubuntu 18.04







Keycloak Home Page

Step 1 — Install JDK

$ java -version
$ sudo apt-get update$ sudo apt-get install default-jdk -y
$ java -version




Installed Java version







Step 2 — Download and Extract Keycloak Server

$ cd /opt$ sudo wget https://downloads.jboss.org/keycloak/7.0.0/keycloak-6.0.0.tar.gz
$ sudo tar -xvzf keycloak-7.0.0.tar.gz$ sudo mv keycloak-7.0.0 /opt/keycloak






Step 3 — Create User and Group for Keycloak

$ sudo groupadd keycloak$ sudo useradd -r -g keycloak -d /opt/keycloak -s /sbin/nologin keycloak






Step 4 — Change Permission and Ownership of the Keycloak Installation Directory

$ sudo chown -R keycloak: keycloak$ sudo chmod o+x /opt/keycloak/bin/






Step 5 — Creating a SystemD Service File for Keycloak

$ cd /etc/$ sudo mkdir keycloak
$ sudo cp /opt/keycloak/docs/contrib/scripts/systemd/wildfly.conf /etc/keycloak/keycloak.conf
$ sudo cp /opt/keycloak/docs/contrib/scripts/systemd/launch.sh /opt/keycloak/bin/
$ sudo chown keycloak: /opt/keycloak/bin/launch.sh
$ sudo nano /opt/keycloak/bin/launch.sh




launch.sh script


$ sudo cp /opt/keycloak/docs/contrib/scripts/systemd/wildfly.service /etc/systemd/system/keycloak.service
$ sudo nano /etc/systemd/system/keycloak.service
[Unit]
Description=The Keycloak Server
After=syslog.target network.target
Before=httpd.service[Service]
Environment=LAUNCH_JBOSS_IN_BACKGROUND=1
EnvironmentFile=/etc/keycloak/keycloak.conf
User=keycloak
Group=keycloakLimitNOFILE=102642
PIDFile=/var/run/keycloak/keycloak.pid
ExecStart=/opt/keycloak/bin/launch.sh $WILDFLY_MODE $WILDFLY_CONFIG $WILDFLY_BIND
StandardOutput=null[Install]
WantedBy=multi-user.target
$ sudo systemctl daemon-reload$ sudo systemctl enable keycloak
$ sudo systemctl start keycloak
$ sudo systemctl status keycloak




Keycloak system service status
$ sudo tail -f /opt/keycloak/standalone/log/server.log




Keycloak server logs










Step 6 — Create the Initial Administrator User





Create Initial Admin Account
$ sudo /opt/keycloak/bin/add-user-keycloak.sh -r master -u root -p rootme123
$ sudo systemctl restart keycloak










Step 7 — Disable SSL on Master Realm And Login to Admin Console





HTTPS required error page
$ sudo /opt/keycloak/bin/kcadm.sh config credentials --server http://localhost:8080/auth --realm master --user <admin-username> 
–-password <admin-password>
$ sudo /opt/keycloak/bin/kcadm.sh update realms/master -s sslRequired=NONE




Keycloak admin login










Step 8 — Configure Keycloak Management Console

$ sudo nano /etc/keycloak/keycloak.conf




keycloak.conf

$ sudo nano /opt/keycloak/launch.sh




launch.sh

$ sudo nano /etc/systemd/system/keycloak.service




keycloak.service

$ sudo systemctl daemon-reload
$ sudo systemctl restart keycloak




Keycloak Management Console
$ sudo /opt/keycloak/bin/add-user.sh




add-user.sh script

$ sudo systemctl restart keycloak




Keycloak admin console HTTP basic authorization




Keycloak Management Conole






Some helpful resources:


Tidak ada komentar:

Posting Komentar