Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save caisback/3f4b37c2cb6885d49396373cb5f8dbe5 to your computer and use it in GitHub Desktop.
Save caisback/3f4b37c2cb6885d49396373cb5f8dbe5 to your computer and use it in GitHub Desktop.
Ubuntu 20.04 LTS - Installing Keycloak 12.0.4

reference

https://www.keycloak.org/getting-started/getting-started-zip

  1. Download the latest released keycloak-12.0.4 as it on our Downloads folder
  2. Extracting Keycloak .tar file
bboy:~$ pwd
/home/bboy
bboy:~$ cd /opt/
bboy:/opt$ sudo tar -xzf /home/bboy/Downloads/keycloak-12.0.4.tar.gz 
  1. Add some needed environmental variables namely;
  2. export JBOSS_HOME=/opt/keycloak-12.0.4
  3. export JAVA=/usr/lib/jvm/adoptopenjdk-8-hotspot-amd64/bin/java
  • Open new terminal window and follow the commands below;
bboy:~$ cd /usr/lib/jvm/
bboy:/usr/lib/jvm$ sudo nano /etc/bash.bashrc
  • Add below entries at end of the file
export JBOSS_HOME=/opt/keycloak-12.0.4
export JAVA=/usr/lib/jvm/adoptopenjdk-8-hotspot-amd64/bin/java
  • Close and save by; Ctrl+X > Y > Enter
  • Apply the changes
      bboy:/usr/lib/jvm$ source /etc/bash.bashrc
  1. Run Keycloak
  bboy:/usr/lib/jvm$ cd /opt/keycloak-12.0.4/
  bboy:/opt/keycloak-12.0.4$ bin/standalone.sh 
  1. Add user to Keycloak (uadmin:upassword1)
bboy:/opt/keycloak-12.0.4$ bin/add-user.sh

What type of user do you wish to add? 
 a) Management User (mgmt-users.properties) 
 b) Application User (application-users.properties)
(a): a

Enter the details of the new user to add.
Using realm 'ManagementRealm' as discovered from the existing property files.
Username : uadmin
Password recommendations are listed below. To modify these restrictions edit the add-user.properties configuration file.
 - The password should be different from the username
 - The password should not be one of the following restricted values {root, admin, administrator}
 - The password should contain at least 8 characters, 1 alphabetic character(s), 1 digit(s), 1 non-alphanumeric symbol(s)
Password : upassword1 
WFLYDM0102: Password should have at least 1 non-alphanumeric symbol.
Are you sure you want to use the password entered yes/no? yes
Re-enter Password : upassword1
What groups do you want this user to belong to? (Please enter a comma separated list, or leave blank for none)[  ]: admin
About to add user 'uadmin' for realm 'ManagementRealm'
Is this correct yes/no? yes
Added user 'uadmin' to file '/opt/keycloak-12.0.4/standalone/configuration/mgmt-users.properties'
Added user 'uadmin' to file '/opt/keycloak-12.0.4/domain/configuration/mgmt-users.properties'
Added user 'uadmin' with groups admin to file '/opt/keycloak-12.0.4/standalone/configuration/mgmt-groups.properties'
Added user 'uadmin' with groups admin to file '/opt/keycloak-12.0.4/domain/configuration/mgmt-groups.properties'
Is this new user going to be used for one AS process to connect to another AS process? 
e.g. for a slave host controller connecting to the master or for a Remoting connection for server to server EJB calls.
yes/no? yes
To represent the user add the following to the server-identities definition <secret value="dXBhc3N3b3JkMQ==" />
bboy:/opt/keycloak-12.0.4$ 
@caisback
Copy link
Author

Installing as default user on /home/<YOUR_USER>/ESB

~$ cd ESB/
~/ESB$ tar -xzf ../Downloads/keycloak-12.0.4.tar.gz

Add user, overwrite if existing

~/ESB$ ./keycloak-12.0.4/bin/add-user.sh 

Running keycloak

~/ESB$ ./keycloak-12.0.4/bin/standalone.sh 

   WARNING:  JBOSS_HOME may be pointing to a different installation - unpredictable results may occur.

             JBOSS_HOME: /opt/keycloak-12.0.4

=========================================================================

  JBoss Bootstrap Environment

  JBOSS_HOME: /opt/keycloak-12.0.4

  JAVA: /usr/lib/jvm/adoptopenjdk-8-hotspot-amd64/bin/java

  JAVA_OPTS:  -server -Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true 

=========================================================================

06:42:33,181 INFO  [org.jboss.modules] (main) JBoss Modules version 1.10.2.Final

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment