Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Configuration Management with Chef-Solo
Configuration Management with Chef-Solo

Configuration Management with Chef-Solo: A comprehensive guide to get you up and running with Chef-Solo.

eBook
€8.99 €14.99
Paperback
€18.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Configuration Management with Chef-Solo

Chapter 2. Setting Up an Environment for Chef-Solo

We have already discussed some brief theory about Chef-Solo in the previous chapter, but we can't get anywhere until we've installed Chef-Solo and have had a hands-on experience with Chef.

This chapter will guide you with a step-by-step installation of Chef-Solo. We need some additional packages to get it working. Also, we will have a look into the configurations to get it working.

We will cover the following topics in this chapter:

  • Installation on Linux and Ubuntu
  • Prerequisites of Chef-Solo
  • Chef-Solo cookbook
  • Configurations
  • Downloading a few sample cookbooks
  • Execution of the recipes

Installation on Linux and Ubuntu

Chef provides us with a number of ways to get started. We can get it working using different methods. Each method has certain advantages and disadvantages. Chef-Solo can be installed as a Ruby gem, or a Debian package and is not available as Red Hat Package Manager (RPM) packages for Red Hat based Linux.

The detailed installation methods are discussed in the following sections.

Installing Chef as a Ruby gem

Chef is written in Ruby, and before getting started with Chef-Solo, we have to install Ruby. The installation is simple enough and it requires only two packages to get started. Ruby developers may prefer this particular method to get started.

apt-get install Ruby1.9.3 Ruby1.9.3-dev build-essential

This will install Ruby Version 1.9.1 and also a few required extensions. After installation of Ruby, we can easily install Chef using it as a Ruby gem. We can install Ruby by using the following snippet:

gem1.9.3 install --no-ri --no-rdoc chef

Also, you can install...

Prerequisites of Chef-Solo

We already discussed about installation setups for Chef-Solo. If you are using the Omnibus method, you don't need to worry about any dependencies. However, for installation as a Ruby gem or package management, please ensure that the following packages are installed on your machine.

Use the following command to install the required packages:

$ sudo apt-get install Ruby1.9.3 build-essential

For Omnibus, make sure curl is installed on your machine:

$ sudo apt-get install curl

Tip

curl is a command-line tool for transferring data with URL syntax. It supports various protocols including HTTP, FTP, and FTPS.

Some dependencies for Berkshelf are as follows:

$ sudo apt-get install libxslt-dev libxml2-dev openssl zlib1g

To ensure that Chef-Solo installs correctly, go to the terminal and write the following command:

$ chef-solo -v

The preceding command will display the Chef version as shown in the following screenshot:

Prerequisites of Chef-Solo

Cookbooks

Cookbooks are a collection of recipes and they consist of basic and fundamental units of various policies and distributions. Each cookbook contains complete setups to install every distribution on a machine.

For instance, we need a web server, so we are installing Nginx to act as a web server. The Nginx cookbook should contain all the package names that are dependent to install Nginx. Moreover, it should provide step-by-step instructions to the machine to make this happen.

Let's have a detailed look at how to develop a cookbook.

The folder structure

Cookbooks should ideally consist of the following folder structure. As they are a collection of different recipes, while executing the recipe by default, Chef-Solo will look for a default folder:

attributes
    default.rb
files
    default
        file.txt
recipes
    default.rb
templates
    default
        file.erb
metadata.rb

Attributes

As we have already discussed about these terminologies in the last chapter here, once again, we...

Downloading recipes

Let's download a few recipes on a test environment and execute them with Chef-Solo.

First, we'll make a folder named cookbooks and download the Nginx recipe to execute. As we have already installed Chef-Solo in our working environment, use the following command to create a folder named cookbooks:

$ mkdir cookbooks && cd cookbooks
$ git clone https://github.com/opscode-cookbooks/nginx

Git provides two methods to download repositories to a local storage. We can use Git and/or https protocol to clone the repository. Our main objective is to place cookbooks under the cookbooks directory.

Chef-Solo configuration

After having downloaded a few recipes, we want to run those recipes and make the system ready. The solo.rb file is used to specify all the configuration details. Its default configuration is loaded every time. By a default configuration, the file exists at /etc/chef/solo.rb, but we can use it with a custom path. The solo.rb file can contain several settings but mainly it is used for the cookbook's path, data bag's path, environment, environment path, log_location, and so on.

You can read all the detailed information about each configuration at www.getchef.com.

Our solo.rb file is pretty simple and contains only a few settings.

Create a new solo.rb file with the following content:

file_cache_path    "/var/chef/cache"
file_backup_path   "/var/chef/backup"
cookbook_path ["/home/<username>/cookbooks"]
# An alternative and more useable method is to use ruby code to get directory path
      cookbook_path File.expand_path(&apos...

Installation on Linux and Ubuntu


Chef provides us with a number of ways to get started. We can get it working using different methods. Each method has certain advantages and disadvantages. Chef-Solo can be installed as a Ruby gem, or a Debian package and is not available as Red Hat Package Manager (RPM) packages for Red Hat based Linux.

The detailed installation methods are discussed in the following sections.

Installing Chef as a Ruby gem

Chef is written in Ruby, and before getting started with Chef-Solo, we have to install Ruby. The installation is simple enough and it requires only two packages to get started. Ruby developers may prefer this particular method to get started.

apt-get install Ruby1.9.3 Ruby1.9.3-dev build-essential

This will install Ruby Version 1.9.1 and also a few required extensions. After installation of Ruby, we can easily install Chef using it as a Ruby gem. We can install Ruby by using the following snippet:

gem1.9.3 install --no-ri --no-rdoc chef

Also, you can install...

Left arrow icon Right arrow icon

Description

This is a step-by-step guide, full of hands-on examples of real-world deployment tasks. Each topic is explained and placed in context, while also pointing out the key details of the concepts used. This book is aimed at system administrators and system engineers who have an understanding of configuration management tools and infrastructure. For novice administrators, it contains easy-to-use application recipes to get started immediately.

What you will learn

  • Define your infrastructure as code in Chef
  • Set up a testing and production environment with ChefSolo
  • Test the incremental development of a project with Vagrant
  • Develop recipes and manage web and database roles
  • Automate tedious manual tasks
  • Learn to use data bags and write clean cookbooks
  • Create a Docker image using cookbooks
  • Manage and scale your cloud infrastructure by automating your configuration management

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jun 25, 2014
Length: 116 pages
Edition : 1st
Language : English
ISBN-13 : 9781783982479
Languages :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Jun 25, 2014
Length: 116 pages
Edition : 1st
Language : English
ISBN-13 : 9781783982479
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 18.99
Configuration Management with Chef-Solo
€18.99
Total 18.99 Stars icon
Banner background image

Table of Contents

7 Chapters
1. Introduction to Chef and Chef-Solo Chevron down icon Chevron up icon
2. Setting Up an Environment for Chef-Solo Chevron down icon Chevron up icon
3. Setting Up a Development Environment Chevron down icon Chevron up icon
4. Developing Cookbooks Chevron down icon Chevron up icon
5. More about Cookbooks and Recipes Chevron down icon Chevron up icon
6. Chef-Solo and Docker Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
(1 Ratings)
5 star 0%
4 star 0%
3 star 0%
2 star 100%
1 star 0%
DEBRAJ M. Jul 13, 2018
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
Too basic. It is not worth the price.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.