2

I am running windows 10 and installed virtual box to use ubuntu with the help of vagrant, so finally i have ubuntu 14.04 running with vagrant on windows

I have installed SonarQube by following here

so sonar cube was installed in ubuntu at /opt/sonar/bin/linux-x86-64/ and it is running good when i checked as below

(env) vagrant@vagrant-ubuntu-trusty-64:~/Work/sonar$ sudo /opt/sonar/bin/linux-x86-64/sonar.sh status
SonarQube is running (7705).

my sonar properties file(/opt/sonar/conf/sonar.properties) contains below settings

sonar.jdbc.username=sonar
sonar.jdbc.password=sonar
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance
sonar.web.host=127.0.0.1
sonar.web.context=/sonar
sonar.web.port=9002

Now when i tried to access it as below it is saying 404 not found

(env) vagrant@vagrant-ubuntu-trusty-64:~/Work/sonar$ wget http://127.0.0.1:9002
--2017-07-31 08:07:32--  http://127.0.0.1:9002/sonar
Connecting to 127.0.0.1:9002... connected.
HTTP request sent, awaiting response... 404 Not Found
2017-07-31 08:07:32 ERROR 404: Not Found.

So can anyone please let me know what might be the reason that the sonar server is not accessible using the link http://127.0.0.1:9002/sonar and what changes needs to be done or am i missing something in sonar.properties file ?,

FYI, I am using wget http://127.0.0.1:9002/sonar instead of typing it browser url is, since because I am running ubuntu using vagrant inside windows i need to make port forwarding etc., which is additional work, and so just for the time being i accessed it like above

Shiva Krishna Bavandla
  • 25,548
  • 75
  • 193
  • 313

2 Answers2

1

The solution i found to the above problem is just to comment the below options and restart the sonar server

#sonar.web.host=127.0.0.1
#sonar.web.context=/sonar
Shiva Krishna Bavandla
  • 25,548
  • 75
  • 193
  • 313
0

If you're installing sonar on vagrant VM, you can do the following :

  1. use a static IP for your VM, in your Vagrantfile add something like

    Vagrant.configure("2") do |config|
      config.vm.network "private_network", ip: "192.168.50.4"
    end
    
  2. you can reference this IP in your sonar properties file

    sonar.web.host=192.168.50.4
    
  3. you will be able to access the server with this IP. (http://192.168.50.4:9002 in your case and /sonar or not depending if you use the sonar.web.context properties)

The other option would be to use the special address 0.0.0.0 so it is bound to all network interfaces. In this case you don't specifically need a static IP for the VM and you can use the 127.0.0.1 address using port forwarding.

Frederic Henri
  • 51,761
  • 10
  • 113
  • 139