Keycloak Tutorial: Deploying Keycloak on Debian & Integrating with Node.js via Keycloak-Typescript

by Sep 25, 2024Cloud

Printer Icon
f

1. Since Keycloak is made in Spring (a Java-based framework), ensure that you have the Java JDK installed (at least version 11) by running the following command:

root@raspberrypi / [1]# java --version
openjok 17.0.7 2023-04-18
OpenJDK Runtime Environment (build 17.0.7+7-Debian-1deb11u1)
OpenJDK 64-Bit Server VM (build 17.0.7+7-Debian-1debilu1, mixed mode, sharing)
root@raspberrypi /#

2. If that command does not print any output, you don’t have a Java JDK installed. You can install the Java OpenJDK with your package manager. In Debian, it should be something like this:

root@raspberrypi / [SIGINT]# sudo apt install default-jdk default-jre

3. Download the latest Keycloak release from their GitHub repository (it may take a few seconds to download):

root@raspberrypi ~# wget https://github.com/keycloak/keycloak/releases/download/22.0.4/keycloak-22.0.4.tar.gz
2023-10-18 21:54:49,552 INFO [org.keycloak.quarkus. runtime.hostname.DefaultHostnameProvider] (main) Hostname

4. Untar the Keycloak release:

root@raspberrypi ~# tar -xzvf keycloak-22.0.4.tar.gz

5. A new directory called something like “keycloak-{version}” should be generated; go to that directory:

root@raspberrypi ~# cd keycloak-22.0.4

6. Run the script located in bin/kc.sh to start the server, and specify an admin username and password (you only need to specify these credentials once, in subsequent runs, they are no longer needed) (if you don’t specify the port, it will use the 8080 port, please note that the first time it may take a while to start):

root@raspberrypi ~/keycloak-22.0.4# KEYCLOAK_ADMIN=admin KEYCLOAK_ADMIN_PASSWORD=uwu ./bin/kc.sh start-dev

7. And that’s it! now you can enter your Keycloak instance through http://localhost:8080 from the host computer (or with the host’s computer IP address from other devices)

8. Create a Node JS project by running the following command. (if you don’t have Node JS installed, you can download it from here: https://nodejs.org/.)

root@raspberrypi ~/tutorialKT# npm init

9. Install Keycloak-Typescript by running the following command:

root@raspberrypi ~/tutorialKT# npm install keycloak-typescript

10. And that’s it! now you can learn how to use the library on their documentation page: https://github.com/krasamo/keycloak-typescript/blob/main/docs/USAGE.md

0 Comments

Submit a Comment

Related Blog Posts

SRE Teams for Running Operations and Systems Effectively 

SRE Teams for Running Operations and Systems Effectively 

Site Reliability Engineering (SRE) is a discipline that has transformed the way we manage IT operations and systems. By combining software engineering and computer science principles, SRE teams automate operations and improve system reliability. They work closely with development teams to promote collaboration, share responsibilities, and eliminate silos. With a focus on reducing manual work and minimizing toil, SREs aim to create systems that can run by themselves, allowing for scalability and growth without the need for additional personnel. By adopting SRE principles, organizations can streamline their IT services, increase efficiency, and deliver a more reliable user experience.

Cloud Adoption Efforts Drive High Performance

Cloud Adoption Efforts Drive High Performance

Cloud adoption enables the right technologies and processes in cloud environments required to operate efficiently in the digital world. In addition, a modern operating model with the correct implementation of cloud services creates real competitive advantages.