32
COMPUTER SCIENCE MENTOR SCHEME Session 1: Linux and Git

COMPUTER SCIENCE MENTOR SCHEME

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: COMPUTER SCIENCE MENTOR SCHEME

COMPUTER SCIENCE MENTORSCHEME

Session 1: Linux and Git

Page 2: COMPUTER SCIENCE MENTOR SCHEME

PREFACEAll materials available online at

Link is available in Discord/Teams.

https://thytom.github.io/session1

Page 3: COMPUTER SCIENCE MENTOR SCHEME

ME• Archie• Senior mentor• Discord co-admin• Wrote the Registration Bot (sorry)

Page 4: COMPUTER SCIENCE MENTOR SCHEME

TOPICS• Configuring VirtualBox• Working with Linux• Using Git for projects

Several demos using Linux, feel free to follow along.

Page 5: COMPUTER SCIENCE MENTOR SCHEME

SHOW OF HANDSWho has:

• Installed VirtualBox• Installed an Ubuntu VM• Installed the Guest Utilities

Page 6: COMPUTER SCIENCE MENTOR SCHEME

INSTALLING UBUNTU ONVIRTUALBOX

https://linuxhint.com/install_ubuntu_virtualbox_2004

Page 7: COMPUTER SCIENCE MENTOR SCHEME

VIRTUALBOX CONFIGURATIONYou can change settings about your VM.

It is recommended to set:

• Memory 4GB or more if you can• Video memory 128MB• More than one CPU core

Page 8: COMPUTER SCIENCE MENTOR SCHEME

DEMO: FRESH UBUNTU VM

Page 9: COMPUTER SCIENCE MENTOR SCHEME

SOME PROBLEMS• Mac users - setting up guest/host copy/paste• 32-bit only

We have mentors on hand who can help you.

Page 10: COMPUTER SCIENCE MENTOR SCHEME

THE PACKAGE MANAGER• Linux programs are bundled into packages• Install and update via the package manager• Updates all your programs*• Ubuntu uses two package managers, apt and snap

Page 11: COMPUTER SCIENCE MENTOR SCHEME

APT COMMANDS# Update package database

$ sudo apt update

# Perform system update

$ sudo apt upgrade

# Install packages

$ sudo apt install [packages...]

Page 12: COMPUTER SCIENCE MENTOR SCHEME

SNAP COMMANDSSnap packages are automatically updated.

# Install a package

$ snap install spotify

Page 13: COMPUTER SCIENCE MENTOR SCHEME

VIRTUALBOX GUEST ADDITIONS• VirtualBox drivers to talk to the host• This allows for:▪ better performance▪ higher resolutions/fullscreen▪ shared copy/paste

There are several packages needed to make this work(listed later):

$ sudo apt install virtualbox-guest-utils virtualbox-guest-

dkms virtualbox-guest-x11

Page 14: COMPUTER SCIENCE MENTOR SCHEME

TEXT EDITOR• Ubuntu comes with GEdit• There are many others• We recommend Visual Studio Code (vscode)

$ snap install --classic vscode

Page 15: COMPUTER SCIENCE MENTOR SCHEME

BUILD-ESSENTIAL, VALGRIND, GITBuild-essential: Meta-package, pulls in a bunch of

useful build tools like gcc and make.

Git: more on this later, you’ve likely already used it.

Valgrind: Used later on in PGA for debugging.

Page 16: COMPUTER SCIENCE MENTOR SCHEME

PACKAGE LIST# Build tools (used in PGA)

build-essential git valgrind

# Virtualbox Guest Utils

virtualbox-guest-dkms

virtualbox-guest-x11

virtualbox-guest-utils

# Visual Studio Code (via snap)

vscode

Page 17: COMPUTER SCIENCE MENTOR SCHEME

DEMO: INSTALLING PACKAGES

Page 18: COMPUTER SCIENCE MENTOR SCHEME

WHAT IS GIT?

Page 19: COMPUTER SCIENCE MENTOR SCHEME

WHAT IS GIT?

• Version Control System (VCS)• Every change is recorded• “Timeline” for your code

Page 20: COMPUTER SCIENCE MENTOR SCHEME

BASICS OF GIT• Projects are stored in repositories• Repositories contain all your code• They also contain the history of your code

Page 21: COMPUTER SCIENCE MENTOR SCHEME

BASICS OF GIT• Changes are committed to the history• History is permanent*• Time-travel - roll back to previous commits

Page 22: COMPUTER SCIENCE MENTOR SCHEME

DEMO: COMMITSMaking changes, committing them

Page 23: COMPUTER SCIENCE MENTOR SCHEME

BRANCHES• Create a branch in history• Develop features in isolation▪ Changes don’t affect main branch

• Merge branch when done

Page 25: COMPUTER SCIENCE MENTOR SCHEME

DEMO: BRANCHING

Page 26: COMPUTER SCIENCE MENTOR SCHEME

GITLAB/GITHUB• Online git hosting platforms• A copy called the remote repository• Everyone pulls updates from the remote• Then pushes changes back

Page 27: COMPUTER SCIENCE MENTOR SCHEME

UNIVERSITY GITLAB

• Private university GitLab instance• You can host projects here• Make use of it!

(Some courseworks will be released on here)

https://projects.cs.nott.ac.uk

Page 28: COMPUTER SCIENCE MENTOR SCHEME

EXTRA FEATURES• Issue tracker• Merge/Pull requests• CI/CD• Forking

Page 29: COMPUTER SCIENCE MENTOR SCHEME

DEMO: GITLAB• Creating a remote GitLab repository• Pushing to it

Page 30: COMPUTER SCIENCE MENTOR SCHEME

BENEFITS OF GITSafety

Complete history of changes, remote back-upsCollaboration

Work on the same project from multiple placesFeature separation

Implement a feature, merge when it’s readyMaintainability

Branches, issues and good commits keeps codeorganised and clean.

Page 31: COMPUTER SCIENCE MENTOR SCHEME

QUESTIONS?

Page 32: COMPUTER SCIENCE MENTOR SCHEME

TASK20 minutes

If you haven’t: Welcome To The Machine

Otherwise, follow the worksheet handed out to you.

Ask a mentor for help if you need it.