How To Setup a Linux Workstation as a Development Environment

August 21, 2018

Tweet This: 
Share on LinkedIn:  

By Peter Phan, Kovarus, Sr. Solutions Architect

NetDevOps

NetDevOps was a key topic at Cisco Live. Here is a definition from Hank Preston at Cisco, “NetDevOps brings the culture, technical methods, strategies, and best practices of DevOps to Networking.”

That sounds great but how does one get started with NetDevOps? Cisco has a great learning program at: http://learninglabs.cisco.com.

In this article, I will discuss how to build yourself an Ubuntu workstation to start your journey to NetDevOps nirvana. I use a windows machine as my daily, but picked Ubuntu since it would be easy to replicate to my peers.

We will be installing a basic DevOps toolset and verify that the tools are working correctly.

Step 1: Ubuntu Preparation

Use the following resource to Install Ubuntu as a VM on your machine:
https://websiteforstudents.com/how-to-install-ubuntu-18-04-lts-beta-desktop/

  1. Install some basic Linux tools and utilities.
    • Ubuntu
    • CentOS
  1. Install the typical developer utilities and tools. (For example the gcc C compiler.)
    • Ubuntu
    • CentOS

Step 2: Source Control Systems — git

Installation

  • Ubuntu
  • CentOS
    (Git is installed as part of the Development tools.)

Verification

Let’s verify it is working as expected.

  • Open a terminal.
  • Run git –version. You should get output indicating the version of git installed.
  • Attempt to clone down a repository from GitHub. We will also create a folder called “code.”
  • Expected Output.

Step 3: Terminals and Shells — Bash

Installation

  • The default terminal for Ubuntu is Bash. We are good here.

Verification

  • Change into the hello_network directory that you cloned down in the last step.
  • Included in the repository is a bash shell script called sh.
  • Run it to verify you have a functioning bash shell.
  • Expected Output.

Step 4: Programming Languages

Python

  • There are two major version of Python: Python 2 and Python 3.
    • Python 3 is the recommended version, but many scripts are written in Python 2 and have not been updated.
    • We will install both versions.
  • Install Python 2.7.x and pip.
    • Use the following command.
  • Install Python 3.6.x and pip.
    • Should already be installed in Ubuntu 18.04.1 LTS Desktop. However, it does not include python3-pip by default. Run the following command to ensure both are installed.
  • Verify install of Python 2 and Python 3.
    • Verify Python 3 was correctly installed.
    • Expected Output.
    • Verify Python 2 was correctly installed.
    • Expected Output.
    • Check that the version is set as the “Default Python Version.”
      The default version is the version of Python that is executed when you just type python.
    • Expected Output.

Final Python Setup

  • Now, we will set up Python Virtual Environments for each version of Python.
  • Python Virtual Environments are a method of creating isolated “environments” where specific versions of Python can be installed along with independent sets of libraries and dependencies.
  • Virtual Environment usage is a very common, and recommended, practice when working in Python.

Python 3 venv

  • Install venv.
  • Create a directory to put our Python programming environments in.
  • Create a Python 3 virtual environment using the venv.
  • To use this environment, you need to “activate” it.
    • Look for the name of the virtual environment to be enclosed in parenthesis after activation.
    • Expected Output.
  • Now verify that python is now linked to Python 3.
  • Deactivate the virtual environment.

Python 2 venv

  • Install the virtualenv package for Python within Python 2.
  • Expected Output.
  • Create a Python 2 virtual environment using the virtualenv module for Python 2.
  • Activate the environment. Look for the name of the virtual environment to be enclosed in parenthesis after activation.
  • Expected Output.
  • Now verify that python is now linked to Python 2.
  • Deactivate the virtual environment.

Node.js

Installation

  • Open a terminal.
  • Refresh local package index. Install node.js.
  • (Optional) Install npm (Node.js package manager).

Verification

  • Check the installed node version.

Step 5: Text Editors and IDE

Atom

Installation
  • Open a terminal (CTRL+ALT+T).
  • Run the following command.
  • NOTE: You can install updates by running:
Verification
  • Once installation is finished, you can start Atom by typing the following command in a terminal.
  • Or, you can start it from the start menu.

Step 6: Development Tools and Clients

Postman

Installation
  • You can install Postman on Ubuntu through the Ubuntu software center.
  • Open the Ubuntu Software Center. Search for “postman” and then click it.
  • Click Install.
Verification
  • Once the installation completes, Postman will open and allow you to sign up or sign in.
    • You do NOT need to sign in to use Postman.
    • You can click “Skip signing in and take me straight to the app…” to bypass login.
  • Test that you can make REST API calls with Postman with this fun “Dad Joke” API.
    • Close this pop up window.
    • Specify https://icanhazdadjoke.com/ into the address bar.
    • Select the Headers tab. Add a Key for Accept with a Value of application/json.
    • Click Send and enjoy your joke.

ngrok

Installation
  1. Open a terminal and change into the /opt directory.
  2. Use wget to download the ngrok application.
  3. Extract the downloaded file.
  4. Move the file into the /usr/local/bin directory to make it easily executable.
Verification
  1. Start a sample ngrok tunnel.
  2. Expected Output.
  3. Press Ctrl-C to quit ngrok.

Google Chrome

Installation
  1. Navigate to google.com/chrome. Click Download Chrome.
  2. Select 64 bit. deb (For Debian/Ubuntu). Click Accept and Install.
  3. Run the downloaded installer file. Ubuntu Software will open.
  4. Click Install.
  5. You will need to provide your password to gain root privileges.
  6. Install is complete.
Verification

To access the Chrome Developer tools:

  1. Open Google Chrome, and click the “three dots” to the right of the address bar to access the menu.
  2. Go to More tools and click Developer tools.
  3. You will now see the developer tools open within the window.
  4. You can close Google Chrome.

(Optional) OpenConnect

If you do not already have Cisco AnyConnect installed, you can install OpenConnect for an open source VPN client to use to connect to DevNet Sandboxes.

Installation
  • Open Terminal.
  • Install OpenConnect from the Ubuntu Universe software repository.
Verification

To verify the OpenConnect installation you’ll need a VPN server to connect to. Go to the DevNet Sandbox Catalog and reserve one of the sandboxes. Once the reservation is ready, you’ll be provided the VPN credentials needed.

  • CLI Method
    • From the terminal, run the following command.
  • Example output
  • GUI Method
    • Open System Settings => Network.
    • Click the plus button next to VPN to add a new connection.
    • Click Cisco AnyConnect Compatible VPN (openconnect).
    • On the Identity tab, complete as follows:

      • Name: Cisco DevNet
      • VPN Protocol: Cisco AnyConnect
      • Gateway: <gateway-fqdn>
      • Click Add
    • Confirm that you now have a new VPN connection available.
    • Click the off/on switch to enable it.
    • Click Connect to logon to the VPN.
    • Enter your username and password. Click Login.
    • Make a SecureSHell connection to a remote host to confirm that it is available via the VPN interface.
  • You should now have an active VPN connection to your sandbox, and be able to reach the resources contained within your pod.
  • You can end this process and disconnect with the following command.

Step 7: Application Container Engine

Docker

Installation — From Ubuntu Repository
  1. Install Docker and Docker Compose.
  2. Start docker and make sure it starts on boot.
  3. Verify that docker is running and enabled.
  4. Set up permissions so you don’t need sudo for every docker command.
    1. Create a docker group. The package for Ubuntu does this for you.
    2. Add your user to the docker group.
    3. Log out and log back in so that your group membership is re-evaluated.
Verification
  1. Open a terminal.
  2. See what version of docker is installed.
  3. Enter the following command to start a test container based on the “busybox” image.
  4. Verify it worked with the following command.The container will start and then stop showing no output.

Summary

You’ve completed the setup of the Linux developer workstation. Let us know if this article is of interest to you.

Resources
https://people.eng.unimelb.edu.au/lucasjb/oc.html