Skip to main content

Setup Keycloak Server on Debian 11

 




apt-get -y update && apt-get -y upgrade

apt-get -y install default-jdk		

yum -y update && yum -y install java-11-openjdk-devel


cd /opt

wget https://github.com/keycloak/keycloak/releases/download/16.0.0/keycloak-16.0.0.tar.gz

tar -xvzf keycloak-16.0.0.tar.gz

mv keycloak-16.0.0.tar.gz keycloak


groupadd keycloak

useradd -r -g keycloak -d /opt/keycloak -s /sbin/nologin keycloak

chown -R keycloak: keycloak

chmod o+x /opt/keycloak/bin/

mkdir /etc/keycloak
cd /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
vim /opt/keycloak/bin/launch.sh

WILDFLY_HOME="/opt/keycloak"


cp /opt/keycloak/docs/contrib/scripts/systemd/wildfly.service /etc/systemd/system/keycloak.service

vim /etc/systemd/system/keycloak.service
[Unit]

Description=Keycloak Application Server

After=network.target



[Service]

Type=idle

User=keycloak

Group=keycloak

ExecStart=/opt/keycloak/bin/standalone.sh -b 0.0.0.0

TimeoutStartSec=600

TimeoutStopSec=600



[Install]

WantedBy=multi-user.target
systemctl daemon-reload && systemctl enable keycloak && systemctl restart keycloak && systemctl status keycloak
##if service will not run use below commandchmod o+x /opt/keycloak/bin/standalone.sh /opt/keycloak/bin/add-user-keycloak.sh -u admin -p YOURPASS -r master systemctl restart keycloak tail -f /opt/keycloak/standalone/log/server.log http://<instance-public-ip-domain.com>:8080/auth/admin/
########### Disable SSL ############



/opt/keycloak/bin/kcadm.sh config credentials --server http://localhost:8080/auth --realm master --user admin

/opt/keycloak/bin/kcadm.sh update realms/master -s sslRequired=NONE


upstream mywebapp1 {

server 127.0.0.1:8080;

}

server {

    listen 80;

    listen 443 ssl http2;

    server_name *.bd;

    ssl_certificate /cert/2019/nothi.pem;

    ssl_certificate_key /cert/2019/nothi.key;

    ssl_session_cache shared:SSL:120m;

    ssl_session_timeout 60m;

    ssl_prefer_server_ciphers on;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

    ssl_ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS;

    add_header Strict-Transport-Security "max-age=31536000";

    location / {

        proxy_pass http://mywebapp1;

        proxy_set_header Host $host;

        proxy_set_header X-Real-IP $remote_addr;

        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        proxy_set_header X-Forwarded-Proto $scheme;

    }

}


Comments

Popular posts from this blog

Setup a Multi-Protocol VPN Server Using SoftEther on Centos7

  Introduction This article explains how to install and configure a multi-protocol VPN server using the SoftEther package. We enable and configure OpenVPN and L2TP over IPSec and SSTP VPN Servers on Linux. What is SoftEther SoftEther VPN is one of the world’s most powerful and easy-to-use multi-protocol VPN software, made by the good folks at the University of Tsukuba, Japan. It runs on Windows, Linux, Mac, FreeBSD and Solaris and is freeware and open-source. You can use SoftEther for any personal or commercial use free of charge. Step 1: Create a Virtual Server First, you need to create a DigitalOcean Droplet. As mentioned in SoftEther’s website, SoftEther will work on almost every Linux distro with kernel v2.4 or above,; however it’s recommended to choose one of these distributions: CentOS, Fedora, or Red Hat Enterprise Linux. Personally I have tried it on Ubuntu, CentOS and Fedora, both 32 and 64 bit editions, and it has worked perfectly. Step 2: Update your Server Software Usin...

Setting Up MariaDB MaxScale Binlog Proxy for backup/failover

  Setting Up MariaDB MaxScale Binlog Proxy MariaDB MaxScale Binlog Server acts as an intermediate master replication proxy. By storing binary logs and serving them to replicas, it enables scalable replication architectures, reduces primary database load, and accelerates disaster recovery. Step 1: Install MariaDB MaxScale Install MaxScale using the package manager appropriate for your Linux distribution, then verify the installation. On Ubuntu/Debian: sudo apt-get update sudo apt-get install maxscale On RHEL/CentOS: sudo yum install maxscale Verify the installation: maxscale --version Step 2: Configure MaxScale as a Binlog Proxy Open MaxScale's core configuration file to establish the routing properties and specify your database backend configuration. sudo nano /etc/maxscale.cnf Add the following configurations for the moni...

Deploying a laravel app using nginx alias

  server { listen 80; server_name subdomian.example.com; root /var/www/mainapp/; add_header X-Frame-Options "SAMEORIGIN"; add_header X-XSS-Protection "1; mode=block"; add_header X-Content-Type-Options "nosniff"; index index.html index.htm index.php; charset utf-8; error_log /var/log/nginx/error.log warn; location / { try_files $uri $uri/ /index.php?$query_string; } location = /favicon.ico { access_log off; log_not_found off; } location = /robots.txt { access_log off; log_not_found off; } error_page 404 /index.php; location ~ \.php$ { fastcgi_pass unix:/var/run/php/php8.1-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; include fastcgi_params; } location /laravelapp { alias /var/www/mainapp/laravelapp/public; index index.php index.html in...