CHEF SERVER SETUP GUIDE Reference : http://docs.opscode.com/install_server.html http://sachinsharm.wordpress.com/2013/10/11/installsetup-and-configure-chef-serverworkstationnode-on-centosrhel-6-4/ 1. Install Cent OS Version of Linux. 2. Install the EPEL repo and do a yum update using the command, yum -y update 3. Download the chef server using wget from http://www.getchef.com/chef/install/. 4. Issue the command, rpm -ivh <rpm name> to install the package in the CHEF server machine. 5. Once the installation is done, issue the command to configure chef server. sudo chef-server-ctl reconfigure This command will set up all of the required components, including Erchef, RabbitMQ, PostgreSQL, and all of the cookbooks that are used by chef-solo to maintain Chef Server 11.x. 6. Verify the the hostname for the server by running the hostname command. The hostname for the server must be a FQDN. 7. Verify the installation of Chef Server 11.x by running the following command: sudo chef-server-ctl test This will run the chef-pedant test suite against the installed Chef Server 11.x and will report back that everything is working and installed correctly. 8. Tie your IP with the hostname in DNS. 9. Access the CHEF server in the browser using the URL, https://<chefserver FQDN> or https://<IP Address> 10. Default username and password for the server is admin/p@ssw0rd1 11. The *chef-server-ctl* command is used on the Chef Server system for management. It has built-in help (-h) that will display the various sub-commands. CHEF WORKSTATION SETUP GUIDE Reference : http://docs.opscode.com/chef/install_workstation.html http://sachinsharm.wordpress.com/2013/10/11/installsetup-and-configure-chef-serverworkstationnode-on-centosrhel-6-4/ 1. Download CHEF client from the URL, http://www.getchef.com/chef/install/ 2. Use wget to download the rpm from the site and install using the command, rpm -ivh <rpm name> 3. After the installation, issue the command, chef-client -v to check if the installation is successful. If its successful it will throw the version number installed. 4. After the chef-client has been installed, the following folder structure will be present on the local machine: /opt /chef /bin /embedded /bin /include /lib /share /ssl 5. Go to /opt and create a dir called .chef with the command, mkdir .chef The .chef directory is used to store three files: knife.rb ORGANIZATION-validator.pem USER.pem 6. Copy Cert Keys from Chef Server to your Workstation User Folder using the following command. scp root@chef-server-ip:/etc/chef-server/admin.pem ~/.chef scp root@chef-server-ip:/etc/chef-server/chef-validator.pem ~/.chef 7. Now configure client setting using knife with the command, knife configure -i 8. Fill in the necessary details it asks for. 9. knife.rb file will be created in the folder you specified. 10. knife.rb will look like log_level :info log_location STDOUT node_name 'knife-user1' client_key '/root/.chef/knife-user1.pem' validation_client_name 'chef-validator' validation_key '/root/.chef/admin.pem' chef_server_url 'https://chef-server.example.com:443/' syntax_check_cache_path '/root/.chef/syntax_check_cache' 11. Run the following commands to check if the workstation installation is done properly. knife client list knife user list 12. Install GIT using the following command. yum -y install git 13. Get the default directories created using the following command in the workstation. git clone https://github.com/opscode/chef-repo.git This will create all the necessary default folders. 14. Use knife to know the commands supported by it. 15. Use knife cookbook upload <cookbook_name> to upload the cookbook to the server from workstation. CHEF CLIENT SETUP GUIDE 1. Client installtion can be done from the workstation itself. Execute the following command to do so. knife bootstrap <IP_Address> -x <Username> -N "<Display_Name>" Example : knife bootstrap 192.168.12.5 -x root -N "devops-chefnode.payoda.com" 2. If the user in the node is a sudo user, use the below command. knife bootstrap <IP_Address> --sudo -x <Username> -N "<Display_Name>" Example : knife bootstrap 192.168.12.5 --sudo -x root -N "devops-chefnode.payoda.com" 3. This will automatically fetch the necessary artifacts and will install the chef client in the respective IP address. 4. If the above command didnt work for the linux for which it is being installed, please install the chef client manually in the nodes. 5. Run the following commands in the workstation to see if the node is setup properly. knife node list knife client list 6. If the above commands responds then the installation is clean. 7. Run chef-client to fetch the recipes, cookbooks from the chef server and apply it. Troubleshooting: 1. If you get error saying runtime error : please set EDITOR environment variable Solution : export EDITOR=$(which vi) in bashrc 2. If you get type error : cannot convert nil into string, edit the knife.rb and add the following two lines to it Solution : current_dir = File.dirname(__FILE__) cookbook_path ["#{current_dir}/../cookbooks"]
Monday, February 8, 2016
CHEF SERVER SETUP GUIDE
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment