Installing Keycloak on Ubuntu 18.04!! (Keycloak Part1)

Akhil Bhavirisetty
2 min readMay 27, 2021

This is the first part of the series “Securing MERN application using keycloak”.

Overview:

In this story, I will guide you the steps for a simple standalone installation keycloak 13.0.1 on Ubuntu 18.04 provisioned in Google Cloud Platform

Before you Start

Make sure you have OpenJDK 1.8 or newer installed in the Ubuntu Instance

Download keycloak

1. Get the keycloak-13.0.1.tar.gz URL from keycloak downloads page as shown below

URL for keycloak-13.0.1.tar.gz

2. Change directory to /opt (Note: You can download in any directory)

cd /opt

3. Download keycloak using wget

wget https://github.com/keycloak/keycloak/releases/download/13.0.1/keycloak-13.0.1.tar.gz

Uncompress Keycloak file

Use tar or equivalent to uncompress the file

tar -xvzf keycloak-13.0.1.tar.gz

Run the Keycloak server in background mode

sudo /opt/keycloak-13.0.1/bin/standalone.sh -b=0.0.0.0 &
  • -b indicates binding ip address.
  • Binding 0.0.0.0 to allow internet traffic

Access Keycloak from Browser

  1. Get the External IP of the Ubuntu Instance running in GCP
  1. Try accessing http://<external-ip>:8080/auth(By default, Keycloak runs on 8080 port for http)

Add Admin User

Use “add-user-keycloak.sh” script to add admin user

sudo /opt/keycloak-13.0.1/bin/add-user-keycloak.sh -u admin -p <password>

Restart Keycloak

sudo kill -9 $(ps -ef | grep keycloak | awk {‘print $2’})sudo /opt/keycloak-13.0.1/bin/standalone.sh -b=0.0.0.0 &

Access Keycloak

  1. Access http://<external-ip>:8080/auth

2. Now click on the Administration Console as shown above

You will get the HTTPS required error

You can either enable SSL or disable the SSL-required option using through keycloak script.

Reference Links:

https://www.keycloak.org/docs/latest/server_installation/index.html

Next part: Enabling SSL for keycloak using Cloudflare (Keycloak Part2)

--

--

Akhil Bhavirisetty

Full Stack Software Engineer, problem solver, with experience in designing and developing end-to-end software applications