当前位置: 首页 > news >正文

安装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、删除临时账号

http://www.lryc.cn/news/588110.html

相关文章:

  • 概率论与数理统计(二)
  • 微信小程序——配置路径别名和省略后缀
  • 创客匠人:创始人 IP 打造的内核,藏在有效的精神成长里
  • 【第一章编辑器开发基础第一节绘制编辑器元素_6滑动条控件(6/7)】
  • 【PTA数据结构 | C语言版】字符串连接操作
  • Git安装避坑指南
  • 【Vue】Vue3.6 - Vapor 无虚拟DOM
  • 【第一章编辑器开发基础第二节编辑器布局_1水平与垂直布局(1/4)】
  • 计算两个经纬度之间的距离(JavaScript 实现)
  • 当 `conda list` 里出现两个 pip:一步步拆解并卸载冲突包
  • 详解BIO,NIO,AIO
  • Python Web框架对比:Flask vs FastAPI
  • Python数据容器-字典dict
  • 丑团-h5-Mtgsig算法-分析
  • Linux基础开发工具(3)
  • ACL流量控制实验
  • 车载诊断框架 --- 车载诊断GuideLine
  • 信息收集的骚打法
  • 安装llama-factory报错 error: subprocess-exited-with-error
  • SQL创建三个表
  • 国产LVDT信号调理芯片XJD698对比AD698的技术突破与优势解析
  • 代码随想录算法训练营第三十五天|416. 分割等和子集
  • CLIP、Open CLIP、SigLip、SigLip2的相关总结
  • 内网环境自签名超长期HTTPS证书,并在Chrome中显示为安全证书
  • Faiss能解决什么问题?Faiss是什么?
  • 【数据结构初阶】--单链表(二)
  • Kafka Broker源码解析(上篇):存储引擎与网络层设计
  • 【html基本界面】
  • [spring6: ResolvableType TypeDescriptor ConversionService]-类型系统
  • [笔记] 动态 SQL 查询技术解析:构建灵活高效的企业级数据访问层