Personal Links

Computers

Hi There! After a long time 😉 In this post I will explain how you can setup your Chef Server on an Ubuntu machine. Chef, as we know, is an Infrastructure Automation platform that helps manage, maintain & housekeep a number of servers by keeping them in desired state. Sounds complicated? Ok, let me put this in an easy way 😉

Suppose you have 25 servers in your infrastructure. 10 are Apache web-servers, 5 are Database servers, 2 are monitoring servers, 2 are LDAP servers & rest are Tomcat servers. You are given the responsibility to setup all of them 😀 You will have to install packages, create users & groups & do tons of modifications like editing /etc/hosts or /etc/resolv.conf files. All this leads to a lot of wastage in terms of time & resources. That’s where Chef or similar software helps. Chef will allow you to do all these tasks in much simple & efficient manner. You define what packages are to be installed on what servers & Chef will do it. Add users to passwd file & Chef will populate this file to all required servers. This is known as Chef recipes. Seems fun, right? 😉

Chef has 3 components.

Workstation : – A server on which you define all your modifications like contents of passwd file, packages to be installed etc. In other words, here you create Chef recipes & cookbooks.

Server : – Where you manage all your nodes & where all the recipes are sent to. Server then adjust the nodes according to the recipes. It also has a web UI where you can see & manage your nodes. Chef Server can only be installed on Unix/Linux machines.

Nodes : – The individual servers that are to be managed by Chef. Like your Apache or DB servers. Could be any OS.

Now that you know the basic terminologies, lets setup our Chef Server 🙂

Lab Description : –

OS – Ubuntu 14.04

RAM – 4 GB

IP Address – 192.168.0.XX

Chef Server version – 12.4.0

Chef Manage version – 2.3.0

Steps : –

1. Download & Install Chef Server package. Go to https://downloads.chef.io/chef-server and download the package for your OS. In this tutorial, I have chosen Ubuntu. Install it by using below command.

2. Configure Chef Server. Next step will be to configure it. So run this command. It will dump output similar to it. Please note that this step will take around 2-3 minutes or more.

root@chef-server:/home/shashank# chef-server-ctl reconfigure
Starting Chef Client, version 12.6.0
resolving cookbooks for run list: ["private-chef::default"]
Synchronizing Cookbooks:
Deprecated features used!
Cannot specify both default and name_property together on property path of resource yum_globalconfig. Only one (name_property) will be obeyed. In Chef 13, this will become an error. Please remove one or the other from the property. at 1 location:
- /opt/opscode/embedded/cookbooks/cache/cookbooks/yum/resources/globalconfig.rb:76:in `class_from_file'
Chef Client finished, 323/451 resources updated in 03 minutes 10 seconds
Chef Server Reconfigured!

3. Create Chef user & its organisation. Issue below command to create a user & its organisation for Chef. This user will be used to log-in to its web UI & perform other admin tasks. These .pem keys will be used to authenticate & validate the certificates. Choose any desired location.

4. Install Chef Manage(web UI). Default step is to install it using Chef itself by issuing chef-server-ctl install chef-manage command But it threw error on my machine that apt-get update was unable to retrieve this package. So, I downloaded the package from Chef’s site & installed it using dpkg.

root@chef-server:/home/shashank# dpkg -i Downloads/chef-manage_2.3.0-1_amd64.deb
It will ask you to accept the license agreement.
To use this software, you must agree to the terms of the software license agreement.
Press any key to continue.
Type 'yes' to accept the software license agreement, or anything else to cancel.
yes
Starting Chef Client, version 12.4.1
When its done installing it, it will prompt you to issue another command.
Chef Client finished, 323/451 resources updated in 03 minutes 10 seconds
Chef Server Reconfigured!
Thank you for installing the Chef Management Console add-on!
The next step in the process is to run:
chef-manage-ctl reconfigure

5. Configure Chef Manage. Issue above command to configure it. It will take some time. Wait for it to finish.

Like this:

Well, this one is not exactly a tutorial on Linux. But it will definitely be a great experience reading this 😉 In this post, I will demonstrate how we can use a Python script to see Live Cricket scores as notification alerts right on out laptops/desktops. Without opening a browser 🙂 And all this along-with some learning about Linux/Mac. Sounds interesting? Read on 😉

All this has been done on a Mac but same can be done on a Linux/Windows machine.

Install Python 3. Go to official site & download the stable version for your OS.

Thats it. All Python packages have been installed. Now install one more component terminal-notifier. Homebrew is a package manager for Mac. Please install it first to install other Mac stuff (like terminal-notifier) not bundled with its OS.

Download score-notify Python script. Lets now download the actual Python script that will do the trick. Go to this site https://github.com/avinassh/score-notify & download this. All credit goes to this developer. His script does all the magic & he deserves all the accolades 🙂 I am just using his work to demonstrate.

What makes this file special? Well most Antivirus (AV) software will detect this file as a virus! Why?? Because the code written in this file is a Machine Code instruction. Also, the code is self-modiying or mutating one! This spectacular behavior is the reason most AntiVirus software stop it’s execution & only the text is printed!

But the best thing is that this file doesn’t do anything harmful as all the code is in ASCII human-readable characters & it only prints the the text “EICAR-STANDARD-ANTIVIRUS-TEST-FILE!”.

PS – This file is used to test the functionality of AntiVirus software in a safe manner. Rather than testing AntiVirus with real virus, AV Software companies test their product with EICAR test file. 🙂