Keycloack standalone works fine on terminal but on ip:8080 i get This site can’t be reached

Ubuntu VM 16.04 (real server not localhost).

Steps to reproduce :
wget keycloak .
Unzip on /opt
sudo ./
Go to ip:8080


I tried docker installation and it works fine .
I tried standalone on my local ubuntu machine (my laptop) and it works fine.
I tried running it with this command sudo ./ -Djboss.socket.binding.port-offset=100 so i can get a new port still doesnt work.
Why would this not work ? :frowning:

Hi there, it should be because if you launch the process like that it will only listen on the interface, you should try launching it with -b= and -bmanagement= too, that way the process will listen on all interfaces and you should be able to access it using your ip. Let me know if this works

Best regards

Hello thanks for the quick reply .
Now i am suddenly getting .
15:46:59,013 FATAL [] (ServerService Thread Pool – 56) Error during startup: java.lang.RuntimeException: Failed to connect to database
Full logs : 15:53:18,406 FATAL [] (ServerService Thread Pool -- 62) Err -

As said this is a fresh ubuntu 16.04 i just downloaded keycloak and runned , it should play right of the box but it’s not , any help would be appreciated.

@ Marius

I haven’t seen that error with the default datasource but looking at the stack trace the cause seems to be "org.h2.jdbc.JdbcSQLException: IO Exception: “ ca: ca: Name or service not known”, can you try adding the hostname into /etc/hosts and seeing what happens next

just add the ip address of the server e.g 42.435.234.2 on the last line?
Yea it’s weird it’s doing it now, it wasn’t doing it yesterday but i did clean install ubuntu again today.

No, not the ip address but the server’s hostname, try simply running this command
printf “ $(hostname)” >> etc/hosts

printf “ $(hostname)” >> etc/hosts
-bash: etc/hosts: No such file or directory

I forgot a ‘/’ my bad, it’s
printf “ $(hostname)” >> /etc/hosts

unfortunately i am getting permissions denied even if i have sudo privs.
but on hosts i can see 2 lines with localhost prob our hostname.

It’s weird everything worked just fine until i did a clean install of ubuntu again today . Now i regret that.

If i do sudo hostname i get an answer though
should i add that answer hostname_answer ?

this is how etc/hosts
It worked , i will run the command u said now , finger crossed.

@ Marius this seems to be working just fine . What i did for people reading this in the future is add what sudo hostname said in etc/hosts
so sudo hostname
it the answer was for example “x” then i added on etc/hosts x
That’s it.
I had to create an admin from the terminal but now when i try to log in i get
" We are sorry…

HTTPS required"

How can i disable SSL this is a test environment i don’t need it . Do you know ?

Like on my localhost (laptop) it runs fine without SSL.

Try disabling the ssl, in the “master” realm, over login tab. Change ‘Require SSL’ property to none

The thing is as soon as i press administration console i get the error so i cant go to master realm.

Maybe this can be achieved via the terminal ? do u know …
Thanks for the help btw i truly appreciate it.

Console error :
16:41:15,362 WARN [] (default task-2) type=LOGIN_ERROR, realmId=master, clientId=null, userId=null, ipAddress=…1, error=ssl_required

I found this but no idea where all the default thing are to replace the values or if it’s even a workable solution

java -cp .jar -url “jdbc:h2:file:” -user -password -sql “update REALM set ssl_required=‘NONE’ where id = ‘master’”

Oh, I see, you could try doing it from the cli on the server like this

./ config credentials --server http://localhost:8080/auth --realm master --user admin
./ update realms/master -s sslRequired=NONE

or you could try to tunnel from your local machine into the server on port 8080 or whatever port you have it running on and then access the web console from your local machine, the tunnel syntax is

sudo ssh -N -L 8080:localhost:8080 username@serverip

this will forward your local 8080 port to the port 8080 on the server and you can simply open a browser on your machine and type localhost:8080/auth and then you should be able to access it


:heart: :heart: :heart: :heart: :heart:

For people reading this what i did is the second option
sudo ssh -N -L 8080:localhost:8080 username@serverip
Where username = the username u ssh into your virtual matchine
serverip = the ip of your virtual machine

e,g if you ssh root@43500
Went into localhost:8080 log in with the user/pass i created earlier via the script and disable ssl.

bind :grinning:

1 Like