Debug School

rakesh kumar
rakesh kumar

Posted on

How to setup and run keycloack in local

Prerequisites (must have)

Windows 10/11

Java 17 or Java 21 installed
Enter fullscreen mode Exit fullscreen mode

Quick check:

java -version
Enter fullscreen mode Exit fullscreen mode

If you don’t have Java, install JDK 17 (safe choice) and re-check.

PowerShell or CMD

curl + tar available

On Windows 11, these usually exist by default.

Quick check:

curl --version
tar --version
Enter fullscreen mode Exit fullscreen mode

Download Keycloak zip (from C:)

Open PowerShell (recommended) or CMD, then:


cd C:\
curl -L -o keycloak-26.3.3.zip https://github.com/keycloak/keycloak/releases/download/26.3.3/keycloak-26.3.3.zip
Enter fullscreen mode Exit fullscreen mode

Confirm file is there:

dir keycloak-26.3.3.zip
Enter fullscreen mode Exit fullscreen mode

Extract it

tar -xf keycloak-26.3.3.zip
Enter fullscreen mode Exit fullscreen mode

After extract, you should see a folder:

dir keycloak-26.3.3
Enter fullscreen mode Exit fullscreen mode

Go to the bin folder

cd keycloak-26.3.3\bin
dir
Enter fullscreen mode Exit fullscreen mode

Database configuration

# ===============================================
# Database Configuration for XAMPP MariaDB (using root)
# ===============================================
# Set the database type to MariaDB.
db-pool-acquisition-timeout=60
db=mariadb
# Set the connection URL. This still needs to point to the
# 'keycloak_user' database you created, not 'root'.
db-url=jdbc:mariadb://localhost:3306/keycloack_new
# Your database username.
db-username=root
# Your database password (blank).
db-password=
You should see kc.bat in the listing.
Enter fullscreen mode Exit fullscreen mode

Create bootstrap admin (first-time admin user)

Run:

kc.bat bootstrap-admin user --username admin --password Admin@12345
Enter fullscreen mode Exit fullscreen mode

Expected: it confirms admin bootstrap is configured.

Note: This is for local/dev usage. Don’t reuse this password in production.

Start Keycloak in dev mode on port 8080

Run:

kc.bat start-dev --http-port=8080
Enter fullscreen mode Exit fullscreen mode

Keep this terminal open (Keycloak runs until you stop it).

Open Keycloak UI

In browser open:

Admin Console: http://localhost:8080/admin

Main URL: http://localhost:8080
Enter fullscreen mode Exit fullscreen mode

Login:

Username: admin

Password: Admin@12345

7)

Verify it’s actually running (quick test)

Open a new terminal and run:

curl -I http://localhost:8080
Enter fullscreen mode Exit fullscreen mode

You should see an HTTP response (200/302 etc). That confirms Keycloak is up.

8)

Stop Keycloak

In the terminal where it’s running, press:

Ctrl + C
Enter fullscreen mode Exit fullscreen mode

Common Issues & Fixes (fast)
A) java not found / wrong version

Install JDK 17

Ensure JAVA_HOME + PATH are set, then reopen terminal.

B) Port 8080 already in use

Start on a different port:

kc.bat start-dev --http-port=8180

Then open:
http://localhost:8180/admin

C) tar not recognized

Use PowerShell Expand-Archive:

cd C:\
Expand-Archive .\keycloak-26.3.3.zip -DestinationPath .\keycloak-26.3.3 -Force

(If it creates nested folders, just ensure kc.bat is under ...\bin.)

Summary

cd C:\
curl -L -o keycloak-26.3.3.zip https://github.com/keycloak/keycloak/releases/download/26.3.3/keycloak-26.3.3.zip
tar -xf keycloak-26.3.3.zip
cd keycloak-26.3.3\bin
kc.bat bootstrap-admin user --username admin --password Admin@12345
kc.bat start-dev --http-port=8080
Enter fullscreen mode Exit fullscreen mode

=========Another way to run on root folder=============

./bin/kc.bat start-dev --http-port=8080
Enter fullscreen mode Exit fullscreen mode

==============how ro create admin user name password===========

regsiter form
username==rakesh
password==Admin@1234
Enter fullscreen mode Exit fullscreen mode

Top comments (0)