Tuesday, 31 May 2016

Installing chef client on a Solaris server


To install chef client in a Solaris server we need to install ruby & rubygems packages which in turn have gcc as a dependency.
To install ruby & rubygems from source download the tarball & extract it.

root@solaristest:/tmp# tar xvf ruby-1.8.7-p302.tar
x ruby-1.8.7-p302, 0 bytes, 0 tape blocks
x ruby-1.8.7-p302/lib, 0 bytes, 0 tape blocks
x ruby-1.8.7-p302/lib/drb.rb, 19 bytes, 1 tape blocks
---------------------------------- -------------- -------------------- ----- output truncated

cd ruby-1.8.7-p302

Now run ./configure:

root@solaristest:/tmp/ruby-1.8.7-p302# ./configure
checking build system type... sparc-sun-solaris2.10
checking host system type... sparc-sun-solaris2.10
checking target system type... sparc-sun-solaris2.10
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
---------------------------------- -------------- -------------------- ----- output truncated

Now run make:

root@solaristest:/tmp/ruby-1.8.7-p302# make
make: Warning: Illegal dependency list for target `.DEFAULT'
gcc -g -O2    -DRUBY_EXPORT -I. -I.    -c array.c
gcc -g -O2    -DRUBY_EXPORT -I. -I.    -c bignum.c
gcc -g -O2    -DRUBY_EXPORT -I. -I.    -c class.c
gcc -g -O2    -DRUBY_EXPORT -I. -I.    -c compar.c
gcc -g -O2    -DRUBY_EXPORT -I. -I.    -c dir.c
gcc -g -O2    -DRUBY_EXPORT -I. -I.    -c dln.c
gcc -g -O2    -DRUBY_EXPORT -I. -I.    -c enum.c
gcc -g -O2    -DRUBY_EXPORT -I. -I.    -c enumerator.c
gcc -g -O2    -DRUBY_EXPORT -I. -I.    -c error.c
gcc -g -O2    -DRUBY_EXPORT -I. -I.    -c eval.c
eval.c: In function `rb_eval_string_wrap':
eval.c:1744: warning: assignment discards qualifiers from pointer target type
---------------------------------- -------------- -------------------- ----- output truncated

Now run make install:

root@solaristest:/tmp/ruby-1.8.7-p302# make install
make: Warning: Illegal dependency list for target `.DEFAULT'
./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb  ./instruby.rb --make="make" --dest-dir=""  --extout=".ext"  --mflags=""  --make-flags=""  --data-mode=0644  --prog-mode=0755  --installed-list .installed.list --mantype="man"
installing binary commands
installing command scripts
installing library scripts
installing headers
installing manpages
installing extension objects
installing extension scripts

With this ruby is installed successfully. To check the version type:

root@solaristest:/tmp/ruby-1.8.7-p302# ruby --version
ruby 1.8.7 (2010-08-16 patchlevel 302) [sparc-solaris2.10]


To install rubygems package first extract the tarball as follows:

tar xvf rubygems-1.3.7.tar


Now go to the directory in which the files got extracted & run ruby setup.rb:
cd rubygems-1.3.7
ruby setup.rb

RubyGems 1.3.7 installed
=== 1.3.7 / 2010-05-13
NOTE:
http://rubygems.org is now the default source for downloading gems.
---------------------------------- -------------- -------------------- ----- output truncated

To check the installed version:

root@solaristest:/tmp/rubygems-1.3.7# gem --version
1.3.7

To install chef client download the client package from the chef official website.
Now run the following command to install the package:

root@solaristest:/tmp# pkgadd -d  chef-12.10.24-1.sparc.solaris chef

Processing package instance <chef> from </tmp/chef-12.10.24-1.sparc.solaris>

chef(sparc) 12.10.24-1
Chef Software, Inc. <maintainers@chef.io>
Using </opt> as the package base directory.
## Processing package information.
## Processing system information.
## Verifying disk space requirements.
## Checking for conflicts with packages already installed.
## Checking for setuid/setgid programs.

This package contains scripts which will be executed with super-user
permission during the process of installing this package.

Do you want to continue with the installation of <chef> [y,n,?] y

Installing chef as <chef>
---------------------------------- -------------- -------------------- ----- output truncated

To see the version of chef installed type:

root@solaristest:/tmp# pkginfo -l chef
   PKGINST:  chef
      NAME:  chef
  CATEGORY:  application
      ARCH:  sparc
   VERSION:  12.10.24-1
   BASEDIR:  /opt
    VENDOR:  Chef Software, Inc. <maintainers@chef.io>
      DESC:  The full stack of chef
    PSTAMP:  chef-solaris-10-sun4v-builder-a6fb8f.chef.co2016-04-27T18:37:34Z
  INSTDATE:  May 25 2016 09:41
     EMAIL:  Chef Software, Inc. <maintainers@chef.io>
    STATUS:  completely installed
     FILES:    13848 installed pathnames
                2005 directories
                 417 executables
              249756 blocks used (approx)


While working on this I encountered the following errors:

ERROR 1:

bash-3.2# ./configure
checking build system type... sparc-sun-solaris2.10
checking host system type... sparc-sun-solaris2.10
checking target system type... sparc-sun-solaris2.10
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/tmp/ruby-1.8.7-p302':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.

ERROR 2:

bash-3.2# make
bash: make: command not found

ERROR 3:

bash-3.2# ruby setup.rb
/usr/local/lib/ruby/1.8/sparc-solaris2.10/thread.so: ld.so.1: ruby: fatal: libgcc_s.so.1: open failed: No such file or directory - /usr/local/lib/ruby/1.8/sparc-solaris2.10/thread.so (LoadError)
        from /usr/local/lib/ruby/1.8/thread.rb:5
        from ./lib/rubygems.rb:11:in `require'
        from ./lib/rubygems.rb:11
        from setup.rb:24:in `require'
        from setup.rb:24

The fix for the above errors is rather simple.

Just define the following variables in /etc/profile file:

export PATH=$PATH:/usr/local/bin:/usr/ccs/bin:/usr/sfw/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

These contain paths for required entities like gcc & make which cause the above mentioned errors.


No comments:

Post a Comment

Using capture groups in grep in Linux

Introduction Let me start by saying that this article isn't about capture groups in grep per se. What we are going to do here with gr...