Category Archives: Linux

Install Puppet Enterprise

Install Puppet Enterprise Master

    1.  Download puppet enterprise package puppet-enterprise-2015.3.0-el-6-x86_64.tar.gz to your /tmp directory
    2. Extract package using command tar zxvf puppet-enterprise-2015.3.0-el-6-x86_64.tar.gz
    3. Install using answers file
      cd /tmp/puppet-enterprise-2015.3.0-el-6-x86_64
      ./puppet-enterprise-installer -a answers.txt

      Sample answers file is given below, substitute appropriate values as per your environment

      q_activity_database_name=pe-activity
      q_activity_database_password=HqVk2gI6rW9AEDoxJaOx
      q_activity_database_user=pe-activity
      q_all_in_one_install=y
      q_backup_and_purge_old_configuration=n
      q_backup_and_purge_old_database_directory=n
      q_classifier_database_name=pe-classifier
      q_classifier_database_password=Y2smINHrKS0fJXcWwWWg
      q_classifier_database_user=pe-classifier
      q_database_host=pe-master.localdomain
      q_database_install=y
      q_database_port=5432
      q_database_root_password=s4pwAT0iqoIv9PL6DB7x
      q_database_root_user=pe-postgres
      q_install=y
      q_pe_database=y
      q_puppet_cloud_install=n
      q_puppet_enterpriseconsole_auth_password=12345678
      q_puppet_enterpriseconsole_database_name=console
      q_puppet_enterpriseconsole_database_password=3Sky4FR5hUia5g3qMLGx
      q_puppet_enterpriseconsole_database_user=console
      q_puppet_enterpriseconsole_httpd_port=443
      q_puppet_enterpriseconsole_install=y
      q_puppet_enterpriseconsole_master_hostname=pe-master.localdomain
      q_puppetagent_certname=pe-master.localdomain
      q_puppetagent_install=y
      q_puppetagent_server=pe-master.localdomain
      q_puppetca_hostname=pe-master.localdomain
      q_puppetdb_database_name=pe-puppetdb
      q_puppetdb_database_password=qBDhK6rXvbDYyTbHqiuj
      q_puppetdb_database_user=pe-puppetdb
      q_puppetdb_hostname=pe-master.localdomain
      q_puppetdb_install=y
      q_puppetdb_plaintext_port=8080
      q_puppetdb_port=8081
      q_puppetmaster_certname=pe-master.localdomain
      q_puppetmaster_dnsaltnames=pe-master,pe-master.localdomain,puppet,puppet.localdomain
      q_puppetmaster_enterpriseconsole_certname=pe-master.localdomain
      q_puppetmaster_enterpriseconsole_hostname=pe-master.localdomain
      q_puppetmaster_install=y
      q_rbac_database_name=pe-rbac
      q_rbac_database_password=CqXv5sT3BPf0afkJG7wW
      q_rbac_database_user=pe-rbac
      q_run_updtvpkg=n
      q_vendor_packages_install=y
      q_enable_future_parser=y
    4. When installation is complete you’d see following messages on terminal
      --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      
      STEP 5: DONE
      
      Thanks for installing Puppet Enterprise!
      
         To learn more and get started using Puppet Enterprise, refer to the Puppet Enterprise Quick Start Guide (http://docs.puppetlabs.com/pe/latest/quick_start.html) and the Puppet Enterprise Deployment Guide (http://docs.puppetlabs.com/guides/deployment_guide/index.html).
      
         The console can be reached at the following URI:
          *  https://puppetmaster
      
      ======================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
      
      ## NOTES
      
         Puppet Enterprise has been installed to "/opt/puppetlabs," and its configuration files are located in "/etc/puppetlabs".
      
         Answers from this session saved to '/vagrant_data/puppet-enterprise-2015.3.0-el-6-x86_64/answers.lastrun.puppetmaster'
         In addition, auto-generated database users and passwords have been saved to '/etc/puppetlabs/installer/database_info.*'
         !!! WARNING: Do not discard these files! All auto-generated database users and passwords have been saved in them. You will need this information to configure the console role during installation.
      
         If you have a firewall running, please ensure the following TCP ports are open: 443, 4433, 8140, 61613
      
      --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      
      [root@puppetmaster puppet-enterprise-2015.3.0-el-6-x86_64]#

       

    5. Run following test command
      [root@puppetmaster puppet-enterprise-2015.3.0-el-6-x86_64]# puppet agent -t
      Info: Using configured environment 'production'
      Info: Retrieving pluginfacts
      Info: Retrieving plugin
      Info: Loading facts
      Info: Caching catalog for pe-master.localdomain
      Info: Applying configuration version '1460937326'
      Notice: Applied catalog in 9.52 seconds
      [root@puppetmaster puppet-enterprise-2015.3.0-el-6-x86_64]#

      If your output looks like above, you are ready to GO!

    6. Access puppet master console on https://<puppetmaster-hostname>:443If you used above answers file, your login user is admin and password is 12345678

Install Puppet Agent

  1. SSH into agent server
  2. Run following command, it will install puppet agent and integrate with your puppet master
    curl -k https://<puppetmaster-hostname>:8140/packages/current/install.bash | sudo bash

    [root@peagent01 ~]# curl -k https://puppetmaster:8140/packages/current/install.bash | sudo bash
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 14582  100 14582    0     0  76638      0 --:--:-- --:--:-- --:--:-- 2848k
    Loaded plugins: fastestmirror
    Cleaning repos: pe_repo
    Cleaning up Everything
    Cleaning up list of fastest mirrors
    Loaded plugins: fastestmirror
    Setting up Install Process
    Determining fastest mirrors
    pe_repo                                                                                                                                                                                         | 2.5 kB     00:00
    pe_repo/primary_db                                                                                                                                                                              |  23 kB     00:00
    Resolving Dependencies
    --> Running transaction check
    ---> Package puppet-agent.x86_64 0:1.3.2-1.el6 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    =======================================================================================================================================================================================================================
     Package                                                Arch                                             Version                                               Repository                                         Size
    =======================================================================================================================================================================================================================
    Installing:
     puppet-agent                                           x86_64                                           1.3.2-1.el6                                           pe_repo                                            35 M
    
    Transaction Summary
    =======================================================================================================================================================================================================================
    Install       1 Package(s)
    
    Total download size: 35 M
    Installed size: 124 M
    Downloading Packages:
    puppet-agent-1.3.2-1.el6.x86_64.rpm                                                                                                                                                             |  35 MB     00:01
    warning: rpmts_HdrFromFdno: Header V4 RSA/SHA1 Signature, key ID 4bd6ec30: NOKEY
    Retrieving key from https://pe-master.localdomain:8140/packages/GPG-KEY-puppetlabs
    Importing GPG key 0x4BD6EC30:
     Userid: "Puppet Labs Release Key (Puppet Labs Release Key) "
     From  : https://pe-master.localdomain:8140/packages/GPG-KEY-puppetlabs
    Running rpm_check_debug
    Running Transaction Test
    Transaction Test Succeeded
    Running Transaction
      Installing : puppet-agent-1.3.2-1.el6.x86_64                                                                                                                                                                     1/1
      Verifying  : puppet-agent-1.3.2-1.el6.x86_64                                                                                                                                                                     1/1 
    
    Installed:
      puppet-agent.x86_64 0:1.3.2-1.el6                                                                                                                                                                                    
    
    Complete!
    service { 'puppet':
      ensure => 'stopped',
    }
    Notice: /Service[puppet]/ensure: ensure changed 'stopped' to 'running'
    service { 'puppet':
      ensure => 'running',
      enable => 'true',
    }
    service { 'puppet':
      ensure => 'running',
      enable => 'true',
    }
    Notice: /File[/usr/local/bin/facter]/ensure: created
    file { '/usr/local/bin/facter':
      ensure   => 'link',
      selrange => 's0',
      selrole  => 'object_r',
      seltype  => 'bin_t',
      seluser  => 'system_u',
      target   => '/opt/puppetlabs/puppet/bin/facter',
    }
    Notice: /File[/usr/local/bin/puppet]/ensure: created
    file { '/usr/local/bin/puppet':
      ensure   => 'link',
      selrange => 's0',
      selrole  => 'object_r',
      seltype  => 'bin_t',
      seluser  => 'system_u',
      target   => '/opt/puppetlabs/puppet/bin/puppet',
    }
    Notice: /File[/usr/local/bin/pe-man]/ensure: created
    file { '/usr/local/bin/pe-man':
      ensure   => 'link',
      selrange => 's0',
      selrole  => 'object_r',
      seltype  => 'bin_t',
      seluser  => 'system_u',
      target   => '/opt/puppetlabs/puppet/bin/pe-man',
    }
    Notice: /File[/usr/local/bin/hiera]/ensure: created
    file { '/usr/local/bin/hiera':
      ensure   => 'link',
      selrange => 's0',
      selrole  => 'object_r',
      seltype  => 'bin_t',
      seluser  => 'system_u',
      target   => '/opt/puppetlabs/puppet/bin/hiera',
    }
    [root@peagent01 ~]#
  3. Go back to puppet master and run command puppet cert listyou would see new agent appearing in agent sign request list
    [root@puppetmaster puppet-enterprise-2015.3.0-el-6-x86_64]# puppet cert list
      "peagent01.mel.global.thenational.com" (SHA256) 94:75:22:10:50:4E:99:70:07:7A:F1:BF:0E:E1:EF:05:9D:71:A3:23:D3:A5:E3:70:E5:A1:53:6D:B1:BC:D9:AA
    [root@puppetmaster puppet-enterprise-2015.3.0-el-6-x86_64]#
  4. Run command to approve agent sign request puppet cert sign or puppet cert sign --all
    [root@puppetmaster puppet-enterprise-2015.3.0-el-6-x86_64]# puppet cert sign "peagent01.mel.global.thenational.com"
    Notice: Signed certificate request for peagent01.mel.global.thenational.com
    Notice: Removing file Puppet::SSL::CertificateRequest peagent01.mel.global.thenational.com at '/etc/puppetlabs/puppet/ssl/ca/requests/peagent01.mel.global.thenational.com.pem'
  5. Go back to agent node and run puppet agent -t
    [root@peagent01 ~]# puppet agent -t
    Info: Using configured environment 'production'
    Info: Retrieving pluginfacts
    Info: Retrieving plugin
    Info: Loading facts
    Info: Caching catalog for peagent01.mel.global.thenational.com
    Info: Applying configuration version '1460943893'
    Notice: Applied catalog in 0.61 seconds
    [root@peagent01 ~]#

    If output looks like above, ALL GOOD. ENJOY!!!!

rpmdb: Thread/process 6437/139875380000672 failed: Thread died in Berkeley DB library

Today I got following error while bootstrapping chef on one of my linux servers

 

Error:

techish-host rpmdb: Thread/process 6437/139875380000672 failed: Thread died in Berkeley DB library
techish-host error: db3 error(-30974) from dbenv->failchk: DB_RUNRECOVERY: Fatal error, run database recovery
techish-host error: cannot open Packages index using db3 -  (-30974)
techish-host error: cannot open Packages database in /var/lib/rpm
techish-host warning: /tmp/install.sh.7453/chef-11.8.0-1.el6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 83ef826a: NOKEY
techish-host rpmdb: Thread/process 6437/139875380000672 failed: Thread died in Berkeley DB library
techish-host error: db3 error(-30974) from dbenv->failchk: DB_RUNRECOVERY: Fatal error, run database recovery
techish-host error: cannot open Packages database in /var/lib/rpm

Root Cause:

rpm database is corrupt

Fix:

rm -rf  /var/lib/rpm/__db.00*
rpm --rebuilddb

Error provisioning VM with Vagrant

Problem:

Today I got following error while trying to provision a VM using Vagrant to test chef cookbooks

ishtiaqmedsmbp2:wmq Ishtiaq$ vagrant provision
[default] The cookbook path '/Users/Ishtiaq/chef-repo/cookbooks/wmq/cookbooks' doesn't exist. Ignoring...
[default] The cookbook path '/Users/Ishtiaq/chef-repo/cookbooks/wmq/roles' doesn't exist. Ignoring...
[default] The cookbook path '/Users/Ishtiaq/chef-repo/cookbooks/wmq/data_bags' doesn't exist. Ignoring...
[default] Running provisioner: chef_solo...
The chef binary (either `chef-solo` or `chef-client`) was not found on
the VM and is required for chef provisioning. Please verify that chef
is installed and that the binary is available on the PATH.

Fix:

vagrant plugin install vagrant-omnibus

Tried vagrant provision, resulted in another error

ishtiaqmedsmbp2:wmq Ishtiaq$ vagrant provision
There are errors in the configuration of this machine. Please fix
the following errors and try again:

Vagrant:
* Unknown configuration section 'omnibus'.

ishtiaqmedsmbp2:wmq Ishtiaq$

Install omnibus vagrant plugin

ishtiaqmedsmbp2:wmq Ishtiaq$ vagrant plugin install vagrant-omnibus
Installing the 'vagrant-omnibus' plugin. This can take a few minutes...
Installed the plugin 'vagrant-omnibus (1.4.1)'!

Run vagrant provision again

ishtiaqmedsmbp2:wmq Ishtiaq$ vagrant provision
[default] The cookbook path '/Users/Ishtiaq/chef-repo/cookbooks/wmq/cookbooks' doesn't exist. Ignoring...
[default] The cookbook path '/Users/Ishtiaq/chef-repo/cookbooks/wmq/roles' doesn't exist. Ignoring...
[default] The cookbook path '/Users/Ishtiaq/chef-repo/cookbooks/wmq/data_bags' doesn't exist. Ignoring...
[default] Installing Chef 11.14.2 Omnibus package...
[default] Downloading Chef 11.14.2 for el...
[default] downloading https://www.getchef.com/chef/metadata?v=11.14.2&prerelease=false&nightlies=false&p=el&pv=6&m=x86_64
[default]   to file /tmp/install.sh.2012/metadata.txt
[default] trying curl...
[default] url	https://opscode-omnibus-packages.s3.amazonaws.com/el/6/x86_64/chef-11.14.2-1.el6.x86_64.rpm
md5	ffeffb67c310e6f76bb5d90ee7e30a3f
sha256	840946bc5f7931346131c0c77f2f5bfd1328245189fc6c8173b01eb040ffb58b
[default] downloaded metadata file looks valid...
[default] downloading https://opscode-omnibus-packages.s3.amazonaws.com/el/6/x86_64/chef-11.14.2-1.el6.x86_64.rpm
  to file /tmp/install.sh.2012/chef-11.14.2-1.el6.x86_64.rpm
trying curl...
[default] Comparing checksum with sha256sum...
[default] Installing Chef 11.14.2
[default] installing with rpm...
[default] warning:
[default] /tmp/install.sh.2012/chef-11.14.2-1.el6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 83ef826a: NOKEY
[default] Preparing...
[default] ##################################################
[default]
[default] chef
[default] #
[default] #
[default] #
[default] #
default] #
[default] #
[default]
[default] Thank you for installing Chef!
[default] Running provisioner: chef_solo...
Generating chef JSON and uploading...
Running chef-solo...
[2014-08-17T01:53:04+00:00] INFO: Forking chef instance to converge...
[2014-08-17T01:53:04+00:00] WARN:
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
SSL validation of HTTPS requests is disabled. HTTPS connections are still
encrypted, but chef is not able to detect forged replies or man in the middle
attacks.

