Steps to Install & Configure KeyCloak on Ubuntu 20.04 LTS

Keycloak is an open source Identity and Access Management solution tool.It is easy to use & makes it easy to secure application or services without writing any code.It supports many features including multifactor authentication,centralized user management, authentication, authorization and web interface login.

There are some steps to Install & Configure KeyCloak on Ubuntu:

Step 1: Update the System.

apt-get update

Step 2: Install Java.

apt-get install default-jdk

  • Check Java version.

java -version

  • Here is the command output.

Step 3: Download & Install KeyCloak.

cd /opt/

  • Here is the command output.

  • Extract the downloaded folder.

tar -xvf keycloak-15.0.2.tar.gz

  • Here is the command output.

  • Change the Name.

mv keycloak-15.0.2 keycloak

  • Create a user and group.

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

  • Provide the Ownership permission.

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

  • Here is the command output.

Step 4: Configure the KeyCloak.

cd /etc/
mkdir keycloak

  • Copy the following configuration files.

cp /opt/keycloak/docs/contrib/scripts/systemd/wildfly.conf /etc/keycloak/keycloak.conf
cp /opt/keycloak/docs/contrib/scripts/systemd/ /opt/keycloak/bin/

  • Provide the ownership permission.

chown keycloak: /opt/keycloak/bin/

  • Open the config file.

vim /opt/keycloak/bin/

  • Edit the following line:


  • Here is the command output.

  • Save the file.

Step 5: Create a Systemd Service File.

  • Copy the file.

cp /opt/keycloak/docs/contrib/scripts/systemd/wildfly.service /etc/systemd/system/keycloak.service

  • Open the keycloak.service file.

vim /etc/systemd/system/keycloak.service

  • Update/Edit the following lines:

Description=The Keycloak Server

  • Here is the command output.

  • Reload,Enable & Start the keycloak service.

systemctl daemon-reload
systemctl enable keycloak
systemctl start keycloak

  • Check Keycloak Status.

systemctl status keycloak

  • Here is the command output.

  • Check the Keycloak server log.

tail -f /opt/keycloak/standalone/log/server.log

  • Here is the command output.

Step 6: Create an Admin User for Keycloak.

/opt/keycloak/bin/ -u admin

  • Set the Password.
  • Here is the command output.

  • Restart the Keycloak service.

systemctl restart keycloak

  • To disable the HTTPS for Keycloak.

/opt/keycloak/bin/ config credentials --server http://localhost:8080/auth --realm master --user admin

  • Provide the admin password.

  • Run the following command to disable the HTTPS.

/opt/keycloak/bin/ update realms/master -s sslRequired=NONE

Step 7: Open the KeyCloak web interface


  • Here is the command output.

  • Open the Login web interface.


  • Here is the command output.
  • Provide the Username & Password.
  • Click on Sign In.

  • Now,KeyCloak is Ready.

Leave a Reply