How to install Chef workstation on AWS Linux Machine


 In this article, we will see Download and Install Chef in Amazon EC2 Linux Instance.

Steps to follow Download and Install Chef

  1. Launch Linux EC2 Instance.
  2. Connect to Linux EC2 Instance through Putty.
  3. Switch to root user.
  4. Update Server Packages.
  5. Download and Install the chef package.
  6. Verify the chef package and Version.

Launch Linux EC2 Instance 

Please check the below link to Launch Linux Server.

Launch Linux EC2 Instance

We can see the Linux Server “Chef-Workstation” which was created earlier.


 connect with your Amazon Linux machine using Putty or ssh client in case of windows. 


Open Linux EC2 Instance Terminal

2
3
4
5
6
7
8
9
Using username "ec2-user".
Authenticating with public key "imported-openssh-key"
Last login: Tue Dec 24 02:35:19 2019 from 124.123.103.5
 
__| __|_ )
_| ( / Amazon Linux 2 AMI
___|\___|___|
 
https://aws.amazon.com/amazon-linux-2/



Switch to root user

Update Server Packages

By using “yum update” command.

Download and Install chef package

Download Chef Package

First we need to go chef official website by using below link.

https://www.chef.sh/

Click on DOWNLOADS.

Click on Get it.

Copy Chef package URL from website

Copy URL  https://packages.chef.io/files/stable/chef-workstation/0.13.35/el/7/chef-workstation-0.13.35-1.el7.x86_64.rpm

 

Paste URL which was copied from website in Linux EC2 Terminal

The chef package has been downloaded successfully.

Install chef package

Verify chef package and Version

Verify chef package

To see the version of Chef

using chef -v command

using chef -version command


 if somehow you are getting the below error : 

[root@ip-172-31-27-245 ec2-user]# chef -v

/opt/chef-workstation/embedded/bin/ruby: error while loading shared libraries: libcrypt.so.1: cannot open shared object file: No such file or directory


in my case, I came to know that It seems that there is no libcrypt package available directly through the package manager on your Amazon Linux system. In that case, we need to identify the correct package that provides libcrypt.so.1 and install it. On Amazon Linux, libcrypt.so.1 is typically part of the glibc package.


 Here are the steps you can take:

  1. Verify the glibc Package: Run the following command to check if the glibc package is installed:

    bash
    sudo yum list installed glibc

    If it's not installed, you can install it using the following command:

    bash
    sudo yum install glibc

    This should include the necessary libcrypt.so.1 library.

  2. Update Dynamic Linker Cache: After installing or verifying the glibc package, update the dynamic linker cache:

    bash
    sudo ldconfig
  3. Retry ldd Command: Run the ldd command again for ruby:

    bash
    ldd /opt/chef-workstation/embedded/bin/ruby

    Ensure that libcrypt.so.1 is now listed without "not found."

  4. Check Library Path: Verify that the library path is set correctly. Check the LD_LIBRARY_PATH environment variable:

    bash
    echo $LD_LIBRARY_PATH

    It should include the directory where libcrypt.so.1 is installed.

  5. Reinstall Chef Workstation: If the issue persists, reinstall Chef Workstation to ensure a clean installation:

    bash
    sudo yum remove chef-workstation sudo yum install chef-workstation


No comments:

Post a Comment