Deciding to writing all technical code here, instead of the maleskoding blog.
So right now, to use SonarQube scanner in Travis CI, you have to use the Java VM and SonarCloud integration. To overcome this, I just wrote a simple installer script so it can be installed in Travis CI just in one line.
bash <(curl -s -L http://bit.ly/install-sonar-scanner)
In Travis you can just use in the install section and after_success section like below
install: bash <(curl -s -L http://bit.ly/install-sonar-scanner) after_success: sonar-scanner