{"id":20371571,"url":"https://github.com/atulkamble/chef-project","last_synced_at":"2025-09-23T19:31:05.763Z","repository":{"id":245870086,"uuid":"819431267","full_name":"atulkamble/chef-project","owner":"atulkamble","description":"The Chef Server Project provides a streamlined setup guide for installing and configuring Chef on Amazon Linux 2023. This project aims to facilitate the use of Chef for infrastructure management by guiding users through the installation of Chef Workstation, setting up a Chef repository, and running a basic cookbook.","archived":false,"fork":false,"pushed_at":"2024-08-22T05:06:33.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-08T07:00:01.100Z","etag":null,"topics":["chef","chef-cookbooks","chef-repo","chef-server","devops"],"latest_commit_sha":null,"homepage":"https://youtu.be/4ep2EEtC4hw","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/atulkamble.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-24T13:43:44.000Z","updated_at":"2024-08-22T05:06:36.000Z","dependencies_parsed_at":"2024-08-22T06:24:15.356Z","dependency_job_id":"39b2489c-4da6-4fb7-a4bb-af9635e10ebd","html_url":"https://github.com/atulkamble/chef-project","commit_stats":null,"previous_names":["atulkamble/chef-project"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atulkamble%2Fchef-project","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atulkamble%2Fchef-project/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atulkamble%2Fchef-project/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atulkamble%2Fchef-project/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/atulkamble","download_url":"https://codeload.github.com/atulkamble/chef-project/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233994917,"owners_count":18762950,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chef","chef-cookbooks","chef-repo","chef-server","devops"],"created_at":"2024-11-15T01:08:33.928Z","updated_at":"2025-09-23T19:31:05.753Z","avatar_url":"https://github.com/atulkamble.png","language":"Shell","readme":"---\n\n# chef-workstation-setup-amazon-linux-2023\nBasic Chef Workstation Project\n\n```\ngit clone https://github.com/atulkamble/chef-project.git\ncd chef-project\n\nchmod +x setup_chef_project.sh\n./setup_chef_project.sh\n\ncat /tmp/greeting.txt \n```\nThis document provides a comprehensive guide for installing and setting up Chef on Amazon Linux 2023. Follow these instructions to ensure proper installation and configuration.\n\n### Launch EC2 and Connect via SSH\n\n1. Launch an Amazon EC2 instance running Amazon Linux 2023.\n2. Connect to the instance using SSH.\n\n### Step 1: Update the System\n\nEnsure that all system packages are up-to-date with the latest updates and security patches:\n\n```bash\nsudo yum update -y\n```\n\nTo clone the repository from GitHub, follow these instructions:\n\n### Cloning the Repository\n\n1. **Ensure Git is installed on your system.** If not, install it using the following command:\n   \n   For Amazon Linux 2023:\n   ```bash\n   sudo yum install git -y\n   ```\n\n2. **Clone the repository using Git.** Open your terminal and run the following command:\n\n   ```bash\n   git clone https://github.com/atulkamble/chef-project.git\n   ```\n\n3. **Navigate into the cloned repository directory:**\n\n   ```bash\n   cd chef-project\n   ```\n\n\n### Step 2: Download and Install Chef Workstation\n\nChef Workstation is a suite of tools for managing infrastructure and executing Chef recipes.\n\n1. **Download the Chef Workstation package:**\n\n    ```bash\n    wget https://packages.chef.io/files/stable/chef-workstation/24.4.1064/el/8/chef-workstation-24.4.1064-1.el8.x86_64.rpm\n    ```\n\n2. **Install the downloaded package:**\n\n    ```bash\n    sudo rpm -Uvh chef-workstation-24.4.1064-1.el8.x86_64.rpm\n    ```\n\n### Step 3: Verify the Installation\n\nConfirm that Chef Workstation is installed correctly by checking the version:\n\n```bash\nchef --version\n```\n\n### Troubleshooting\n\nIf you encounter the error `/opt/chef-workstation/embedded/bin/ruby: error while loading shared libraries: libcrypt.so.1: cannot open shared object file: No such file or directory`, resolve it by installing the necessary compatibility library:\n\n```bash\nsudo yum install libxcrypt-compat -y\n```\n\n### Step 4: Set Up a Chef Repository\n\n1. **Create a Chef repository:**\n\n    ```bash\n    chef generate repo chef-repo\n    cd chef-repo\n    ```\n\n2. **Create a Cookbook:**\n\n    ```bash\n    chef generate cookbook cookbooks/my_cookbook\n    cd cookbooks/my_cookbook\n    ```\n\n3. **Write a Recipe:**\n\n    Edit the `recipes/default.rb` file in your cookbook:\n\n    ```bash\n    nano recipes/default.rb\n    ```\n\n    Add the following content:\n\n    ```ruby\n    file '/tmp/greeting.txt' do\n      content 'Hello, Chef!'\n    end\n    ```\n\n### Step 5: Run Chef Client in Local Mode\n\nTest your cookbook by executing Chef in local mode:\n\n```bash\nsudo chef-client --local-mode --runlist recipe[my_cookbook::default]\ncat /tmp/greeting.txt\n```\n\n---\n\n### Automation Script run:\n\nHere's a shell script to automate the setup and configuration process for your Chef project on Amazon Linux 2023:\n\n```bash\n#!/bin/bash\n\n# Define variables\nCHEF_WORKSTATION_URL=\"https://packages.chef.io/files/stable/chef-workstation/24.4.1064/el/8/chef-workstation-24.4.1064-1.el8.x86_64.rpm\"\nREPO_NAME=\"chef-repo\"\nCOOKBOOK_NAME=\"my_cookbook\"\nRECIPE_PATH=\"$REPO_NAME/cookbooks/$COOKBOOK_NAME/recipes/default.rb\"\n\n# Update the system\necho \"Updating system packages...\"\nsudo yum update -y\n\n# Download and install Chef Workstation\necho \"Downloading Chef Workstation...\"\nwget $CHEF_WORKSTATION_URL -O chef-workstation.rpm\n\necho \"Installing Chef Workstation...\"\nsudo rpm -Uvh chef-workstation.rpm\n\n# Verify installation\necho \"Verifying Chef Workstation installation...\"\nchef --version\n\n# Troubleshoot missing library issue\nif ! sudo chef --version \u0026\u003e /dev/null; then\n    echo \"Encountered error with missing library. Installing compatibility library...\"\n    sudo yum install libxcrypt-compat -y\nfi\n\n# Set up Chef repository\necho \"Setting up Chef repository...\"\nchef generate repo $REPO_NAME\ncd $REPO_NAME\n\n# Create a cookbook\necho \"Creating a cookbook...\"\nchef generate cookbook cookbooks/$COOKBOOK_NAME\ncd cookbooks/$COOKBOOK_NAME\n\n# Write a recipe\necho \"Writing a recipe...\"\nmkdir -p recipes\ncat \u003c\u003cEOF \u003e recipes/default.rb\nfile '/tmp/greeting.txt' do\n  content 'Hello, Chef!'\nend\nEOF\n\n# Run Chef Client in local mode\necho \"Running Chef Client in local mode...\"\nsudo chef-client --local-mode --runlist recipe[$COOKBOOK_NAME::default]\n\n# Verify output\necho \"Verifying output...\"\ncat /tmp/greeting.txt\n\necho \"Chef project setup complete.\"\n```\n\n### Instructions:\n\n1. Save the script as `setup_chef_project.sh`.\n2. Make the script executable:\n\n    ```bash\n    chmod +x setup_chef_project.sh\n    ```\n\n3. Run the script:\n\n    ```bash\n    ./setup_chef_project.sh\n    ```\n\nThis script handles the entire process from system update to Chef Workstation installation, repository setup, cookbook creation, recipe writing, and Chef client execution. Adjust the `CHEF_WORKSTATION_URL` and other variables as needed.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatulkamble%2Fchef-project","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatulkamble%2Fchef-project","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatulkamble%2Fchef-project/lists"}