'ubuntu'에 해당되는 글 1건

  1. 2013.04.06 Install Chef-Server 010x on Ubuntu 11.04/12.04

http://redmine.nehome.net/redmine/projects/chef/wiki/Install_Chef-Server_010x_on_Ubuntu_1204


Install Chef-Server 010x on Ubuntu 11.04/12.04

Edit

apt 저장소 등록

  • Chef는 현재 세부 기능의 차이로 0.9.x와 0.10.x 2종류로 나뉜다.
  • 본 문서에서는 0.10.x를 사용하는 것으로 한다.
Edit

apt source.list 등록

  • Ubuntu for Chef 0.9.x
    echo "deb http://apt.opscode.com/ `lsb_release -cs` main" | sudo tee /etc/apt/sources.list.d/opscode.list
    
  • Ubuntu for Chef 0.10.x
    echo "deb http://apt.opscode.com/ `lsb_release -cs`-0.10 main" | sudo tee /etc/apt/sources.list.d/opscode.list
    
Edit

GPG Key 등록

  • 패키지의 무결성 보장을 위해 Opscode GPG키 등록
    sudo mkdir -p /etc/apt/trusted.gpg.d
    gpg --keyserver keys.gnupg.net --recv-keys 83EF826A
    gpg --export packages@opscode.com | sudo tee /etc/apt/trusted.gpg.d/opscode-keyring.gpg > /dev/null
    
  • (Note) keyserver timeout 에러 발생시 아래 방법을 통해 Opscode로부터 직접 Key를 다운로드.
    gpg --fetch-key http://apt.opscode.com/packages@opscode.com.gpg.key
    gpg --export packages@opscode.com | sudo tee /etc/apt/trusted.gpg.d/opscode-keyring.gpg > /dev/null
    
Edit

저장소 목록 update 및 Opscode-keyring 설치

sudo apt-get update
sudo apt-get install opscode-keyring
Edit

Chef의 원활한 설치를 위해, 라이브러리들을 비롯해 배포본을 최신으로 upgrade

sudo apt-get upgrade
Edit

chef-server 패키지 설치

  • chef와 chef-server 패키지만으로도 충분하나, web-ui를 필요로 한다면, 확장 패키지들이 필요하다.
  • 설치 중, 하기와 같은 입력값을 요구 받을 수 있다.
Edit

chef-server 설치

  • chef-server core 설치
    sudo apt-get install chef chef-server
    
    • 상세 수행 내역
      • Install all the dependencies for Chef Server, including Merb, CouchDB, RabbitMQ, etc.
      • Starts CouchDB (via the couchdb package).
      • Starts RabbitMQ (via the rabbitmq-server package).
      • Start chef-server-api via /etc/init.d/chef-server, running a merb worker on port 4000
      • Start chef-server-webui via /etc/init.d/chef-server-webui, running a merb worker on port 4040
      • Start chef-solr-indexer via /etc/init.d/chef-solr-indexer, connecting to the rabbitmq-server
      • Start chef-solr via /etc/init.d/chef-solr, using the distro package for solr-jetty
      • Start chef-client via /etc/init.d/chef-client
      • Add configuration files in /etc/chef for the client, server, solr/solr-indexer and solo
      • Create all the correct directory paths per the configuration files
  • web-ui 설치
    sudo apt-get install chef chef-server-api chef-expander
    
Edit

설치 상태 확인

  • 설치가 끝나면 하기 표에 열거된 프로세스들의 작동 상태를 확인 해야 한다.
Edit

Chef Server 구성요소 및 응답포트 안내

  • Chef Server WebUI는 Chef시스템 운영에서 필수 요소는 아니다. (Optional)
  • 혹, Chef Server WebUI가 작동되지 않는다면, /var/run/chef/server-webui.main.pid 파일이 이미 존재해서 일 가능성이 있다. 해당 파일을 삭제하고 다시 Start시도를 해본다.
NameListen Portps 수행결과 출력 샘플
Chef Server4000merb : chef-server (api) : worker (port 4000)
Chef Server WebUI(Optional)4040merb : chef-server-webui : worker (port 4040)
CouchDB5984beam.smp -Bd -K true – -root /usr/local/lib/erlang -progname erl – -noshell -noinput -couch_ini /usr/local/etc/couchdb/default.ini /usr/local/etc/couchdb/local.ini -s couch
RabbitMQ5672{{beam.smp -W w -K true -A30 – -root /usr/local/lib/erlang -progname erl – -noshell -noinput -s rabbit -sname rabbit -rabbit tcp_listeners [{"0.0.0.0", 5672}]}}
Chef Solr8983/usr/bin/java -Xmx250M -Xms250M -Dsolr.data.dir=/opscode/chef/features/data/solr/data -Dsolr.solr.home=/opscode/chef/features/data/solr/home -jar /opscode/chef/features/data/solr/jetty/start.jar
Chef Expandernoneruby ./chef-solr/bin/chef-expander -c /etc/chef/solr.rb -l debug
Edit

설정/구성

  • 이제부터는 Chef 시스템에서 가장 중요한 "설정/구성"단계로서, Client와 Server간의 식별을 위한 인증서/인증키 생성 및 Chef Server에 대한 설정을 수행해야 한다.
  • knife라는 도구를 통해 필요한 값을 입력함으로 자동으로 구성해주는 방법과, 설정 파일을 수동으로 기술하는 방법 2가지 모두 가능.
  • 본 가이드에서는 Opscode에서 권장하는 knife 도구를 이용한 정석적 방법으로 설명한다.
Edit

Chef 환경 디렉토리 생성

  • (Note) Certificates Read Only
mkdir -p ~/.chef
sudo cp /etc/chef/validation.pem /etc/chef/webui.pem ~/.chef
sudo chown -R $USER ~/.chef
Edit

knife 도구를 이용한 Chef Server 환경 구성

  • knife : Chef-Server의 API 호출을 지원하는 CLI.
  • 처음 접하면 난해한 면이 있다.
  • Chef-Server입장에서 아무 Client나 Chef-Server의 Role/Recipe를 적용하도록 허용되어서도 안되고, Chef-Client입장에서도 아무 Chef-Server에서 제공되는 Role/Recipe를 받아서도 안되기 때문에 인증 체계가 중요하다.
  • 설치후, knife.rb파일에 cookbooks 디렉토리 경로를 지정하는 설정을 추가한다.
    • cookbook_path [ "/var/lib/chef/cookbooks" ]
knife configure -i
> WARNING: No knife configuration file found
> Where should I put the config file? [/root/.chef/knife.rb] 
> Please enter the chef server URL: [http://ubuntu:4000] http://localhost:4000
> Please enter a clientname for the new client: [root] 
> Please enter the existing admin clientname: [chef-webui] 
> Please enter the location of the existing admin client's private key: [/etc/chef/webui.pem] /root/.chef/webui.pem
> Please enter the validation clientname: [chef-validator] 
> Please enter the location of the validation key: [/etc/chef/validation.pem] /root/.chef/validation.pem
> Please enter the path to a chef repository (or leave blank): 
> Creating initial API user...
> Created client[root]
> Configuration file written to /root/.chef/knife.rb
  • WARNING: No knife configuration file found
    • 최초 구성시 Chef Server 설정 파일(knife.rb)이 없어서 생기는 경고.(무시)
  • Where should I put the config file? [/root/.chef/knife.rb]
    • knife.rb 파일의 위치 입력
  • Please enter the chef server URL: [http://ubuntu:4000]
    • Chef Server 호출 URI 입력
  • Please enter a clientname for the new client: [root]
    • 새로운 Client 하나를 생성. (불필요하면 추후 삭제 가능할 듯...)
  • Please enter the location of the existing admin client's private key: [/etc/chef/webui.pem]
    • 이미 존재하는 관리용(admin) Client의 pem 파일 위치 입력
  • Please enter the validation clientname: [chef-validator]
    • chef-validator라는 client는 특별한 계정으로서, 신규 노드의 자동등록을 위해 사용된다.
  • Please enter the location of the validation key: [/etc/chef/validation.pem]
    • chef-validation client용도의 pem 파일 위치 입력
  • Please enter the path to a chef repository (or leave blank):
    • Chef 저장소에 대한 위치 입력 (Defautl 유지)
Edit

설정/구성 상태 확인 테스트

  • 복수의 Client를 생성(개별 인증/pem 운영)하여 Chef시스템을 운영 할 수도 있다. 관련 내용은 도입부의 참조 문서 내용에 상세히 기술되어 있음.
  • 본 문서는 chef-validation.pem 하나로 Chef-Client를 등록/식별하는 용도로 작성되었으므로, Client 에게 배포할 인증서는 validation.pem이다. (보안 문제가 있을 수 있다. 검토중...)
  • Client 목록 조회 테스트
    knife client list
    > chef-validator
    > chef-webui
    > root
    > ubuntu
    
  • Node 목록 조회 테스트
    knife node list
    > ubuntu
    
Edit

[END] Chef-Sever 구축 완료.

Posted by 사랑줍는거지
,