EzDevInfo.com

centos interview questions

Top centos frequently asked interview questions

nginx missing sites-available directory

I installed Nginx on Centos 6 and I am trying to set up virtual hosts. The problem I am having is that I can't seem to find the /etc/nginx/sites-available directory.

Is there something I need to do in order to create it? I know Nginx is up and running because I can browse to it.


Source: (StackOverflow)

index.php not loading by default

I have just installed centos, apache and php when I visit my site http://domain.com/myapp/, it says "forbidden" by default its not loading the index.php file.

When I visit http://domain.com/myapp/index.php, it works fine.

Any idea how to fix that issue ?


Source: (StackOverflow)

Advertisements

Where is my php.ini file? Linux, CentOS [duplicate]

This question already has an answer here:

I can't find PHP.ini location on my server. I've checked all stackoverflow answers but i can't find my php.ini location.

Please help me!

I have Linux, Cent OS, zPanel. Last version of PHP.

My computer: Linux Mint 15 KDE


Source: (StackOverflow)

How to install Java SDK on CentOS?`

I have CentOS 5, but I don't know the steps to install Java SDK on Linux.

Where to download the RPM file and what can I do next to fully install that.

Then I need to install Tomcat.

Or is there any ready-made package for all?


Source: (StackOverflow)

httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

CentOS 5.0

I tried to restart my apache server and got this messeage

httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

here is /etc/host file

127.0.0.1   server4-245 server4-245.com localhost.localdomain localhost
::1     localhost6.localdomain6 localhost6

here is /etc/sysconfig/network file

NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=server4-245

I also have this in apache httpd.conf file

ServerName localhost

However, I still get the first error messeage when I restart the apache.


Source: (StackOverflow)

CentOS 64 bit bad ELF interpreter

I have just installed CentOS 6 64bit version, I'm trying to install a 32-bit application on a 64-bit machine and got this error:

/lib/ld-linux.so.2: bad ELF interpreter: No such file or directory

I'm new to linux. How do I resolve this?


Source: (StackOverflow)

How do I find which rpm package supplies a file I'm looking for?

As an example, I am looking for a mod_files.sh file which presumably would come with the php-devel package. I guessed that yum would install the mod_files.sh file with the php-devel x86_64 5.1.6-23.2.el5_3 package , but the file appears to not to be installed on my filesystem. How do I find out which package installs the specific file? I'm looking for where I have not necessarily already locally downloaded the package which may include the file that I'm looking for?

I'm using CentOS 5.


Source: (StackOverflow)

How to use a different version of python during NPM install?

Salam (means Hello) :)

I have terminal access to a VPS running centos 5.9 and default python 2.4.3 installed. I also installed python 2.7.3 via these commands: (I used make altinstall instead of make install)

wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz
tar -xf Python-2.7.3.tgz
cd Python-2.7.3
./configure
make
make altinstall

then I installed node.js from source via these commands:

python2.7 ./configure
make
make install

The problem is, when I use npm install and try to install a node.js package which requires python > 2.4.3 I get this error:

gyp ERR! configure error
gyp ERR! stack Error: Python executable "python" is v2.4.3, which is not supported by gyp.
gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.
gyp ERR! stack     at failPythonVersion (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:125:14)
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:114:9

how should I "pass the --python switch to point to Python >= v2.5.0"?


Source: (StackOverflow)

centos 7 - open firewall port

I am using centos 7 and I have to ensure that ports 2888 and 3888 are open.

I read this article but this did not work because on centos 7 OS there is no iptables save command.

someone told me that the above URL is not valid for centos 7. and I should follow this

but this article is not clear to me on exactly what command I need to execute.

I also found

firewall-cmd --zone=public --add-port=2888/tcp 

but this does not survive reboots.

So how can I open the ports and make it survive reboots


Source: (StackOverflow)

Centos or Debian as a server OS? [closed]

What would you choose for a server used for web hosting, dns and email and why?


Source: (StackOverflow)

Automatically start forever (node) on system restart

I am using node's forever module to keep my node server running. Forever however terminates when there is a system restart. Is there any way I can automatically start the node server (with forever) when the system restarts?


Source: (StackOverflow)

Install python 2.6 in CentOS

I have a shell that runs CentOS.

For a project I'm doing, I need python 2.5+, but centOS is pretty dependent on 2.4.

From what I've read, a number of things will break if you upgrade to 2.5.

I want to install 2.5 separately from 2.4, but I'm not sure how to do it. So far I've downloaded the source tarball, untarred it, and did a ./configure --prefix=/opt which is where I want it to end up. Can I now just make, make install ? Or is there more?


Source: (StackOverflow)

How to grep a string in a directory and all its subdirectories' files in LINUX? [duplicate]

This question already has an answer here:

How to grep a string or a text in a directory and all its subdirectories'files in LINUX ??


Source: (StackOverflow)

Jenkins / Hudson environment variables

I am running Jenkins from user jenkins thats has $PATH set to something and when I go into Jenkins web interface, in the System Properties window (http://$host/systemInfo) I see a different $PATH.

I have installed Jenkins on Centos with the native rpm from Jenkins website. I am using the startup script provided with the installation using sudo /etc/init.d/jenkins start

Can anyone please explain to me why that happens?


Source: (StackOverflow)

Nginx 403 forbidden for all files

I have nginx installed with PHP-FPM on a CentOS 5 box, but am struggling to get it to serve any of my files - whether PHP or not.

Nginx is running as www-data:www-data, and the default "Welcome to nginx on EPEL" site (owned by root:root with 644 permissions) loads fine.

The nginx configuration file has an include directive for /etc/nginx/sites-enabled/*.conf, and I have a configuration file example.com.conf, thus:

server {
 listen 80;

 Virtual Host Name
 server_name www.example.com example.com;


 location / {
   root /home/demo/sites/example.com/public_html;
   index index.php index.htm index.html;
 }

 location ~ \.php$ {
  fastcgi_pass   127.0.0.1:9000;
  fastcgi_index  index.php;
  fastcgi_param  PATH_INFO $fastcgi_script_name;
  fastcgi_param  SCRIPT_FILENAME  /home/demo/sites/example.com/public_html$fastcgi_script_name;
  include        fastcgi_params;
 }
}

Despite public_html being owned by www-data:www-data with 2777 file permissions, this site fails to serve any content -

 [error] 4167#0: *4 open() "/home/demo/sites/example.com/public_html/index.html" failed (13: Permission denied), client: XX.XXX.XXX.XX, server: www.example.com, request: "GET /index.html HTTP/1.1", host: "www.example.com"

I've found numerous other posts with users getting 403s from nginx, but most that I have seen involve either more complex setups with Ruby/Passenger (which in the past I've actually succeeded with) or are only receiving errors when the upstream PHP-FPM is involved, so they seem to be of little help.

Have I done something silly here?


Source: (StackOverflow)