LoginSignup
4
5

More than 5 years have passed since last update.

Chefでnginx1.6.2をインストール

Last updated at Posted at 2015-03-08

環境

  • vagrant
  • CentOS 6.5

問題と対応方針

  • chefのpackageリソースを使うとepelリポジトリから古いバージョン(1.0系)のnginxがインストールされてしまう
  • /etc/yum.repos.d/nginx.repoにnginx.orgのリポジトリを指定し、新しいバージョンのnginxをインストールする

実装

sitecookbooks/nginx/templates/default/nginx.repo.erb
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/6/$basearch/
gpgcheck=0
enabled=1
site-cookbooks/nginx/recipes/default.rb
template "/etc/yum.repos.d/nginx.repo" do
  mode 0644
  user 'root'
  group 'root'
end

yum_package "nginx" do
  action :install
  flush_cache [:before]
end

service "nginx" do
  action [:start, :enable]
  supports status: true, restart: true, reload: true
end

参考

4
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
5