Skip to content

Instantly share code, notes, and snippets.

Installing git on CentOS 5 using yum

Since you're using CentOS 5, the default package manager is yum, not apt-get. To install a program using it, you'd normally use the following command:

$ sudo yum install <packagename>

However, when trying to install git this way, you'll encounter the following error on CentOS 5:

source 'https://rubygems.org'
group :test do
gem 'chefspec', '~> 1.3'
gem 'foodcritic', '~> 2.1'
gem 'strainer', '~> 3.0'
gem 'test-kitchen', '~> 1.0.0.alpha'
gem 'kitchen-lxc', '~> 0.0.1.beta1'
gem 'knife-spork', '~> 1.0.17'
gem 'hipchat', '~> 0.10.0'
@obazoud
obazoud / winrm-test.rb
Created February 28, 2014 17:08
WinRm tests
require 'winrm'
endpoint = 'http://xxxx:5985/wsman'
winrm = WinRM::WinRMWebService.new(endpoint, :plaintext, :user => 'Administrator', :pass => 'xxxx', :disable_sspi => true)
winrm.cmd('ipconfig /all') do |stdout, stderr|
  STDOUT.print stdout
  STDERR.print stderr
end
source 'https://rubygems.org'
group :test do
gem 'chefspec', '~> 1.3'
gem 'foodcritic', '~> 2.1'
gem 'strainer', '~> 3.0'
gem 'test-kitchen', '~> 1.0.0.alpha'
gem 'kitchen-lxc', '~> 0.0.1.beta1'
gem 'knife-spork', '~> 1.0.17'
gem 'hipchat', '~> 0.10.0'

Vagrant Setup

This tutorial guides you through creating your first Vagrant project.

We start with a generic Ubuntu VM, and use the Chef provisioning tool to:

  • install packages for vim, git
  • create user accounts, as specified in included JSON config files
  • install specified user dotfiles (.bashrc, .vimrc, etc) from a git repository

Afterwards, we'll see how easy it is to package our newly provisioned VM

# Knife Configuration File.
#
# This is a Ruby DSL to set configuration parameters for Knife's
# general options. The default location for this file is
# ~/.chef/knife.rb. If multiple Chef repositories are used,
# per-repository configuration files can be created. A per repository
# configuration file must be .chef/knife.rb in the base directory of
# the Chef repository. For example,
#
# ~/Development/chef-repo/.chef/knife.rb
#!/bin/bash
# Perform installation as root
# Install prereqs
yum -y install libcurl libcurl-devel rrdtool rrdtool-devel rrdtool-prel libgcrypt-devel gcc make gcc-c++
# Get Collectd, untar it, make it and install
wget http://collectd.org/files/collectd-5.4.0.tar.gz
tar zxvf collectd-5.4.0.tar.gz
vagrant@vagrant-vm:~$ sudo chef-solo -c /tmp/vagrant-chef-1/solo.rb -j /tmp/vagrant-chef-1/dna.json
vagrant@vagrant-vm:~$ sudo chef-solo -c /tmp/vagrant-chef-1/solo.rb -j /tmp/vagrant-chef-1/dna.json --why-run > /tmp/why-run.out
@obazoud
obazoud / Berksfile
Created March 23, 2014 21:20
berkshelf hangs 100% CPU
# -*- mode: ruby; coding: utf-8; -*-
source "http://api.berkshelf.com"
# Official Opscode cookbooks / Community
cookbook 'apt', git: 'https://github.com/opscode-cookbooks/apt.git', tag: 'v2.3.8'
cookbook 'ark', git: 'https://github.com/opscode-cookbooks/ark.git', tag: 'v0.7.0'
cookbook 'build-essential', git: 'https://github.com/opscode-cookbooks/build-essential.git', tag: 'v2.0.0'
cookbook 'chef-client', git: 'https://github.com/opscode-cookbooks/chef-client.git', tag: 'v3.2.0'
cookbook 'chef_handler', git: 'https://github.com/opscode-cookbooks/chef_handler.git', tag: 'v1.1.5'
@obazoud
obazoud / Dockerfile
Last active August 29, 2015 13:57
Docker image Chef - CentOS
FROM centos:6.4
RUN curl -L https://www.opscode.com/chef/install.sh | bash
RUN yum clean all
RUN yum install -y sudo openssh-server openssh-clients curl
RUN sed -i '/requiretty/c\# Defaults requiretty' /etc/sudoers