Welcome to my journey of continuous discovery. Enjoy your visit.

Ugli Scripting
Ugli Scripting
  • Home
  • Blog
  • .PY
    • Python 2.7 on Windows
    • Python 2.7 on Ubuntu
    • Python 2.7 IDE Set up
    • Run Python Script via CLI
    • Adding Python Packages
    • Basic REST API
  • .PS1
    • Install AD Module Win 10
    • Connecting to MSO and EOP
    • Storing Script Variables
    • Storing Secure Strings
    • Storing User Credentials
    • Basic REST API
  • Sample Integrations
    • Isolate SEP Clients
    • Force Password Change
    • o365 Account Remediation
    • Threat Response Lists
    • Endpoint Scripts
  • SITQ Lab
    • Lab Resources
    • AD Lab Account Imports
    • DLP Sample
  • More
    • Home
    • Blog
    • .PY
      • Python 2.7 on Windows
      • Python 2.7 on Ubuntu
      • Python 2.7 IDE Set up
      • Run Python Script via CLI
      • Adding Python Packages
      • Basic REST API
    • .PS1
      • Install AD Module Win 10
      • Connecting to MSO and EOP
      • Storing Script Variables
      • Storing Secure Strings
      • Storing User Credentials
      • Basic REST API
    • Sample Integrations
      • Isolate SEP Clients
      • Force Password Change
      • o365 Account Remediation
      • Threat Response Lists
      • Endpoint Scripts
    • SITQ Lab
      • Lab Resources
      • AD Lab Account Imports
      • DLP Sample

  • Home
  • Blog
  • .PY
    • Python 2.7 on Windows
    • Python 2.7 on Ubuntu
    • Python 2.7 IDE Set up
    • Run Python Script via CLI
    • Adding Python Packages
    • Basic REST API
  • .PS1
    • Install AD Module Win 10
    • Connecting to MSO and EOP
    • Storing Script Variables
    • Storing Secure Strings
    • Storing User Credentials
    • Basic REST API
  • Sample Integrations
    • Isolate SEP Clients
    • Force Password Change
    • o365 Account Remediation
    • Threat Response Lists
    • Endpoint Scripts
  • SITQ Lab
    • Lab Resources
    • AD Lab Account Imports
    • DLP Sample

Python 2.7 on Ubuntu 16

Install a copy of Ubuntu 16.x

 The mission of the Python Software Foundation is to promote, protect,  and advance the Python programming language, and to support and  facilitate the growth of a diverse and international community of Python  programmers. 


Requirements:

- The Ubuntu install CD or .ISO

- A compatible system (see Lab System Tip)


Ubuntu can be downloaded from the following link:

https://www.ubuntu.com/


There is Plenty of documentation available on installing Ubuntu.  We don't need a GUI or Desktop tools.  We will be proceeding command line only.

Important Note Regarding Python Version

DO NOT INSTALL or UPGRADE to Python 3.x

I'm not clear on all the differences, but all my current testing is done on the latest version of 2.x.

Updating Ubuntu and Python

Python 2.x is installed with Ubuntu by default.  In the event Python was not installed or you are adding Python to an existing Ubuntu instance, please reference Installing Python 2.7 below.


Requirements:

-The installed Ubuntu instance from above.

-Command line access to the Ubuntu instance.


Connect to your Ubuntu host via command line and run the following commands to update Ubuntu and installed modules.


$ sudo apt update


$ sudo apt upgrade


You can run the same scripts a second time to confirm all updates and upgrades have been installed.


Adding the Python 'requests' Package

As you begin developing more complex scripts, you will need to import packages to extend the functionality of Python. This process is quite simple and is made even easier as many scripting tools will manage this process within their application.  It is important to understand how to add a package via command-line so we will import one right now.  


One package we will use is the Python 'requests' package.

This package adds the ability to make requests application to applications with Rest APIs. With the request you can either GET, POST or DELETE data to-and-from the application.


First you need to install Pip for Python.   Pip is a package management system used to install and manage software packages written in Python.  It is super easy.  Run the command below to install Pip.


$ sudo apt install python-pip


Now that Pip is installed you can use it  to install Python Requests. Run the command below to install Requests.


$ pip install requests


All done!

You now have a platform to run and develop Python scripts.  Now is a good time to choose an IDE (integrated Development Environment)

Check out PyCharm from Jetbrains

Only needed for existing Ubuntu installations without Python

Before moving forward, double-check that you don't have Python already installed. 


$ /usr/bin/python -V

OR

$ /usr/bin/python --version


Requirements:

-The installed Ubuntu instance from above.

-The Python install files for Linux.  Ubuntu use Debian packages (.deb).


Python can be downloaded from Python.org.


Direction for installing Python can be  found in the Step-by-Step instructions which can be found in the TecAdmin.net website

TecAdmin: How to Install Python 2.7.14 on Ubuntu & LinuxMint

TecAdmin: How to Install Python 2.7.14 on Ubuntu & LinuxMint

Copyright © 2018 Ugli Scripting - All Rights Reserved.

  • Blog
  • CV

Powered by GoDaddy