To fix this issue add an entry like this to your configuration file:

```
  # Verify all HTTPS connections (recommended)
  ssl_verify_mode :verify_peer

  # OR, Verify only connections to chef-server
  verify_api_cert true
```

To check your SSL configuration, or troubleshoot errors, you can use the
``knife ssl check` command like so:

```
  knife ssl check -c /tmp/vagrant-chef-1/solo.rb
```

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

[2014-08-17T01:53:04+00:00] INFO: *** Chef 11.14.2 ***
[2014-08-17T01:53:04+00:00] INFO: Chef-client pid: 2220
[2014-08-17T01:53:16+00:00] INFO: Setting the run_list to ["recipe[wmq]"] from CLI options
[2014-08-17T01:53:16+00:00] INFO: Run List is [recipe[wmq]]
[2014-08-17T01:53:16+00:00] INFO: Run List expands to [wmq]
[2014-08-17T01:53:16+00:00] INFO: Starting Chef Run for techish-starter

find files size greater than 1 GB on linux

find files having size greater than 1 GB on linux

find / -type f -size +1G -exec ls -lh {} \;

find files with name starting with “WAS_V8”

find /-type f -name WAS_V8* -exec ls -lh {} \;

Chef cookbook for websphere MQ

The was cookbook installs and configures the WebSphere MQ. Current version of cookbook installs MQ binaries, creates queue manager and creates a listener.

GitHub link is https://github.com/techish1/wmq/

Note: This cookbook was tested only on CentOS release 6.4

Fatal error: Class ‘SoapClient’ not found

Look up the following inside your script file

phpinfo();

If you can’t find Soap Client set to enabled like so: the way soap should appear in phpinfo()

Fix

yum install php-soap

  1. Restart your Apache server
  2. Look up your phpinfo(); again and check if you see a similar picture to the one above
  3. If you do, problem solved!

WebSphere 8.5 – Managing profiles using ‘manageprofiles’ command

Creating Deployment Manager profile

manageprofiles.bat -create -profileName dmgr -profilePath "c:\Program Files (x86)\IBM\WebSphere\AppServer\profiles\dmgr" -templatePath "c:\Program Files (x86)\IBM\WebSphere\AppServer\profileTemplates\management" -serverType DEPLOYMENT_MANAGER  -cellName was85hostCell01 -nodeName was85hostCellManager01 -hostName was85host01 -enableAdminSecurity true -adminUserName wasadmin -adminPassword web1sphere

Creating Node1 server profile

manageprofiles.bat -create -profileName profile1 -profilePath "c:\Program Files (x86)\IBM\WebSphere\AppServer\profiles\profile1" -templatePath "c:\Program Files (x86)\IBM\WebSphere\AppServer\profileTemplates\default" -serverName server1  -nodeName was85hostNode01 -hostName was85host01 -enableAdminSecurity true -adminUserName wasadmin -adminPassword web1sphere
INSTCONFSUCCESS: Success: Profile profile11 now exists. Please consult c:\Program Files (x86)\IBM\WebSphere\AppServer\profiles\profile1\logs\AboutThisProfile.txt for more information about this profile.

Creating Node2 server profile

manageprofiles.bat -create -profileName profile12 -profilePath "c:\Program Files (x86)\IBM\WebSphere\AppServer\profiles\profile2" -templatePath "c:\Program Files (x86)\IBM\WebSphere\AppServer\profileTemplates\default" -serverName server2 -nodeName was85hostNode02 -hostName was85host01 -enableAdminSecurity true -adminUserName wasadmin -adminPassword web1sphere
INSTCONFSUCCESS: Success: Profile profile12 now exists. Please consult c:\Program Files (x86)\IBM\WebSphere\AppServer\profiles\profile2\logs\AboutThisProfile.txt for more information about this profile.

Federate a node into the cell

c:\Program Files (x86)\IBM\WebSphere\AppServer\profiles\profile2\bin>addNode.bat was85host01 -username wasadmin -password web1sphere
ADMU0116I: Tool information is being logged in file c:\Program Files (x86)\IBM\WebSphere\AppServer\profiles\profile2\logs\addNode.log
ADMU0128I: Starting tool with the profile12 profile
CWPKI0308I: Adding signer alias "CN=was85host01, OU=Root Certifi" to local keystore "ClientDefaultTrustStore" with the following SHA digest: 4A:2F:F5:1E:C1:48:0F:E4:94:75:82:0C:44:FD:63:CC:7A:B2:88:2B
CWPKI0309I: All signers from remote keystore already exist in local keystore.
ADMU0001I: Begin federation of node was85hostNode02 with Deployment Manager at was85host01:8879.
ADMU0009I: Successfully connected to Deployment Manager Server: was85host01:8879
ADMU0505I: Servers found in configuration:
ADMU0506I: Server name: server2
ADMU2010I: Stopping all server processes for node was85hostNode02
ADMU0512I: Server server2 cannot be reached. It appears to be stopped.
ADMU0024I: Deleting the old backup directory.
ADMU0015I: Backing up the original cell repository.
ADMU0012I: Creating Node Agent configuration for node: was85hostNode02
ADMU0014I: Adding node was85hostNode02 configuration to cell: was85hostCell01
ADMU0016I: Synchronizing configuration between node and cell.
ADMU0018I: Launching Node Agent process for node: was85hostNode02
ADMU0020I: Reading configuration for Node Agent process: nodeagent
ADMU0022I: Node Agent launched. Waiting for initialization status.
ADMU0030I: Node Agent initialization completed successfully. Process id is: 3448
ADMU0505I: Servers found in configuration:
ADMU0506I: Server name: nodeagent
ADMU0506I: Server name: server2

ADMU0300I: The node was85hostNode02 was successfully added to the was85hostCell01 cell.

ADMU0306I: Note:
ADMU0302I: Any cell-level documents from the standalone was85hostCell01 configuration have not been migrated to the new cell.
ADMU0307I: You might want to:
ADMU0303I: Update the configuration on the was85hostCell01 Deployment Manager with values from the old cell-level documents.

ADMU0306I: Note:
ADMU0304I: Because -includeapps was not specified, applications installed on the standalone node were not installed on the new cell.
ADMU0307I: You might want to:
ADMU0305I: Install applications onto the was85hostCell01 cell using wsadmin $AdminApp or the Administrative Console.

ADMU0003I: Node was85hostNode02 has been successfully federated.

Create a cluster from existing servers

Please run following Jython commands on wsadmin script tool.

server1 = AdminConfig.getid('/Cell:was85hostCell01/Node:was85hostNode01/Server:server1/')
server2 = AdminConfig.getid('/Cell:was85hostCell01/Node:was85hostNode02/Server:server2/')
AdminConfig.convertToCluster(server1, 'myCluster1')
AdminConfig.convertToCluster(server2, 'myCluster1')
AdminConfig.save()

Create a new  cluster member 

cluser_id = AdminConfig.getid('/ServerCluster:myCluster01/') 
node_id = AdminConfig.getid('/Node:mynode/') 
AdminConfig.createClusterMember(cluster_id, node_id, [['memberName', 'server3']])
Array ( [marginTop] => 100 [pageid] => @techish1 [alignment] => left [width] => 292 [height] => 300 [color_scheme] => light [header] => header [footer] => footer [border] => true [scrollbar] => scrollbar [linkcolor] => #2EA2CC )