ubuntu下部署keycloak
1.⾸先先保证linux服务器上安装的有jdk和mysql
我这⾥安装的版本是
jdk:11.04
mysql:8.0.17
然后创建⼀个名为keycloak的数据库(名称随便起,但是建议起这个名字)
2.然后去Keyclock官⽹下载linux下载server版本的keycloak的包
3.然后在usr/local下(路径随意,看⾃⼰习惯,建议usr/local下) 创建⼀个⽂件夹命名为keycloak(名称随便起)
4.然后将通过xshell或者其他⼯具将包复制到usr/local/keycloak
然后使⽤命令进⾏解压
tar -zxvf keycloak-7.0.
5.解压完成后,删除多余的⽂件(删不删都⾏,看你们⾃⼰),然后修改l
修改l之前先使⽤命令将下载好的mysql-connect的jar包复制到该⽂件夹下移动mysql-connect的jar包到改该⽬录
mv mysql-connector-java-8.0.17.jar modules/system/layers/base/com/mysql/main/
然后修改相应的module/xml内容
l
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ JBoss, Home of Professional Open Source.
~ Copyright 2010, Red Hat, Inc., and individual contributors
~ as indicated by the @author tags. See file in the
~ distribution for a full listing of individual contributors.
~
~ This is free software; you can redistribute it and/or modify it
~ under the terms of the GNU Lesser General Public License as
~ published by the Free Software Foundation; either version 2.1 of
~ the License, or (at your option) any later version.
~
~ This software is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
~ Lesser General Public License for more details.
~
~ You should have received a copy of the GNU Lesser General Public
~ License along with this software; if not, write to the Free
~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
~ 02110-1301 USA, or see the FSF site:
-->
<module name="sql"
xmlns="urn:jboss:module:1.5">
<resources>
<resource-root path="mysql-connector-java-8.0.17.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="ansaction.api"/>
<module name="javax.servlet.api" optional="true"/>
</dependencies>
</module>
修改l
修改其中的部分内容
<datasource jndi-name="java:jboss/datasources/KeycloakDS" pool-name="KeycloakDS" enabled="true" use-java-context="true">          <!-- database keycloak 需要事先创建好  -->
<connection-url>jdbc:mysql://127.0.0.1:3306/keycloak?useSSL=false</connection-url>
<driver>mysql</driver>
<pool>
<max-pool-size>20</max-pool-size>
</pool>
<security>
<user-name>root</user-name>
<password>admin</password>
</security>
</datasource
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
<!-- 配置driver名称,指定引⽤的module名称  -->
<driver name="mysql" module="sql">
<xa-datasource-class&sql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class> </driver>
设置所有IP可以访问
<interfaces>
<interface name="management">
<inet-address value="${jboss.bind.address.management:0.0.0.0}"/>
</interface>
<interface name="public">
<inet-address value="${jboss.bind.address:0.0.0.0}"/>
</interface>
</interfaces>
6.然后设置默认的登录⽤户,如果不设置外部访问⽆法登录会提⽰使⽤localhost
①进bin⽂件夹
②然后执⾏命令
sh add-user-keycloak.sh -r master -u admin -p admin
其中第⼀个admin是⽤户名,第⼆个admin是密码⽤户名和密码随意设置,⾃⼰记住就⾏
7.然后进⼊bin⽂件夹 运⾏命令
sh bin/standalone.sh -Djboss.socket.binding.port-offset=100
mysql下载jar包// 如果直接sh bin/standalone.sh  则使⽤默认端⼝8080,如果运⾏上⾯的端⼝就是8180以此类推
8.然后在浏览器进⾏访问 ip:port/auth
如  192.168.XX.128:8080/auth

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。