CSM Lab 7
CSM Lab 7
CSM Lab 7
Batch: B7 (CCVT)
SAP-ID: 500096747
Roll- R2142211428
Experiment -7
Keycloak
Experiment
a) Installing and configuring keycloak
Prerequisites
• JDK 17 and Above
Step 1) Go to keycloak website and download keycloak.
Step 2) Extract the keycloak zip file and go inside the keycloak extracted folder and type
CMD on the above address bar to open the folder in CMD.
Step 3) Generate t a key pair with specific parameters and store it in a keystore file.
keytool -genkeypair -storepass password -storetype PKCS12 -keyalg RSA -keysize 2048 -
dname "CN=server" -alias server -ext "SAN:c=DNS:Localhost,IP:127.0.0.1" -keystore
conf/server.keystore
Step 4) Here comes the twist , you can either go to bin folder and then run the keycloak
application or configure and attach the database and run.
The first option might run for you once but will crash after running for some time or when
you start it again, So it is recommended to configure the database
Temporary Solution to run (If you only want to run keycloak and not use it )
Go to bin folder – cd bin
kc.bat start-dev --db-pool-initial-size 100
This command limits the number of connections to the H2 database (Database written in java
used by keycloak ) but the size of the database is so small that after some time it will crash or
will not run at all .
Permanent Solution (Configure and attach a databse)
Additionally you can add the port number the keycloak will run on (by default in will run on 8080)
Step 18) Save the close the file and now go back to CMD , and to open the keycloack/bin folder
Kc.bat start-dev
Step 19) Create and admin user and password and log in.