How to install a SonarQube server with a remote database? - linux

I am trying to install a SonarQube server on my Linux machine. I want to use a SonarQube database on my windows machine - a Microsoft SQL server instance.
How can I connect my SonarQube server to my SonarQube database?

Open the file conf/sonar.properties and edit the properties sonar.jdbc.url, sonar.jdbc.username and sonar.jdbc.password.
Example:
sonar.jdbc.url=jdbc:sqlserver://windowsmachine;databaseName=sonar
sonar.jdbc.username=yourLogin
sonar.jdbc.password=yourPassword
Reading the documentation can also help.

Related

Spring Boot Remote Oracle DB connection works on Windows 10 OS but not on Oracle Linux OS

I am working on a spring boot project with oracle jdk 11 on an eclipse 4.21.0 IDE environment. When I create a jar package and deploy it, the connection to the database is working without any problem. The connection to the oracle database is done to a remote location inside our LAN.
Everything is working without any problem when I work on development and deployment mode in Windows 10.
When I deploy as client the same spring boot jar file with oracle jdk 11 inside of our LAN from another OS location (Ubuntu 20.04, Oracle Linux 8) all functionalities are working appart the connection to the oracleDB. The weird thing is that:
It does not show any error so it seems to be connecting but returns an empty set
Both deployments(from Windows 10, Linux) are done to a remote oracle DB inside our LAN
On the Linux OS I installed an oracle client and did an sqlplus direct connection
in the form of sqlplus username/password#(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=LAN_IP)(Port=1521))(CONNECT_DATA=(SID=db_sid))) to the remote DB and it succeeded.
Any ideas where I should focus on to locate any error. Unfortunately, I do not have access to the Oracle DB Server to be able to see what server is receiving.

jenkins.plugins.publish_over.BapPublisherException: Failed to connect and initialize SSH connection Message [Auth fail]

I am learning to use Jenkins to deploy a .Net 5.0 application on an AWS EC2 server. This is the first time I am using Linux server and Jenkins for .Net (I'm am a life long Windows guy), and I am facing an error while trying to publish my artifacts over SSH to Web Server.
My setup:
Jenkins server is an AWS EC2 Linux AMI server.
Web Server is also an AWS EC2 LInux AMI server.
My Jenkins is correctly installed and working. I am able to build and run unit test cases without any issues.
For Deploy, I am using 'Publish Over SSH' plugin, and I have followed all steps to configure this plugin as mentioned here https://plugins.jenkins.io/publish-over-ssh/.
However, when try to 'Test Configuration', I get the below error,
Failed to connect or change directory
jenkins.plugins.publish_over.BapPublisherException: Failed to connect and initialize SSH connection. Message: [Failed to connect session for config [WebServer]. Message [Auth fail]]
I did a ping test from Jenkins server to Web Server, and it is a success.
I'm using the .pem key in the 'Key' section of 'Publish over SSH'. This key is the same key I use to SSH into the web server.
The below link suggests many different solutions, but none is working in my case.
Jenkins Publish over ssh authentification failed with private key
I was looking at the below link which describes the same problem,
Jenkins publish over SSH failed to change to remote directory
However in my case I have kept 'Remote Directory' as empty. I don't know if I have to specify any directory here. Anyways, I tried creating a new directory under the home directory of user ec2-user as '/home/ec2-user/publish' and then used this path as Remote Directory, but it still didn't work.
Screenshot of my settings in Jenkins:
I would appreciate if anyone can point me to the right direction or highlight any mistake I'm doing with my configuration.
In my case following steps solved the problem.
Solution is based on Ubuntu 22.04
add two line in /etc/ssh/sshd_config
PubkeyAuthentication yes
PubkeyAcceptedKeyTypes +ssh-rsa
restart sshd service
sudo service sshd restart
you might consider the following:
a. From the screenshot you’ve provided, it seems that you have checked the Use password authentication, or use different key option which will require you to add your key and password (inputs from these fields will be used in connecting to your server via SSH connection). If you use the same SSH key and passphrase/password on all of your servers, you can uncheck/untick that box and just use the config you have specified above.
b. You might also check if port 22 of your web server allows inbound traffic from the security group where your Jenkins server/EC2 instance is running. See reference here.
c. Also, make sure that the remote directory you have specified is existing otherwise the connection may fail.
Here's the sample config

Oracle 11g Express Edition: /etc/init.d/functions:No such file or function

I am trying to install Oracle 11g following this link on Ubuntu 14.04:Link to install the Oracle 11g Express Edition.The problem arises right after i start configuring and right after the configuration is over.It shows "Successful installation" but then displays an error.
sourajyoti#:Disk1$ sudo /etc/init.d/oracle-xe configure
/etc/init.d/oracle-xe: line 69: /etc/init.d/functions: No such file or directory
Oracle Database 11g Express Edition Configuration
-------------------------------------------------
This will configure on-boot properties of Oracle Database 11g Express
Edition.The following questions will determine whether the database should be starting
upon system boot, the ports it will use, and the passwords that will be used for database accounts.
Press <Enter> to accept the defaults.Ctrl-C will abort.
Specify the HTTP port that will be used for Oracle Application Express[8080]:
Specify a port that will be used for the database listener [1521]:
Port 1521 appears to be in use by another application. Specify a different port.
Specify a port that will be used for the database listener [1521]:1522
Specify a password to be used for database accounts.Note that the same password will
be used for SYS and SYSTEM.Oracle recommends the use of different passwords
for each database account.This can be done after initial configuration:
Confirm the password:
Do you want Oracle Database 11g Express Edition to be started on boot (y/n) [y]:y
Starting Oracle Net Listener...Done
Configuring database...Done
Starting Oracle Database 11g Express Edition instance...Done
Installation completed successfully.
/etc/init.d/oracle-xe: line 177: /etc/sysconfig/oracle-xe: No such file or directory
sourajyoti#:Disk1$ sudo service oracle-xe start
/etc/init.d/oracle-xe: line 69: /etc/init.d/functions: No such file or directory
Oracle Database 11g Express Edition is not configured.You must run '/etc/init.d/
oracle-xe configure' as the root user to configure the database.
Is there any way to overcome this problem?
To solve this
/etc/init.d/oracle-xe: line 177: /etc/sysconfig/oracle-xe: No such file or directory
in ubuntu, go to the file /etc/init.d/oracle-xe and search for the line: CONFIGURATION="/etc/sysconfig/$CONFIG_NAME" change this to:
CONFIGURATION="/etc/default/$CONFIG_NAME"

Access Remote Glassfish4 Server from Eclipse Luna

I am working on a Mac.
I am running Linux Ubuntu server in a VirtualBox. GlassFish 4 and MySql are already running there. The Linux IP is 10.0.1.12.
On the guest system (Mac) I am running Eclipse Luna. I installed the GlassFish Tools for Eclipse Luna and restarted Eclipse.
Then I wanted to add server for GlassFish4. But Eclipse is asking me for "Server root" and I have no clue what it means! I entered "10.0.1.12:4848/" just as I can access GlassFish from the host system (Mac OS) by a browser. But it just doesn't accept that URL. It seems to expect a local directory path. Here is the dialog box:
Thanks in advance for any hints!!
You need to install a Glassfish4 Server to your local machine (the one Eclipse is running on) despite the fact that you want to connect to and manage a remote Glassfish server; Eclipse will use some of the files in that local installation to manage the remote Glassfish server. Assuming you already have Glassfish4 installed on a remote machine:
[For example purposes]
Let's assume the remote Glassfish server is at 192.168.2.7 on default port 4848 for administration and you've set a password for 'admin' user as 'gfish'.
Let's also assume that your local desktop (development machine running Eclipse Luna) is at 192.168.2.3
Download Glassfish4 Open Source edition zip
Unzip the contents to a directory on your local machine: let's say inside of path /glassfish_server/ you will now have:
/glassfish_server/glassfish4/glassfish/ structure
Back in Eclipse:
Create a New Server -> Select 'Glassfish4' option
Server's Hostname =[remote ip address] // E.G. 192.168.2.7
Server Name: GlassFish 4 at 192.168.2.7 // get's auto-filled
[Next] This is the page you were specifically having issue with:
Set the Root Path to your Local Glassfish Server install directory
so in this example: /glassfish_server/glassfish4/glassfish/ should be accepted
[Next] Now use the credentials and configuration for your remote glassfish server. Run a Ping-Test to test connection.
The server root means the directory where GlassFish is located. This might be, for example, /opt/glassfish4/glassfish. Eclipse needs this so that it can look for the bin/ directory and be able to start/stop the server using the scripts in there.

PDO driver for XAMPP on Linux

I'm about to gain some experience on Yii so I set up a XAMPP (1.8.1) for Linux environment and installed the Yii framework.I progress based on the book titled 'Web Application Development with Yii and PHP' and there's an example to set up database connection and test that through the Yii console by running the following code:
echo Yii::app()->db->connectionString;
Of course previously I created the appropriate MySQL database and set up the connection string in corresponding main.php and console.php but I'm getting an error:
exception 'CDbException' with message 'CDbConnection failed to open the DB connection: could not find driver' in /work/webroot/yii/framework/db/CDbConnection.php:382
Based on Yii's requirement checker PDO for MySQL is enabled. If I check the HTML version of phpinfo it says:
PDO Driver for MySQL: Enabled
and
Client API version: mysqlnd 5.0.10 - 20111026 - $Id: b0b3b15c693b7f6aeb3aa66b646fee339f175e39 $
However if I run phpinfo from a Yii console it gives the following result:
PDO support => enabled
PDO drivers =>
So, for me it seems PDO driver is missing. I read several forum threads about how to download PDO drivers for linux and how to change the php.ini to use those drivers but I guess that solution works for CLI environment and not for XAMPP.
Can somebody help me out here how can I set up PDO driver for MySQL database on XAMPP? I'm using Ubuntu 13.10 desktop.
I was playing around for a while and found the solution with the help of several forum threads.
To resolve the following driver issue...
'CDbException' with message 'CDbConnection failed to open the DB connection: could not find driver'
... I had to install the correct connector. I ran the following:
sudo apt-get install php5-mysql
After that I tried to check the connection string once again via the Yii console by running code:
echo Yii::app()->db->connectionString;
But this time it gave me a different error mesage:
'CDbException' with message 'CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'
To resolve this issue I changed my main.php and console.php under /protected/config directory and replaced 'localhost' to '127.0.0.1'.
Based on the PHP documentation this is required because MySQL Unix socket shouldn't be used with host or port.
This resolved the second error message and I could connect to my database.

Resources