DevOps Engineering part 1. (Mac) – Install the DevOps development tools on Macintosh

Set up your computer

Lock the screen

To be able to lock the screen from the menu bar:

  • In Finder search for Keychain Access and start it,
  • In the Keychain Access menu select Preferences,
  • Check the Show keychain status in menu bar checkbox,
    This will place a lock icon in the menu bar.

To lock your screen

  • Click the lock icon on the menu bar
  • Select Lock Screen

Show the path in Finder

  • Open Finder
  • In the View menu select Show Path Bar

To jump to a folder shown in the path bar just double click it.

Show hidden files and folders

  • Open the terminal and execute the following line
    defaults write com.apple.finder AppleShowAllFiles YES
  • For the change to take effect relaunch Finder.
    • Press the ‘Option/Alt’ key, right click on the Finder icon in the dock and click Relaunch

Apple Id

If you don’t have an Apple ID create one. You can obtain one without a credit card:

  • Start iTunes on your Macintosh,
  • Click the drop down menu in the upper right corner,
    apple-id-01
  • If Apps is visible, select it, otherwise click Edit Menu…
    • Select Apps to display it in the drop down.
      apple-id-02
  • Search for a free app in the App Store and start to download it,
    apple-id-03
  • Create a new Apple Id and select None for credit card type.

Show the user home directory

  • Open Finder
  • In the Finder menu select Preferences
  • In the Favorites section select the checkbox next to your user name
    show-home-directory

Create a directory for optional applications

Create the opt folder in the root of the harddisk.

Memory usage monitor

Download  Dr.Cleaner Elite from the App Store to be able to monitor memory, CPU and network usage in the Menu Bar.


UTC Clock in the menu bar

BitBar is a plugin manager that can display plugins in the menu bar. One of them is World Clock that can display multiple clocks in a drop down of the menu.

Install BitBar

  • Navigate to https://getbitbar.com/
  • Click the Get BitBar button
  • Clock the downloaded ZIP file to extract the application
  • Move the BitBar application to the Applications folder
  • Launch BitBar form the Launcher
    • The first time BitBar launches, opens the Finder to point to the BitBar plugins folder
      • Click the New Folder button to create a folder for plugins in the Documents folder: BitBar Plugins
      • Click the Use As Plugins Directory to select the new folder as the plugins folder

Add World Clock to BitBar

Customize World Clock

To customize World Clock edit the worldclock.1s.sh file in the BitBar Plugins folder

To change the displayed timezones, edit the ZONES variable:

ZONES="US/Pacific UTC Europe/London Europe/Berlin Asia/Kolkata Asia/Tokyo Australia/Sydney"

To change the display format, edit the data formats.

To remove the seconds from the menu bar, delete the :%S from the format line

date -u +'%H:%M UTC'

To add the day of the week and date to the clocks in the World Clock drop down

add

  • %a for the day of the week
  • %Y for the four digit year
  • %b for the name of the month
  • %d for the date
  • %z for the time zone offset
echo "$(TZ=$zone date +'%H:%M - %a, %Y %b %d %z') $zone"

To refresh the dropdown formats after making changes in the config file

  • Click the World Clock in the menu bar
  • Select Preferences, Refresh all

 

Homebrew

Homebrew can install packages on your Macintosh that apple does not provide.

Installation instructions are at http://brew.sh/


NPM

NPM is another package manager. Install it to be able to install other applications later on this page, including the SQL Command utility

brew install node

Remote Desktop Client

Download the Microsoft Remote Desktop app from the App Store

  • Open the App Store
  • Search for “microsoft remote desktop”
  • Click the Microsoft Remote Desktop icon
  • Click the blue Get button
  • Click the green Install App button

Text Editor

Atom

  • Download it from https://atom.io/
  • Double click the downloaded ZIP file to extract the application,
  • Drag the Atom application into Applications

Configure Atom

Turn off auto indent on paste to stop Atom reformatting your code.

  • In the Atom menu select Preferences
  • On the left side select Editor
    • Uncheck Auto Indent On Paste
    • Check Show Indent Guide
    • Set Tab Type to soft to place 2 spaces when you press the tab key


Terminal Window

iTerm2

Install iTerm2, a smart terminal emulator to issue Bash commands and log into Linux servers.

iTerm2 configuration

Enable unlimited scroll back

  • Start iTerm2 and open the preferences window by pressing ⌘, (command-comma)
  • On the Terminal tab click the Unlimited scrollback check box.

Start iTerm2 from Finder

To be able to open iTerm2 in any folder from Finder follow the steps below based on https://gist.github.com/shuntaroy/e5ce3ad61c0deb7e27f0

  • Start Automator,
  • Select Service and click Choose,

  • On the top of the screen set Service receives selected to files and folders,
  • Set in to Finder,

  • On the second side bar from the left double click Run AppleScript,

  • Paste the code from the website referenced above into the editor window replacing the sample script in the editor window,
  • In the File menu save the script,
  • Do not run it, it does not execute in the Automator.
To use it
  • Open Finder and navigate to the location you want to work in,
  • Right click a folder to work in that folder or a file to work in the current folder
  • Select Services, iTerm2 in Finder


 

