System setup

Dr Peadar Grant

Data Architecture

In this lab you will setup the tools needed for the first part of the module, where we focus on relational database systems. We will primarily be using the PostgreSQL database.

1 PowerShell setup

We will use PowerShell to help you automate a few tasks.

Windows users
should jump ahead to subsection 1.3.
Mac users
should start at subsection 1.1.
Linux users
should start at subsection 1.2.

1.1 Mac PowerShell setup

Follow the installation via direct download instructions from Microsoft.

PowerShell can be then accessed by opening Terminal and running pwsh. You should see output similar to:

PowerShell 6.1.3  
Copyright (c) Microsoft Corporation. All rights reserved.  
 
https://aka.ms/pscore6-docs  
Type 'help' to get help.  
 
PS /Users/peadar/Desktop>

Jump ahead to subsection 1.3.

1.2 Linux PowerShell setup

If using GNU/Linux or other UNIX OS please discuss with me. PowerShell can be installed on these operating systems. You do not need a Windows virtual machine.

1.3 Test script

Download the file test_script.ps1 and save it to your desktop. Open PowerShell and navigate to the desktop cd Desktop. Then run the script:

.\test_script.ps1

If everything is working, you should see:

if you see this message then PowerShell is working

1.4 Permitting script execution

Search for PowerShell in the start menu, right click and choose Run as Administrator. Authorise the admin access if required. Then enter the command:

set-executionpolicy remotesigned

Exit the administrator PowerShell window and return to the previous one. Try the test script in subsection 1.3 again.

1.5 Unblocking the script file

Windows provides an additional security mechanism to limit the runnability of files downloaded from the internet. If the script file is still blocked try:

Unblock-File test_script.ps1

Then try the test script in subsection 1.3 again.

If it now works you have setup PowerShell to execute scripts. You will need to run Unblock-File on each downloaded script.

2 SSH client installation

.

3 SSH key creation

SSH is a protocol we will use to login to remote servers and use their command shell. It is widely used for logging in to UNIX/Linux and increasingly Windows servers.

SSH supports a variety of authentication methods. The most basic is the username/password.

We will make use of the alternative and more secure key-based authentication. Most of you will probably not already have an SSH key. If you already have an SSH key then skip ahead to ?.

3.1 Creating SSH key

The following instructions work for both Windows and Linux. To create a 4096-bit RSA key type in Powershell/Bash:

ssh-keygen -t rsa -b 4096

You can hit enter at all the prompts to create the SSH key with no passphrase.