LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-09-2013, 10:04 AM   #1
Nikhil_Lagwankar
Member
 
Registered: Aug 2013
Location: Pune
Distribution: Centos, Ubuntu, Fedora
Posts: 36

Rep: Reputation: 0
Post how to find if 2 databases are installed on the system?


hi,

I'm using CentOS 6.4(final).

I simply want to write a code which will run and tell me number of databases or web servers installed on my system.

IS there any kind of file which will give me this kind of output.

thanks in advance ...
 
Old 12-09-2013, 10:44 AM   #2
sag47
Senior Member
 
Registered: Sep 2009
Location: Raleigh, NC
Distribution: Ubuntu, PopOS, Raspbian
Posts: 1,899
Blog Entries: 36

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
You question is not specific enough. What kind of databases? What kind of web servers? There are my flavors and variants of each. What are you actually asking? Give the "forest" of the problem and not the "trees".
 
Old 12-10-2013, 02:22 AM   #3
Nikhil_Lagwankar
Member
 
Registered: Aug 2013
Location: Pune
Distribution: Centos, Ubuntu, Fedora
Posts: 36

Original Poster
Rep: Reputation: 0
Lightbulb

Quote:
Originally Posted by sag47 View Post
You question is not specific enough. What kind of databases? What kind of web servers? There are my flavors and variants of each. What are you actually asking? Give the "forest" of the problem and not the "trees".
okay ... suppose that i have MySQL and oracle/IBM DB2 etc installed... Now i just want to find out how many such databases are installed...

eg : - if only MySQL --> output 1... if MySQL + oracle --? output 2

similarly if i just have apache output 1... if i have apache and say nginx then output 2...

That's what i want to find out...
 
Old 12-10-2013, 02:49 AM   #4
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,341

Rep: Reputation: Disabled
Database servers and web servers are no different from other applications installed on your system; they are simply a bunch of files (executables, libraries, configuration files, data files) that reside in various directories.

To figure out if application "X" in installed on a system, you can:
  • search for files with names associated with the application in question (which may return a false positive if an unrelated file with a similar name exists somewhere)
  • try and execute an application-related file with a parameter known to return a certain value, like "mysql --version", and check the result (which may fail in interesting ways if an unrelated script or executable by that name exists, or if the parameter has been deprecated in a later version of the application)
  • search through the list of installed applications provided by the package manager of your distribution, which would be rpm on CentOS (which is safe, but will miss any applications installed directly from source code)

Bottom line, you'll have to know exactly what you're looking for, and select a method appropriate for the systems you'll be examining. For CentOS, rpm -a | grep <some_filter> or rpm -q <package> may be what you're looking for.

Last edited by Ser Olmy; 12-10-2013 at 02:51 AM.
 
2 members found this post helpful.
Old 12-10-2013, 03:22 AM   #5
Nikhil_Lagwankar
Member
 
Registered: Aug 2013
Location: Pune
Distribution: Centos, Ubuntu, Fedora
Posts: 36

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Ser Olmy View Post
you'll have to know exactly what you're looking for
yeah that can be done... isn't there any way by which without know the names of these applications i could get this result...

maybe there's some file which might be holding that data like how many database servers are there and their names
...
 
Old 12-10-2013, 03:50 AM   #6
sag47
Senior Member
 
Registered: Sep 2009
Location: Raleigh, NC
Distribution: Ubuntu, PopOS, Raspbian
Posts: 1,899
Blog Entries: 36

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
Quote:
Originally Posted by Nikhil_Lagwankar View Post
okay ... suppose that i have MySQL and oracle/IBM DB2 etc installed... Now i just want to find out how many such databases are installed...

eg : - if only MySQL --> output 1... if MySQL + oracle --? output 2

similarly if i just have apache output 1... if i have apache and say nginx then output 2...

That's what i want to find out...
Your question is still ambiguous. Both MySQL and Oracle are capable of having multiple databases within the same instances. If you're attempting software detection then this will depend on the target OS you're querying. Sometimes it can be found via package management or you can simply query their utilities.

My question to you is... what is your actual question? What is your end goal? Are you attempting to inventory? Are you attempting to audit? Need more info.
 
Old 12-10-2013, 03:53 AM   #7
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Quote:
Originally Posted by Nikhil_Lagwankar View Post
isn't there any way by which without know the names of these applications i could get this result...

maybe there's some file which might be holding that data like how many database servers are there and their names ...
Nope.

You need to specifically look for the application(s). You also cannot rely on the package manager (rpm/yum for RHEL based systems) information: What if the package manager wasn't used (application was build and installed from source)....

Ser Olmy's reply put you on the correct path to tackle this problem.
 
1 members found this post helpful.
Old 12-10-2013, 04:04 AM   #8
Nikhil_Lagwankar
Member
 
Registered: Aug 2013
Location: Pune
Distribution: Centos, Ubuntu, Fedora
Posts: 36

Original Poster
Rep: Reputation: 0
Post

Quote:
Originally Posted by sag47 View Post
What is your end goal? Need more info.
My main aim is to detect number of database servers installed on the system... then i intend to scan the config files of these servers to check if they are securely configured...
 
Old 12-10-2013, 04:50 AM   #9
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Quote:
Originally Posted by Nikhil_Lagwankar View Post
My main aim is to detect number of database servers installed on the system... then i intend to scan the config files of these servers to check if they are securely configured...
That's an ambitious goal......

There are many DB servers out there, most common are Oracle, MySQL, PostgreSQL, DB2, Sybase and Ingres (I might have overlook one or two as I'm not a DB admin).

The same is true for web servers. Common are: Apache, Nginx, Lighttpd and Sun ONE Web Server (don't know if oracle renamed it).
But you probably need to look at application servers too. Common are: Tomcat, JBoss, WebSphere and BEA Weblogic.

Depending on the platform/distro used the essential files may be in different locations.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
To find the version of ncurses installed on linux system though shell command Gurpreet1 Linux - Newbie 4 12-21-2018 06:14 AM
already installed 'libunwind' but system can't find it. kjg0508 Linux - Software 3 04-15-2013 03:06 AM
Linux File System. Can't find Installed pkg. Ace Blackwell Slackware 6 01-27-2013 12:08 AM
How to find the installed version of a rpm package in a system?? Arighna Linux - Newbie 10 09-21-2011 09:22 AM
fedora 11 installed in my system,after that unable to find my old rhel 5.2. aneeshkumarev Linux - Software 1 07-23-2009 02:07 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:52 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration