EzDevInfo.com

centos6.5 interview questions

Top centos6.5 frequently asked interview questions

Why do many init.d scripts end in "exit $?"?

I've seen a lot of strange quirks in CentOS 6.5's init.d scripts, but one pattern I've seen at the end of most of these scripts is

case "$1" in
    # ... commands here
esac
exit $?

What is the purpose of "exit $?" here?


Source: (StackOverflow)

Matching a border of a russian word with \b

Is this a bug or am I doing something wrong (when trying to match Russian swear words in a multiplayer game chat log) on CentOS 6.5 with the stock perl 5.10.1?

# echo блядь | perl -ne 'print if /\bбля/'

# echo блядь | perl -ne 'print if /бля/'
блядь

# echo $LANG
en_US.UTF-8

Why doesn't the first command print anything?


Source: (StackOverflow)

Advertisements

g++ does not include files it says it includes for C++11?

Short version

When I compile even a simple code using a feature of the C++11 standard (the std::stod function), GCC 4.9.1 fails with the following error:

example.cpp: In function 'int main()':
example.cpp:10:18: error: 'stod' is not a member of 'std'
   double earth = std::stod (orbits,&sz);
                  ^
example.cpp:11:17: error: 'stod' is not a member of 'std'
   double moon = std::stod (orbits.substr(sz));
                 ^

What?

The command I use is g++ -std=c++11 example.cpp.

This is the test code (which compiles fine on other systems):

// stod example from http://www.cplusplus.com/reference/string/stod/
#include <iostream>   // std::cout
#include <string>     // std::string, std::stod

int main ()
{
  std::string orbits ("365.24 29.53");
  std::string::size_type sz;     // alias of size_t

  double earth = std::stod (orbits,&sz);
  double moon = std::stod (orbits.substr(sz));
  std::cout << "The moon completes " << (earth/moon) << " orbits per Earth year.\n";
  return 0;
}

details

I am using a version of GCC 4.9.1 I compiled myself on two different clusters running CentOS 6.5 (I use the modules system on stuff in my home dir since I'm not an admin).

I will call them cluster 1 and cluster 2: cluster 1 is where the failure happens.

The GCCs were compiled in the same way and at the same time, and loaded using identical module files (save for a minor difference in the base path). The installations are, as far as I can easily check, identical (the same include files exist on both clusters, and have the same contents).

The output from g++ -v is the same on both clusters (again, except for the install path):

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/andyras/bin/gcc-4.9.1/libexec/gcc/x86_64-unknown-linux-gnu/4.9.1/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.9.1/configure --prefix=/home/andyras/bin/gcc-4.9.1 --enable-languages=c,c++,fortran
Thread model: posix
gcc version 4.9.1 (GCC)

g++ -v using the system GCC gives the same output on both clusters, except on cluster 1 it says it is gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) and on cluster 2 says gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC)

I am trying to debug using g++ -std=c++11 -save-temps -MD example.cpp for more info... this gives some clues, but I don't know where to go from here.

The intermediate (.ii) files on cluster 1 are missing some lines, for example (excerpt from diffing the .ii files):

< # 277 "/opt/gcc-4.9.1/include/c++/4.9.1/cwchar" 3
---
> # 277 "/home/andyras/bin/gcc-4.9.1/include/c++/4.9.1/cwchar" 3
961,963c934,936
<   using std::wcstold;
<   using std::wcstoll;
<   using std::wcstoull;
---
> 
> 
>

As I interpret it, GCC on both clusters tries to include files like cwchar, but on cluster 1 there are blank lines instead of things being defined. On cluster 2 the stod function is in the intermediate file, but not on cluster 1.

Could it be a preprocessor error?

