0% found this document useful (0 votes)
148 views3 pages

Install Keycloak

The document provides instructions for installing and configuring Keycloak server on Linux. It describes downloading and unpacking the Keycloak zip file, setting prerequisites like Java, creating a system user, configuring files, installing the systemd service, launching Keycloak, creating an admin user, enabling the management console, and testing the installation.

Uploaded by

Abderaouf Omari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
148 views3 pages

Install Keycloak

The document provides instructions for installing and configuring Keycloak server on Linux. It describes downloading and unpacking the Keycloak zip file, setting prerequisites like Java, creating a system user, configuring files, installing the systemd service, launching Keycloak, creating an admin user, enabling the management console, and testing the installation.

Uploaded by

Abderaouf Omari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

1. Download latest Keycloak server (at present 15.0.

2) from here
2. Place the file in a directory you choose.
3. Unpack the ZIP file using the appropriate unzip utility, such as unzip, tar, or Expand-Archive
(for windows powershell).
$ unzip keycloak-15.0.2.zip

or

$ tar -xvzf keycloak-15.0.2.tar.gz

For windows :
> Expand-Archive -Path 'C:Downloads\keycloak-15.0.2.zip' -
DestinationPath 'C:\Downloads'

Prerequisites for installing keycloak server:

 Can run on any operating system that runs Java


 Java 8 JDK
 zip or gzip and tar
 At least 512M of RAM
 At least 1G of disk space

Create User/Group for Keycloak:


$ groupadd keycloak
$ useradd -r -g keycloak -d /opt/keycloak -s /sbin/nologin
keycloak
$ chown -R keycloak: /opt/keycloak
$ #chmod o+x /opt/keycloak/bin/

Create configuration files:


$ mkdir /etc/keycloak
$ cp /opt/keycloak/docs/contrib/scripts/systemd/wildfly.conf
/etc/keycloak/keycloak.conf
$ cp /opt/keycloak/docs/contrib/scripts/systemd/launch.sh
/opt/keycloak/bin/
$ chown keycloak: /opt/keycloak/bin/launch.sh
$ #Update the Keycloak installation path in launch.sh

Installing keycloak systemD service:


$ cp
/opt/keycloak/docs/contrib/scripts/systemd/wildfly.service /
etc/systemd/system/keycloak.service
Make the necessary changes to the keycloak.service file
[Unit]
Description=The Keycloak Server
After=syslog.target network.target
Before=httpd.service
[Service]
Environment=LAUNCH_JBOSS_IN_BACKGROUND=1
EnvironmentFile=/etc/keycloak/keycloak.conf
User=keycloak
Group=keycloak
LimitNOFILE=102642
PIDFile=/var/run/keycloak/keycloak.pid
ExecStart=/opt/keycloak/bin/launch.sh $WILDFLY_MODE
$WILDFLY_CONFIG $WILDFLY_BIND
StandardOutput=null

[Install]
WantedBy=multi-user.target
Launching Keycloak in standalone mode:

Go to the bin directory


$ cd bin
$ ./standalone.sh
Launching Keycloak standalone as Service with SystemD:
$ systemctl daemon-reload
$ systemctl enable --now keycloak
$ #Log location: /opt/keycloak/standalone/log/

Create initial administrator user with script:


$ sudo /opt/keycloak/bin/add-user-keycloak.sh -r master -u
<username> -p <password>
#then must restart Keycloak

If you have “HTTPS required” error message in Administration console visit this guide (Step7):
$ /opt/keycloak/bin/kcadm.sh config credentials --server
http://localhost:8080/auth --realm master --user <admin-
username>
–-password <admin-password>
$ /opt/keycloak/bin/kcadm.sh update realms/master -s
sslRequired=NONE
http://server_ip:8080/auth/realms/<RealmName>/account/

Enable Keycloak Management Console:


$ vim /etc/keycloak/keycloak.conf

# The address console to bind to


WILDFLY_MANAGEMENT_CONSOLE_BIND=0.0.0.0

$ vim /opt/keycloak/bin/launch.sh

Add -bmanagement $4 to look like this:

if [[ "$1" == "domain" ]]; then


$WILDFLY_HOME/bin/domain.sh -c $2 -b $3 -bmanagement $4
else
$WILDFLY_HOME/bin/standalone.sh -c $2 -b $3 -bmanagement $4
fi

$ vim /etc/systemd/system/keycloak.service

Add $WILDFLY_MANAGEMENT_CONSOLE_BIND to look like this:

ExecStart=/opt/keycloak/bin/launch.sh $WILDFLY_MODE
$WILDFLY_CONFIG $WILDFLY_BIND $WILDFLY_MANAGEMENT_CONSOLE_BIND

$ /opt/keycloak/bin/kcadm.sh config credentials --server http://localhost

Test

You might also like