安装Keycloak并启动服务(macOS)

前提:电脑已经安装Java 17+

1、下载Keycloak

2、下载完后解压缩,使用文本编辑器修改配置文件(keycloak/conf/keycloak.conf)

Basic settings for running in production. Change accordingly before deploying the server.

Database

The database vendor.

#db=postgres

db=mysql

The username of the database user.

db-username=root

The password of the database user.

db-password=123456

The full database JDBC URL. If not provided, a default URL is set based on the selected database vendor.

#db-url=jdbc:postgresql://localhost/keycloak

db-url=jdbc:mysql://localhost:3306/keycloak

Observability

If the server should expose healthcheck endpoints.

health-enabled=true

If the server should expose metrics endpoints.

metrics-enabled=true

HTTP

The file path to a server certificate or certificate chain in PEM format.

#https-certificate-file=${kc.home.dir}/conf/server.crt.pem

The file path to a private key in PEM format.

#https-certificate-key-file=${kc.home.dir}/conf/server.key.pem

The proxy address forwarding mode if the server is behind a reverse proxy.

#proxy=reencrypt

Do not attach route to cookies and rely on the session affinity capabilities from reverse proxy

#spi-sticky-session-encoder-infinispan-should-attach-route=false

Hostname for the Keycloak server.

hostname=localhost

3、在命令窗口cd到解压后的keycloak目录,然后使用下面的指令创建一个临时的管理员账号

bin/kc.sh bootstrap-admin user

4、根据提示输入用户名和密码,密码随便设,临时账号后面还要删掉

5、启动keycloak服务

bin/kc.sh start-dev --http-port 8181

6、启动成功会看到下面的信息

Keycloak 26.3.1 on JVM (powered by Quarkus 3.20.1) started in 35.660s. Listening on: http://0.0.0.0:8181.

7、在浏览器输入

http://localhost:8181

8、使用刚刚输入的临时账号密码登录,进入用户页面添加新用户

9、添加用户后在 Credentials 页面设置密码

10、在 Role mapping 页面分配权限

11、退出临时管理账号,使用刚刚创建的账号登录,顶部就不会显示下面这段英文了

You are logged in as a temporary admin user. To harden security, create a permanent admin account and delete the temporary one.

12、删除临时账号

相关推荐
V***u4533 小时前
MS SQL Server partition by 函数实战二 编排考场人员
java·服务器·开发语言
这是程序猿3 小时前
基于java的ssm框架旅游在线平台
java·开发语言·spring boot·spring·旅游·旅游在线平台
i***t9193 小时前
基于SpringBoot和PostGIS的云南与缅甸的千里边境线实战
java·spring boot·spring
k***08293 小时前
【监控】spring actuator源码速读
java·spring boot·spring
麦麦鸡腿堡4 小时前
Java_网络编程_InetAddress类与Socket类
java·服务器·网络
vx_dmxq2114 小时前
【PHP考研互助系统】(免费领源码+演示录像)|可做计算机毕设Java、Python、PHP、小程序APP、C#、爬虫大数据、单片机、文案
java·spring boot·mysql·考研·微信小程序·小程序·php
5***g2984 小时前
新手如何快速搭建一个Springboot项目
java·spring boot·后端
daidaidaiyu4 小时前
Jetlinks 物联网平台 开源版学习源码分析
java·mqtt·rxjava·tcp
j***78885 小时前
clickhouse-介绍、安装、数据类型、sql
java
q***47186 小时前
Spring中的IOC详解
java·后端·spring