当前位置: 首页 > 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.xdnf.cn/news/1122967.html

相关文章:

  • 4.2TCP/IP
  • USB读写自动化压力测试
  • 小波变换 | 离散小波变换
  • AI驱动的软件工程(下):AI辅助的质检与交付
  • FreeRTOS之链表操作相关接口
  • 人工智能如何重构能源系统以应对气候变化?
  • 29.安卓逆向2-frida hook技术-逆向os文件(二)IDA工具下载和使用
  • kali安装失败-选择并安装软件包-一步到位
  • 7.15 窗口函数 | 二分 | 位运算 | 字符串dp
  • C# TCP粘包与拆包深度了解
  • MCP基础知识二(实战通信方式之Streamable HTTP)
  • 微信131~140
  • 属性绑定
  • 零基础 “入坑” Java--- 十一、多态
  • IDEA中使用Servlet,tomcat输出中文乱码
  • 《星盘接口2:NVMe风暴》
  • [spring6: Resource ResourceLoader ResourceEditor]-加载资源
  • 【Java笔记】七大排序
  • 现有医疗AI记忆、规划与工具使用的创新路径分析
  • 融合竞争学习与高斯扰动的多目标加权平均算法(MOWAA)求解多无人机协同路径规划(多起点多终点,起始点、无人机数、障碍物可自定义),提供完整MATLAB代码
  • 嵌入式硬件篇---晶体管的分类
  • Transformer江湖录 第五章:江湖争锋 - BERT vs GPT
  • ZYNQ双核通信终极指南:FreeRTOS移植+OpenAMP双核通信+固化实战
  • CSS面试题
  • C++卸载了会影响电脑正常使用吗?解析C++运行库的作用与卸载后果
  • 后端接口通用返回格式与异常处理实现
  • UI前端大数据处理新挑战:如何高效处理实时数据流?
  • JavaScript学习第九章-第三部分(内建对象)
  • 内测分发平台应用的异地容灾和负载均衡处理和实现思路
  • 8.服务通信:Feign深度优化 - 解密声明式调用与现代负载均衡内核