Now looking at the .d (dependency) files, I also see a concrete difference. There are some files listed on cluster 2 that are not listed on cluster 1. Here is the list (I processed the contents of the .d files to account for the different base paths; // stands in for the install path):

85a86,108
> //gcc-4.9.1/include/c++/4.9.1/ext/string_conversions.h
> //gcc-4.9.1/include/c++/4.9.1/cstdlib
> /usr/include/stdlib.h
> /usr/include/bits/waitflags.h
> /usr/include/bits/waitstatus.h
> /usr/include/sys/types.h
> /usr/include/sys/select.h
> /usr/include/bits/select.h
> /usr/include/bits/sigset.h
> /usr/include/sys/sysmacros.h
> /usr/include/alloca.h
> //gcc-4.9.1/include/c++/4.9.1/cstdio
> /usr/include/libio.h
> /usr/include/_G_config.h
> /usr/include/bits/stdio_lim.h
> /usr/include/bits/sys_errlist.h
> //gcc-4.9.1/include/c++/4.9.1/cerrno
> /usr/include/errno.h
> /usr/include/bits/errno.h
> /usr/include/linux/errno.h
> /usr/include/asm/errno.h
> /usr/include/asm-generic/errno.h
> /usr/include/asm-generic/errno-base.h

I was curious if cpp was looking for includes in all the wrong places, but this seems legit (cpp -v):

#include <...> search starts here:
 /home/andyras/bin/gcc-4.9.1/include
 /home/andyras/bin/gcc-4.9.1/include/c++/4.9.1/
 /home/andyras/bin/gcc-4.9.1/include/c++/4.9.1/x86_64-unknown-linux-gnu/
 /home/andyras/bin/gcc-4.9.1/lib/gcc/x86_64-unknown-linux-gnu/4.9.1/include
 /usr/local/include
 /home/andyras/bin/gcc-4.9.1/lib/gcc/x86_64-unknown-linux-gnu/4.9.1/include-fixed
 /usr/include
End of search list.

This has been a very frustrating couple of hours trying to track down the source of the problem. I could, of course, use something like atof(myString.c_str()) instead of std::stod, but I am wondering if there is an underlying issue that will foul up future projects using other bits of C++11.

Any more clues or insight would be very much appreciated.


Source: (StackOverflow)

SSH into a docker container from another container on a different host

I have a docker container running on an EC2 host, and another running on another ec2 host. How do I ssh from one to another, without providing any port numbers? I want to do something like ssh root@ip-address-of-container


Source: (StackOverflow)

How to remove all packages from specific repo without dependencies

I know following code will remove all package from specific repo.

yum remove $(yum list installed | grep rpmforge | awk '{ print $1 }')

And following code will remove a package without dependencies.

rpm -e --nodeps "php-sqlite2-5.1.6-200705230937"

But i don't know how to use together.


Source: (StackOverflow)

Android Studio not communicating with adb GLIBC .... not found error

Android studio was communicating with adb normally. Right after updating platform-tools to version 23, android studio stopped communicating with adb.

It displays the message:

Unable to create Debug Bridge: Unable to start adb server: Unable to detect adb version, adb output: /data/programs/android-sdk/platform-tools/adb: /lib64/libc.so.6: version 'GLIBC_2.14' not found (required by /data/programs/android-sdk/platform-tools/adb) /data/programs/android-sdk/platform-tools/adb: /lib64/libc.so.6: version 'GLIBC_2.15' not found (required by /data/programs/android-sdk/platform-tools/adb)

I have Centos 6.5 (final) Kernel Linux 2.6.32.431.el6.x86_64 Gnome 2.28.2


Source: (StackOverflow)

make fails trying to install mongo php driver on Centos 6

I've tried two different ways to install the mongodb php driver.

The server is Centos 6.6 (32-bit) that was originally a 6.5 virtualbox image that (following an update) now calls itself 6.6

The error seems to start here:

In file included from /var/tmp/mongo/io_stream.c:34:
/var/tmp/mongo/contrib/php-ssl.h:33:25: error: openssl/evp.h: No such file or directory
/var/tmp/mongo/contrib/php-ssl.h:34:26: error: openssl/x509.h: No such file or directory
/var/tmp/mongo/contrib/php-ssl.h:35:28: error: openssl/x509v3.h: No such file or directory
In file included from /var/tmp/mongo/io_stream.c:34:
/var/tmp/mongo/contrib/php-ssl.h:38: error: expected ‘)’ before ‘*’ token
/var/tmp/mongo/contrib/php-ssl.h:39: error: expected ‘)’ before ‘*’ token
/var/tmp/mongo/contrib/php-ssl.h:40: error: expected ‘)’ before ‘*’ token
/var/tmp/mongo/io_stream.c: In function ‘php_mongo_io_stream_connect’:
/var/tmp/mongo/io_stream.c:189: error: ‘X509’ undeclared (first use in this function)
/var/tmp/mongo/io_stream.c:189: error: (Each undeclared identifier is reported only once
/var/tmp/mongo/io_stream.c:189: error: for each function it appears in.)
/var/tmp/mongo/io_stream.c:189: error: ‘cert’ undeclared (first use in this function)
/var/tmp/mongo/io_stream.c:194: error: expected expression before ‘)’ token
make: *** [io_stream.lo] Error 1
ERROR: `make' failed

-other items of note:

php -v
PHP 5.6.6 (cli) (built: Feb 19 2015 10:19:59)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies

mongo --version
MongoDB shell version: 2.6.8
openssl is installed 1.0.1e-30.e16_6_6.5.i686

I've checked other (seemingly related) Stack posts, such as MongoDB PHP driver can't installed Centos 6 cloud server - but it didn't seem to help or apply. Any ideas? Thanks.


Source: (StackOverflow)

Can't open cursor lib 'libodbccr'

Im trying to connect to a .mdb file, and installed MDBTools

When I run the php script this is the error I get;

[unixODBC][Driver Manager]Can't open cursor lib 'libodbccr'

Under /usr/lib64 I find the following similar libs;

  • libodbccr.so.2
  • libodbccr.so.2.0.0

Is there a config file I need to edit, because to me it seems like the lib is there, just that unixODBC cant find it?

Any help would be greatly appreciated!


Source: (StackOverflow)

Problems With PHP Path Prefix when Compiling from Source

I'm following these two articles to install multiple versions of PHP while compiling from source: http://www.sitepoint.com/run-multiple-versions-php-one-server/ http://www.phpinternalsbook.com/build_system/building_php.html

I'm trying to install PHP 5.6 into /opt/php56 (a directory I've created) however, when I run ./buildconf and then run the following, PHP overwrites itself.

How I compile PHP:

./buildconf (does its thing)...

./configure \
--prefix-dir=/opt/php56/ \
--disable-opcache \
--enable-bcmath \
--enable-calendar \
--enable-ftp \
--enable-gd-native-ttf \
--enable-libxml \
--with-libxml-dir=/opt/xml2/ \
--enable-pdo=shared \
--with-pdo-mysql=shared \
--with-pdo-sqlite=shared \
--enable-sockets \
--prefix=/usr/local \
--with-apxs2=/usr/local/apache/bin/apxs \
--with-curl=/opt/curlssl/ \
--with-freetype-dir=/usr \
--with-gd \
--with-imap=/opt/php_with_imap_client/ \
--with-imap-ssl=/usr \
--with-jpeg-dir=/usr \
--with-kerberos \
--with-libdir=lib64 \
--with-mcrypt=/opt/libmcrypt/ \
--with-mysql=/usr \
--with-mysql-sock=/var/lib/mysql/mysql.sock \
--with-openssl=/usr \
--with-openssl-dir=/usr \
--with-pcre-regex=/opt/pcre \
--with-pic \
--with-png-dir=/usr \
--with-xpm-dir=/usr \
--with-zlib \
--with-zlib-dir=/usr \
--enable-soap \

 make 
 make install (which installs everything to /usr/local/bin, despite the set prefix on ./configure). 

What happens when I run the following:

root ~>># which php
/usr/local/bin/php

root ~>># sudo -u foo which php
/usr/bin/php

What am I doing wrong with the --prefix ? The last install I did, I ran ./configure --prefix=/opt/php56/ and this too didn't take.


Source: (StackOverflow)

cannot run shellinabox through a php api on centos

I want to start shellinabox on centos through a php api.

When the user hits the api, shellinaboxd -p 'portno' command should get executed and shellinabox should start on the particular port number.

But this does not happen, instead this error comes Error :

Failed to find any available port [on tail -f /var/log/httpd/error_log] The code below runs correctly on ubuntu but not on centos.
Consider rest all things working fine.

$app->get('/test', function() {
    exec('shellinaboxd -p '.$port);
});

Executing:

shellinaboxd -p 'someport' on bash also works fine.

I have php5.5 and apache2 installed on my system.


Source: (StackOverflow)

CentOS - yum install - Fails: Protected Multilib versions: problems found libselinux

I have CentOS 6.5

I'm trying to intsall git via yum but getting an error while installing the pre-requisite packages. I don't need to but it doesn't hurt running sudo with root.

Error message:

--> Finished Dependency Resolution
Error:  Multilib version problems found. This often means that the root
       cause is something else and multilib version checking is just
       pointing out that there is a problem. Eg.:

         1. You have an upgrade for libselinux which is missing some
            dependency that another package requires. Yum is trying to
            solve this by installing an older version of libselinux of the
            different architecture. If you exclude the bad architecture
            yum will tell you what the root cause is (which package
            requires what). You can try redoing the upgrade with
            --exclude libselinux.otherarch ... this should give you an error
            message showing the root cause of the problem.

         2. You have multiple architectures of libselinux installed, but
            yum can only see an upgrade for one of those arcitectures.
            If you don't want/need both architectures anymore then you
            can remove the one with the missing update and everything
            will work.

         3. You have duplicate versions of libselinux installed already.
            You can use "yum check" to get yum show these errors.

       ...you can also use --setopt=protected_multilib=false to remove
       this checking, however this is almost never the correct thing to
       do as something else is very likely to go wrong (often causing
       much more problems).

       Protected multilib versions: libselinux-2.0.94-5.3.el6_4.1.i686 != libselinux-2.0.94-5.8.el6.x86_64
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

Full log:

[root@server01 ~]# sudo yum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Setting up Install Process
Package gcc-4.4.7-4.el6.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package expat-devel.x86_64 0:2.0.1-11.el6_2 will be installed
---> Package gettext-devel.x86_64 0:0.17-16.el6 will be installed
--> Processing Dependency: gettext-libs = 0.17-16.el6 for package: gettext-devel-0.17-16.el6.x86_64
--> Processing Dependency: gettext = 0.17-16.el6 for package: gettext-devel-0.17-16.el6.x86_64
--> Processing Dependency: libgettextsrc-0.17.so()(64bit) for package: gettext-devel-0.17-16.el6.x86_64
--> Processing Dependency: libgettextpo.so.0()(64bit) for package: gettext-devel-0.17-16.el6.x86_64
--> Processing Dependency: libgettextlib-0.17.so()(64bit) for package: gettext-devel-0.17-16.el6.x86_64
--> Processing Dependency: libgcj_bc.so.1()(64bit) for package: gettext-devel-0.17-16.el6.x86_64
--> Processing Dependency: libasprintf.so.0()(64bit) for package: gettext-devel-0.17-16.el6.x86_64
---> Package libcurl-devel.x86_64 0:7.19.7-37.el6_4 will be installed
--> Processing Dependency: libidn-devel for package: libcurl-devel-7.19.7-37.el6_4.x86_64
--> Processing Dependency: automake for package: libcurl-devel-7.19.7-37.el6_4.x86_64
---> Package openssl-devel.x86_64 0:1.0.1e-30.el6 will be installed
--> Processing Dependency: openssl = 1.0.1e-30.el6 for package: openssl-devel-1.0.1e-30.el6.x86_64
--> Processing Dependency: krb5-devel for package: openssl-devel-1.0.1e-30.el6.x86_64
---> Package perl-ExtUtils-MakeMaker.x86_64 0:6.55-136.el6 will be installed
--> Processing Dependency: perl-devel for package: perl-ExtUtils-MakeMaker-6.55-136.el6.x86_64
--> Processing Dependency: perl(Test::Harness) for package: perl-ExtUtils-MakeMaker-6.55-136.el6.x86_64
---> Package zlib-devel.x86_64 0:1.2.3-29.el6 will be installed
--> Running transaction check
---> Package automake.noarch 0:1.11.1-4.el6 will be installed
--> Processing Dependency: autoconf >= 2.62 for package: automake-1.11.1-4.el6.noarch
---> Package gettext.x86_64 0:0.17-16.el6 will be installed
--> Processing Dependency: cvs for package: gettext-0.17-16.el6.x86_64
---> Package gettext-libs.x86_64 0:0.17-16.el6 will be installed
---> Package krb5-devel.x86_64 0:1.10.3-37.el6_6 will be installed
--> Processing Dependency: krb5-libs = 1.10.3-37.el6_6 for package: krb5-devel-1.10.3-37.el6_6.x86_64
--> Processing Dependency: libselinux-devel for package: krb5-devel-1.10.3-37.el6_6.x86_64
--> Processing Dependency: libcom_err-devel for package: krb5-devel-1.10.3-37.el6_6.x86_64
--> Processing Dependency: keyutils-libs-devel for package: krb5-devel-1.10.3-37.el6_6.x86_64
---> Package libgcj.x86_64 0:4.4.7-4.el6 will be installed
--> Processing Dependency: zip >= 2.1 for package: libgcj-4.4.7-4.el6.x86_64
--> Processing Dependency: libart_lgpl >= 2.1.0 for package: libgcj-4.4.7-4.el6.x86_64
--> Processing Dependency: gtk2 >= 2.4.0 for package: libgcj-4.4.7-4.el6.x86_64
--> Processing Dependency: libasound.so.2(ALSA_0.9)(64bit) for package: libgcj-4.4.7-4.el6.x86_64
--> Processing Dependency: libpangoft2-1.0.so.0()(64bit) for package: libgcj-4.4.7-4.el6.x86_64
--> Processing Dependency: libpangocairo-1.0.so.0()(64bit) for package: libgcj-4.4.7-4.el6.x86_64
--> Processing Dependency: libpango-1.0.so.0()(64bit) for package: libgcj-4.4.7-4.el6.x86_64
--> Processing Dependency: libgtk-x11-2.0.so.0()(64bit) for package: libgcj-4.4.7-4.el6.x86_64
--> Processing Dependency: libgdk_pixbuf-2.0.so.0()(64bit) for package: libgcj-4.4.7-4.el6.x86_64
--> Processing Dependency: libgdk-x11-2.0.so.0()(64bit) for package: libgcj-4.4.7-4.el6.x86_64
--> Processing Dependency: libfreetype.so.6()(64bit) for package: libgcj-4.4.7-4.el6.x86_64
--> Processing Dependency: libfontconfig.so.1()(64bit) for package: libgcj-4.4.7-4.el6.x86_64
--> Processing Dependency: libcairo.so.2()(64bit) for package: libgcj-4.4.7-4.el6.x86_64
--> Processing Dependency: libatk-1.0.so.0()(64bit) for package: libgcj-4.4.7-4.el6.x86_64
--> Processing Dependency: libasound.so.2()(64bit) for package: libgcj-4.4.7-4.el6.x86_64
--> Processing Dependency: libXtst.so.6()(64bit) for package: libgcj-4.4.7-4.el6.x86_64
--> Processing Dependency: libXrender.so.1()(64bit) for package: libgcj-4.4.7-4.el6.x86_64
--> Processing Dependency: libXrandr.so.2()(64bit) for package: libgcj-4.4.7-4.el6.x86_64
--> Processing Dependency: libSM.so.6()(64bit) for package: libgcj-4.4.7-4.el6.x86_64
--> Processing Dependency: libICE.so.6()(64bit) for package: libgcj-4.4.7-4.el6.x86_64
---> Package libidn-devel.x86_64 0:1.18-2.el6 will be installed
---> Package openssl.x86_64 0:1.0.1e-15.el6 will be updated
---> Package openssl.x86_64 0:1.0.1e-30.el6 will be an update
---> Package perl-Test-Harness.x86_64 0:3.17-136.el6 will be installed
---> Package perl-devel.x86_64 4:5.10.1-136.el6 will be installed
--> Processing Dependency: perl(ExtUtils::ParseXS) for package: 4:perl-devel-5.10.1-136.el6.x86_64
--> Processing Dependency: gdbm-devel for package: 4:perl-devel-5.10.1-136.el6.x86_64
--> Processing Dependency: db4-devel for package: 4:perl-devel-5.10.1-136.el6.x86_64
--> Running transaction check
---> Package alsa-lib.x86_64 0:1.0.22-3.el6 will be installed
---> Package atk.x86_64 0:1.30.0-1.el6 will be installed
---> Package autoconf.noarch 0:2.63-5.1.el6 will be installed
---> Package cairo.x86_64 0:1.8.8-3.1.el6 will be installed
--> Processing Dependency: libpng12.so.0(PNG12_0)(64bit) for package: cairo-1.8.8-3.1.el6.x86_64
--> Processing Dependency: libpng12.so.0()(64bit) for package: cairo-1.8.8-3.1.el6.x86_64
--> Processing Dependency: libpixman-1.so.0()(64bit) for package: cairo-1.8.8-3.1.el6.x86_64
--> Processing Dependency: libX11.so.6()(64bit) for package: cairo-1.8.8-3.1.el6.x86_64
---> Package cvs.x86_64 0:1.11.23-16.el6 will be installed
---> Package db4-devel.x86_64 0:4.7.25-18.el6_4 will be installed
--> Processing Dependency: db4-cxx = 4.7.25-18.el6_4 for package: db4-devel-4.7.25-18.el6_4.x86_64
--> Processing Dependency: libdb_cxx-4.7.so()(64bit) for package: db4-devel-4.7.25-18.el6_4.x86_64
---> Package fontconfig.x86_64 0:2.8.0-3.el6 will be installed
---> Package freetype.x86_64 0:2.3.11-14.el6_3.1 will be installed
---> Package gdbm-devel.x86_64 0:1.8.0-36.el6 will be installed
---> Package gtk2.x86_64 0:2.20.1-4.el6 will be installed
--> Processing Dependency: libtiff >= 3.6.1 for package: gtk2-2.20.1-4.el6.x86_64
--> Processing Dependency: libjpeg.so.62(LIBJPEG_6.2)(64bit) for package: gtk2-2.20.1-4.el6.x86_64
--> Processing Dependency: hicolor-icon-theme for package: gtk2-2.20.1-4.el6.x86_64
--> Processing Dependency: libtiff.so.3()(64bit) for package: gtk2-2.20.1-4.el6.x86_64
--> Processing Dependency: libjpeg.so.62()(64bit) for package: gtk2-2.20.1-4.el6.x86_64
--> Processing Dependency: libjasper.so.1()(64bit) for package: gtk2-2.20.1-4.el6.x86_64
--> Processing Dependency: libcups.so.2()(64bit) for package: gtk2-2.20.1-4.el6.x86_64
--> Processing Dependency: libXinerama.so.1()(64bit) for package: gtk2-2.20.1-4.el6.x86_64
--> Processing Dependency: libXi.so.6()(64bit) for package: gtk2-2.20.1-4.el6.x86_64
--> Processing Dependency: libXfixes.so.3()(64bit) for package: gtk2-2.20.1-4.el6.x86_64
--> Processing Dependency: libXext.so.6()(64bit) for package: gtk2-2.20.1-4.el6.x86_64
--> Processing Dependency: libXdamage.so.1()(64bit) for package: gtk2-2.20.1-4.el6.x86_64
--> Processing Dependency: libXcursor.so.1()(64bit) for package: gtk2-2.20.1-4.el6.x86_64
--> Processing Dependency: libXcomposite.so.1()(64bit) for package: gtk2-2.20.1-4.el6.x86_64
---> Package keyutils-libs-devel.x86_64 0:1.4-4.el6 will be installed
---> Package krb5-libs.x86_64 0:1.10.3-10.el6_4.6 will be updated
---> Package krb5-libs.x86_64 0:1.10.3-37.el6_6 will be an update
---> Package libICE.x86_64 0:1.0.6-1.el6 will be installed
---> Package libSM.x86_64 0:1.2.1-2.el6 will be installed
---> Package libXrandr.x86_64 0:1.4.0-1.el6 will be installed
---> Package libXrender.x86_64 0:0.9.7-2.el6 will be installed
---> Package libXtst.x86_64 0:1.2.1-2.el6 will be installed
---> Package libart_lgpl.x86_64 0:2.3.20-5.1.el6 will be installed
---> Package libcom_err-devel.x86_64 0:1.41.12-18.el6 will be installed
---> Package libselinux-devel.x86_64 0:2.0.94-5.3.el6_4.1 will be installed
--> Processing Dependency: libselinux = 2.0.94-5.3.el6_4.1 for package: libselinux-devel-2.0.94-5.3.el6_4.1.x86_64
--> Processing Dependency: libsepol-devel >= 2.0.32-1 for package: libselinux-devel-2.0.94-5.3.el6_4.1.x86_64
--> Processing Dependency: pkgconfig(libsepol) for package: libselinux-devel-2.0.94-5.3.el6_4.1.x86_64
---> Package pango.x86_64 0:1.28.1-7.el6_3 will be installed
--> Processing Dependency: libthai >= 0.1.9 for package: pango-1.28.1-7.el6_3.x86_64
--> Processing Dependency: libthai.so.0(LIBTHAI_0.1)(64bit) for package: pango-1.28.1-7.el6_3.x86_64
--> Processing Dependency: libthai.so.0()(64bit) for package: pango-1.28.1-7.el6_3.x86_64
--> Processing Dependency: libXft.so.2()(64bit) for package: pango-1.28.1-7.el6_3.x86_64
---> Package perl-ExtUtils-ParseXS.x86_64 1:2.2003.0-136.el6 will be installed
---> Package zip.x86_64 0:3.0-1.el6 will be installed
--> Running transaction check
---> Package cups-libs.x86_64 1:1.4.2-50.el6_4.5 will be installed
--> Processing Dependency: libgnutls.so.26(GNUTLS_1_4)(64bit) for package: 1:cups-libs-1.4.2-50.el6_4.5.x86_64
--> Processing Dependency: libgnutls.so.26()(64bit) for package: 1:cups-libs-1.4.2-50.el6_4.5.x86_64
--> Processing Dependency: libavahi-common.so.3()(64bit) for package: 1:cups-libs-1.4.2-50.el6_4.5.x86_64
--> Processing Dependency: libavahi-client.so.3()(64bit) for package: 1:cups-libs-1.4.2-50.el6_4.5.x86_64
---> Package db4-cxx.x86_64 0:4.7.25-18.el6_4 will be installed
---> Package hicolor-icon-theme.noarch 0:0.11-1.1.el6 will be installed
---> Package jasper-libs.x86_64 0:1.900.1-15.el6_1.1 will be installed
---> Package libX11.x86_64 0:1.5.0-4.el6 will be installed
--> Processing Dependency: libX11-common = 1.5.0-4.el6 for package: libX11-1.5.0-4.el6.x86_64
--> Processing Dependency: libxcb.so.1()(64bit) for package: libX11-1.5.0-4.el6.x86_64
---> Package libXcomposite.x86_64 0:0.4.3-4.el6 will be installed
---> Package libXcursor.x86_64 0:1.1.13-6.20130524git8f677eaea.el6 will be installed
---> Package libXdamage.x86_64 0:1.1.3-4.el6 will be installed
---> Package libXext.x86_64 0:1.3.1-2.el6 will be installed
---> Package libXfixes.x86_64 0:5.0-3.el6 will be installed
---> Package libXft.x86_64 0:2.3.1-2.el6 will be installed
---> Package libXi.x86_64 0:1.6.1-3.el6 will be installed
---> Package libXinerama.x86_64 0:1.1.2-2.el6 will be installed
---> Package libjpeg-turbo.x86_64 0:1.2.1-1.el6 will be installed
---> Package libpng.x86_64 2:1.2.49-1.el6_2 will be installed
---> Package libselinux.i686 0:2.0.94-5.3.el6_4.1 will be installed
--> Processing Dependency: libdl.so.2(GLIBC_2.1) for package: libselinux-2.0.94-5.3.el6_4.1.i686
--> Processing Dependency: libdl.so.2(GLIBC_2.0) for package: libselinux-2.0.94-5.3.el6_4.1.i686
--> Processing Dependency: libdl.so.2 for package: libselinux-2.0.94-5.3.el6_4.1.i686
--> Processing Dependency: libc.so.6(GLIBC_2.8) for package: libselinux-2.0.94-5.3.el6_4.1.i686
--> Processing Dependency: ld-linux.so.2(GLIBC_2.3) for package: libselinux-2.0.94-5.3.el6_4.1.i686
--> Processing Dependency: ld-linux.so.2 for package: libselinux-2.0.94-5.3.el6_4.1.i686
---> Package libsepol-devel.x86_64 0:2.0.41-4.el6 will be installed
---> Package libthai.x86_64 0:0.1.12-3.el6 will be installed
---> Package libtiff.x86_64 0:3.9.4-9.el6_3 will be installed
---> Package pixman.x86_64 0:0.26.2-5.el6_4 will be installed
--> Running transaction check
---> Package avahi-libs.x86_64 0:0.6.25-12.el6 will be installed
---> Package glibc.x86_64 0:2.12-1.132.el6 will be updated
--> Processing Dependency: glibc = 2.12-1.132.el6 for package: glibc-devel-2.12-1.132.el6.x86_64
--> Processing Dependency: glibc = 2.12-1.132.el6 for package: glibc-headers-2.12-1.132.el6.x86_64
--> Processing Dependency: glibc = 2.12-1.132.el6 for package: glibc-common-2.12-1.132.el6.x86_64
---> Package glibc.i686 0:2.12-1.149.el6_6.5 will be installed
--> Processing Dependency: libfreebl3.so(NSSRAWHASH_3.12.3) for package: glibc-2.12-1.149.el6_6.5.i686
--> Processing Dependency: libfreebl3.so for package: glibc-2.12-1.149.el6_6.5.i686
---> Package glibc.x86_64 0:2.12-1.149.el6_6.5 will be an update
---> Package gnutls.x86_64 0:2.8.5-10.el6_4.2 will be installed
---> Package libX11-common.noarch 0:1.5.0-4.el6 will be installed
---> Package libxcb.x86_64 0:1.8.1-1.el6 will be installed
--> Processing Dependency: libXau.so.6()(64bit) for package: libxcb-1.8.1-1.el6.x86_64
--> Running transaction check
---> Package glibc-common.x86_64 0:2.12-1.132.el6 will be updated
---> Package glibc-common.x86_64 0:2.12-1.149.el6_6.5 will be an update
---> Package glibc-devel.x86_64 0:2.12-1.132.el6 will be updated
---> Package glibc-devel.x86_64 0:2.12-1.149.el6_6.5 will be an update
---> Package glibc-headers.x86_64 0:2.12-1.132.el6 will be updated
---> Package glibc-headers.x86_64 0:2.12-1.149.el6_6.5 will be an update
---> Package libXau.x86_64 0:1.0.6-4.el6 will be installed
---> Package nss-softokn-freebl.i686 0:3.14.3-9.el6 will be installed
--> Finished Dependency Resolution
Error:  Multilib version problems found. This often means that the root
       cause is something else and multilib version checking is just
       pointing out that there is a problem. Eg.:

         1. You have an upgrade for libselinux which is missing some
            dependency that another package requires. Yum is trying to
            solve this by installing an older version of libselinux of the
            different architecture. If you exclude the bad architecture
            yum will tell you what the root cause is (which package
            requires what). You can try redoing the upgrade with
            --exclude libselinux.otherarch ... this should give you an error
            message showing the root cause of the problem.

         2. You have multiple architectures of libselinux installed, but
            yum can only see an upgrade for one of those arcitectures.
            If you don't want/need both architectures anymore then you
            can remove the one with the missing update and everything
            will work.

         3. You have duplicate versions of libselinux installed already.
            You can use "yum check" to get yum show these errors.

       ...you can also use --setopt=protected_multilib=false to remove
       this checking, however this is almost never the correct thing to
       do as something else is very likely to go wrong (often causing
       much more problems).

       Protected multilib versions: libselinux-2.0.94-5.3.el6_4.1.i686 != libselinux-2.0.94-5.8.el6.x86_64
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest
[root@server01 ~]#

yum repolist shows me:

[root@server01 ~]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
repo id                                                                          repo name                                                                                    status
puppetlabs-deps                                                                  Puppet Labs Dependencies El 6 - x86_64                                                          77
puppetlabs-products                                                              Puppet Labs Products El 6 - x86_64                                                             538
release.update                                                                   6.6.5                                                                                        6,367
supplemental.release                                                             supplemental.6                                                                                  84
supplemental.release.update                                                      supplemental.6.6.5                                                                               1
repolist: 7,067
[root@server01 ~]#

Tried running the following commands but it's still errors out (it does some downloading/resolving dependencies but then finally fails with the following new error). yum-complete-transaction; yum-distro-sync; yum clean all; yum update

Transaction Check Error:
  file /usr/bin/extlookup2hiera from install of puppet-3.8.4-1.el6.noarch conflicts with file from package hiera-puppet-1.0.0-1.el6.noarch
  file /usr/lib/ruby/site_ruby/1.8/hiera/backend/puppet_backend.rb from install of puppet-3.8.4-1.el6.noarch conflicts with file from package hiera-puppet-1.0.0-1.el6.noarch
  file /usr/lib/ruby/site_ruby/1.8/hiera/scope.rb from install of puppet-3.8.4-1.el6.noarch conflicts with file from package hiera-puppet-1.0.0-1.el6.noarch
  file /usr/lib/ruby/site_ruby/1.8/hiera_puppet.rb from install of puppet-3.8.4-1.el6.noarch conflicts with file from package hiera-puppet-1.0.0-1.el6.noarch
  file /usr/lib/ruby/site_ruby/1.8/puppet/parser/functions/hiera.rb from install of puppet-3.8.4-1.el6.noarch conflicts with file from package hiera-puppet-1.0.0-1.el6.noarch
  file /usr/lib/ruby/site_ruby/1.8/puppet/parser/functions/hiera_array.rb from install of puppet-3.8.4-1.el6.noarch conflicts with file from package hiera-puppet-1.0.0-1.el6.noarch
  file /usr/lib/ruby/site_ruby/1.8/puppet/parser/functions/hiera_hash.rb from install of puppet-3.8.4-1.el6.noarch conflicts with file from package hiera-puppet-1.0.0-1.el6.noarch
  file /usr/lib/ruby/site_ruby/1.8/puppet/parser/functions/hiera_include.rb from install of puppet-3.8.4-1.el6.noarch conflicts with file from package hiera-puppet-1.0.0-1.el6.noarch

Error Summary
-------------

I saw this post to install extra package repo for CentOS 6 (x86_64) but that didn't help. With using this, now I'm getting a 3rd error.

# wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# rpm -ivh epel-release-6-8.noarch.rpm
warning: epel-release-6-8.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...                ########################################### [100%]
   1:epel-release           ########################################### [100%]
[root@server01 yum.repos.d]#

Now yum repolist shows an extra line (for extra packages - CentOS):

epel                                                                         Extra Packages for Enterprise Linux 6 - x86_64                                                   11,838

Still, running: sudo yum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker is still giving me the same error (that I got first as mentioned at top).

/etc/yum.repos.d contains -- # pwd; ls -l

/etc/yum.repos.d
total 32
-rw-r--r--  1 root root 14540 Nov  5  2012 epel-release-6-8.noarch.rpm
-rw-r--r--  1 root root   957 Nov  4  2012 epel.repo
-rw-r--r--  1 root root  1056 Nov  4  2012 epel-testing.repo
-rw-r--r--. 1 root root  1250 Jan 22  2014 puppetlabs.repo
-rw-r--r--. 1 root root   406 Dec  8 10:48 mycompany.redhat.repo

Puppetlabs.repo seems redundant for this post, the first 2 .repo files got installed here after I downloaded + installed the extra package repo rpm (as listed in the post/link above) and contents in mycompany.redhat.repo are:

[release.update]
name=$releasever.$YUM0
baseurl=http://manager/yum/$basearch/$releasever/$YUM0/Server
enabled=1
gpgcheck=0

[supplemental.release]
name=supplemental.$releasever
baseurl=http://manager/yum/$basearch/supplemental/$releasever
enabled=1
gpgcheck=0

[supplemental.release.update]
name=supplemental.$releasever.$YUM0
baseurl=http://manager/yum/$basearch/supplemental/$YUM0
enabled=1
gpgcheck=0

Source: (StackOverflow)

Scheduled cron jobs to run meteor on OS boot

I scheduled cron jobs for running project that developed with meteor when system boots on Debian 7 and Centous 6.5 . And everything was working good until to unknown reasons it crashed.

Cron contain command that run Rocket.Chat project that developed with meteor. When I run meteor command by ssh connection, Rocket.chat run until ssh connection was open.

And at the end I want to know how to run meteor or node.js project when system boots as that project does not crashed until system shutting down or kill cron.


Source: (StackOverflow)

chown in docker not changing user to root

I am fairly new to Docker and have been setting up a Dockerfile and compose file to start up a server for testing.

When running a centos:6.6 image with a volume mapped to my user directory in OSX and installing httpd, my user for var/www/html is 1000:ftp instead of root:root.

I need to change a folder to user apache:apache in order to be able to upload files to it and cannot get chown or chmod to make any changes in any folder under var/www/html.
I know this has to do with me mapping my volume to a location on my OS drive.

So, my question is..

Is there anyway to set it up so that I can change ownership of var/www/html?


Source: (StackOverflow)

Is it possible to run a script on a virtual machine after Vagrant finishes provisioning all of them?

I am using Vagrant v1.5.1 to create a cluster of virtual machines (VMs). After all the VMs are provisioned, is it possible to run a single script on one of the machines? The script I want to run will setup passwordless SSH from one VM to all the other VMs.

For example, my nodes provisioned in Vagrant (CentOS 6.5) are as follows.

  • node1
  • node2
  • node3
  • node4

My Vagrantfile looks like the following.

(1..4).each do |i|
 config.vm.define "node-#{i}" do |node|
  node.vm.box = "centos65"
  ...omitted..
 end
end

After all this is done, I then need to run a script on node1 to enable passwordless SSH to node2, node3, and node4.

I know you can run scripts as each VM is being provisioned, but in this case, I want to run a script after all VMs are provisioned, since I need all VMs to be up and running to run this last script.

Is this possible in Vagrant?

I realized that I can also iterate backwards too.

r = 4..1
(r.first).downto(r.last).each do |i|
 config.vm.define "node-#{i}" do |node|
  node.vm.box = "centos65"
  ...omitted..
  if i == 1
   node.vm.provision "shell" do |s|
    s.path = "/path/to/script.sh"
   end
  end
 end
end

This will work great, but, in reality, I also need to setup passwordless SSH from node2 to node1, node3, and node4. In the approach above, this could only ever work for node1, but not for node2 (since node1 will not be provisioned).

If there's a Vagrant plugin to allow password SSH between all nodes in my cluster, that would even be better.


Source: (StackOverflow)

Curl in php returns 404 response code even if url is working

I am using php 5.4 in CentOs 6.5

I am trying to get response code of a url below is my code snippet

$URL="http://www.bertuccis.com/#menu";
try{

    $c = curl_init();
    curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($c, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($c, CURLOPT_USERAGENT,'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36');
    curl_setopt($c, CURLOPT_URL, $URL);
    $contents = curl_exec($c);
    $httpCode = curl_getinfo($c, CURLINFO_HTTP_CODE);
    curl_close($c);

    echo 'Resp Code ' . $httpCode;
} catch(Exception $ex){
    print_r($ex);
}

It returns 404 Http response code. If i try same url in browser, it returns 200 Ok.

I tried using curl -v on terminal of my centos machine but its working

Here is the version info of curl and php-curl

Curl lib in my centos is : curl 7.24.0 (x86_64-unknown-linux-gnu) libcurl/7.24.0

php-curl info in my php info :

cURL support => enabled
cURL Information => 7.19.7
Age => 3
Features
AsynchDNS => No
Debug => No
GSS-Negotiate => Yes
IDN => Yes
IPv6 => Yes
Largefile => Yes
NTLM => Yes
SPNEGO => No
SSL => Yes
SSPI => No
krb4 => No
libz => Yes
CharConv => No
Protocols => tftp, ftp, telnet, dict, ldap, ldaps, http, file, https, ftps, scp, sftp
Host => x86_64-redhat-linux-gnu
SSL Version => NSS/3.15.3
ZLib Version => 1.2.3
libSSH Version => libssh2/1.4.2

Source: (StackOverflow)