“Solarized” color scheme

  • Download the color scheme to the Desktop with the following Bash command:
    curl -o ~/Desktop/solarized.itermcolors https://raw.githubusercontent.com/altercation/solarized/master/iterm2-colors-solarized/Solarized%20Dark.itermcolors
  • Import the color scheme to iTerm2
    • Press ⌘, (command-comma) to open the Preferences window
    • Select Profiles
    • In the lower right corner of the Colors tab click the Color Presets… drop down
    • Select Import
    • On the Desktop select the downloaded solarized.itermcolors file
    • In the  Color Presets… drop down select Solarized Dark

 Meslo Powerline font

  • Import the Meslo Powerline font with the following bash command:
    git clone https://github.com/powerline/fonts.git && cd fonts && ./install.sh
  • Select the font in iTerm2
    • Press ⌘, (command-comma) to open the Preferences window
    • Select Profiles
    • On the Font section of the Text tab click the Change Font button
    • Select the 12pt Meslo LG L Regular for Powerline

Make the prompt shorter

to remove your username@computername from the prompt

  • Edit the ~/.zshrc file
  • Add the following line
    DEFAULT_USER="YOUR_USER_NAME"

Colored prompt

To color the prompt:

  • Download the agnoster theme
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
  • Edit the ~/.zshrc file and set the ZSH_THEME to ZSH_THEME=”agnoster”

More configuration suggestions are at

https://ruigomes.me/blog/perfect-iterm-osx-terminal-installation/
https://gist.github.com/kevin-smets/8568070

Information on how terminals read settings at https://shreevatsa.wordpress.com/2008/03/30/zshbash-startup-files-loading-order-bashrc-zshrc-etc/


Git

  • Navigate to https://git-scm.com/download/mac to download Git for Windows. The page automatically downloads the installer for the operating system you use.
  • This app is not trusted by Apple, so to install it
    • Control-click the downloaded file and select Open
    • Click the Open button to confirm the action

Configure Git

If you use two factor authentication

Create a Personal Access Token to use it as password in the command line tools,

  • Log into GitHub and in the pull down at the upper right select Settings,
  • On the left select Personal access tokens and click the Generate new token button,
  • Enter a description for your token (so you can keep track and revoke them individually later, should you have a security breach),
  • Select all options to be able to use the token for administration,
  • Click the Generate button,
  • Copy the token (40 characters long) and use that as your password on the command line.git

VirtualBox

Download VirtualBox from https://www.virtualbox.org/wiki/Downloads and follow the instructions to install it.

At the time of writing this was the section where the installer files were referenced

virtual-box-01-download

Run the downloaded installer file and accept all default values.

The installer starts the application.

Configure VirtualBox

Networking

To share the connectivity of the host computer with the virtual machine, mainly if you use VPN

  • In Virtual box click Settings
  • Select Network
  • Attach the network adapter to NAT

Shared Folders

Specify the shared folder on your workstation

  • In the VirtualBox menu select Preferences
  • On the Shared Folders tab click the + icon
  • Select your home folder on your workstation

Enable shared folders on the virtual machines

To be able to use shared folders between the host ( your workstation ) and the virtual machine.

  • Select the virtual machine window on your workstation,
  • In the Devices menu of Virtual Box select Insert Guest Additions CD image…
  • In the virtual machine start Windows Explorer,
  • Open the VirtualBox Guest Additions CD,
  • Start VBoxWindowsAdditions.exe,

The shared folders are available in the Windows explorer as the D: drive

Usage

Mouse

  • Click the virtual machine screen to start to control it with the mouse
  • Press Command multiple times to release the mouse

Vagrant

Important

The default credentials of a Vagrant server are:

  • UserName: vagrant
  • Password: vagrant

Windows in Vagrant

To test your cookbook on a Windows virtual machine locally, create one for Vagrant. See Launch Windows instances locally with Chef Test Kitchen for the details.


Ruby

Ruby is already a part of the operating system.


Chef Development Kit


Terraform by Hashicorp

 Terraform Installation

  • Download Terraform from https://www.terraform.io/downloads.html
  • Double click the downloaded ZIP file to extract the application
  • Create a directory, terraform for the Terraform application in the /opt folder
  • Move the Terraform application into the terraform directoryin the /opt folder

Add the location to the path

Depending on the terminal window you use, it may open different configuration files. If you use iTerm2 you need to update the path in the~/.zshrc file.  Other terminal windows usually read the configuration from the  ~/.bash_profile file. To be safe you can add the following to both configuration files:

# PATH Export
PATH=/opt/terraform:$PATH
export PATH
unset DYLD_LIBRARY_PATH

Graphviz

Graphviz is a Dependency Graph Visualization Software. We will use this utility to display the Terraform graphs.

To install execute the following in the terminal

brew install graphviz

AWS CLI

The Amazon Web Services command line interface installation will set up your workstation to launch instances in AWS from Test Kitchen. If you know you will work with AWS, see DevOps Engineering part 3. – Working with AWS for the AWS CLI installation.


SQL Command

To be able to execute Microsoft SQL commands from the command line or through Terraform, install the MS SQL utility

npm install -g sql-cli

Packer

We use Packer to create custom AWS AMIs that contain the fundamental configuration and applications that are common in every instance we launch.

Install Packer

  • Add the Packer installation directory to the system path

Working with Windows servers from the Mac

If you want to work with Windows servers, you may need to run Windows applications on your workstation.

See Minimum Windows workstation setup to work with Windows servers



Next:

Set up the DevOps development environment in Beginner’s Guide to DevOps Engineering part 2.

Back:

to the Tutorials page

Leave a Reply