Basic orientation to Linux

Preview:

Citation preview

Basic Orientation to Linux

Compilation of Slides used in courseBasic Orientation to Linux

Conducted in February 2016Vidyaratha Kissoon

Email vidyak1@gmail.com

Distributed under Creative Commons Attribution-ShareAlike 4.0 International License

.(Evolved from an outline prepared by

Andrew Mancey )

By the end of the orientation..

Participation should be able to

explain free and open source software (FOSS), and explore options

select and install any distribution of Linux

recommend various free and open source software options to people who are interested

explore some of the system management issues related to the Linux operating system

Know how to find answers to questions about Free and Open Source Software including Linux

Methodology

Presentations, hands on practice– Computers needed, network infrastructure

Responsive to needs of participants Multiple sessions, with about 90 to 120

minutes per session depending on participant needs

Interactive Participant evaluation at the end of the

course

Topics

Free and Open Source Software

Linux

Installation of distros

Drivers

Navigating the Linux the File System– File permissions

Managing Users

Adding software

Networking – SSH, Samba (Finding help )

WINE

Definition of FOSS

Free Software Movement − The freedom to run a program, for any purpose;

− The freedom to study how a program works and adapt it to a person’s needs. Access to the source code is a precondition for this;

− The freedom to redistribute copies so that you can help your neighbour; and

− The freedom to improve a program and release your improvements to the public, so that the whole community benefits. Access to the source code is a precondition for this

− libre vs gratuit Richard Stallman is the founder

Definition of FOSS..

Free redistribution

Source code

Derived works

Integrity of author's code

No discrimination against users

No discrimination against fields of endeavour

Distribution of license

License must be technology-neutral

License must not be specific to a product

License must not restrict other software

Managed be Open Source Initiative, focussed on technical issues

Types of FOSS

Operating Systems - Linux, FreeBSD

Databases - MySql, PostgreSQL

Webservers – Apache, Nginx, Lighthttpd,

CMS – Drupal, Joomla

Elearning – Moodle, Claronline

Graphics – GIMP, Blender, Inkscape

Internet Apps – Firefox, Opera, Ekiga

Multimedia – VLC, Mplayer,

Productivity – Libre Office, Open Office, GnuCalc, Abiword

GIS – QGIS, GRASS,

and hundreds of others – some on Other Operating Systems

Why bother with FOSS?

Security Reliability/Stability Open standards and vendor

independence Reduced reliance on imports Developing local software capacity Piracy, IPR, and WTO Localization

Why bother with FOSS..

But..− lack of business applications− interoperability with proprietary systems− limited documentation and 'polish'− Learning curve

What is Linux

Linux the kernel

− Linux was originally the name of the kernel created by Linus Torvalds and is currently maintained by a team of developers.

Linux – the distributions

− the kernel, plus the system libraries, GUI, various databases, web servers, email utilities, desktop software and others.

− Debian, Ubuntu, CentOS, Red Hat, SUSE/open Suse DamnSmallLinux, Tiny Core Linux, Linux Mint – some free, some not so free

− Different Distros available for different kinds of devices− Not all applications are “FOSS” (eg skype ),

Kernel, Shell

Linux OS

- everything is a file, or process (or socket)

- e.g. printing – is writing to a 'device file'

- documents, executable scripts, directories

- kernel, shell

- Inodes

Inodes

Before Installation..

Assessing Current System RAM, space, graphic cards, etc

Distribution selection Depends on needs Desktop vs Server use Variety to chose from

System Preparation Dual boot , Partition hard drives Installation media (Live CD, StartupUSB)

Drivers...

• Safely, most vendors are providing drivers which could work with Linux

– Example Printer drivers

• “Nvidia still offers the worst open-source support, compared to Intel and AMD” http://www.pcworld.com/article/2911459/why-nvidia-graphics-cards-are-the-worst-for-open-source-but-the-best-for-linux-gaming.html

• Drivers are available, but 'closed source'

Partition

One partition for Root file system

Swap partition (like extra virtual memory)

Partition for user files

Do the installation

File system

Linux Directory structure

http://www.tecmint.com/linux-directory-structure-and-important-files-paths-explained/

File system

/bin Common programs, shared by the system, the system administrator and the users.

/boot The startup files and the kernel, vmlinuz. In some recent distributions also grub data. Grub is the GRand Unified Boot loader and is an attempt to get rid of the many different boot-loaders we know today.

/devContains references to all the CPU peripheral hardware, which are represented as files with special properties.

/etc Most important system configuration files are in /etc, this directory contains data similar to those in the Control Panel in Windows

File system

/homeHome directories of the common users.

/initrd (on some distributions) Information for booting. Do not remove!

/lib Library files, includes files for all kinds of programs needed by the system and the users.

/lost+found Every partition has a lost+found in its upper directory. Files that were saved during failures are here.

/misc For miscellaneous purposes.

/mnt Standard mount point for external file systems, e.g. a CD-ROM or a digital camera.

/net Standard mount point for entire remote file systems

/opt Typically contains extra and third party software.

/proc A virtual file system containing information about system resources. More information about the meaning of the files in proc is obtained by entering the command man proc in a terminal window. The file proc.txt discusses the virtual file system in detail.

File system

/root The administrative user's home directory. Mind the difference between /, the root directory and /root, the home directory of the root user.

/sbin Programs for use by the system and the system administrator.

/tmp Temporary space for use by the system, cleaned upon reboot, so don't use this for saving any work!

/usr Programs, libraries, documentation etc. for all user-related programs.

/var Storage for all variable files and temporary files created by users, such as log files, the mail queue, the print spooler area, space for temporary storage of files downloaded from the Internet, or to keep an image of a CD before burning it.

Commands

Open Terminal Window

(tab completion )

Type ls

Ls -a

Ls -l

Cd

mkdir

Attributes(https://www.ntu.edu.sg/home/ehchua/programming/howto/Unix_Basics.html)

File permissions

owner - The Owner permissions apply only the owner of the file or directory, they will not impact the actions of other users.

group - The Group permissions apply only to the group that has been assigned to the file or directory, they will not effect the actions of other users.

all users - The All Users permissions apply to all other users on the system, this is the permission group that you want to watch the mos

Permission types

Each file or directory has three basic permission types:

read - The Read permission refers to a user's capability to read the contents of the file.

write - The Write permissions refer to a user's capability to write or modify a file or directory.

execute - The Execute permission affects a user's capability to execute a file or view the contents of a directory.

File permission ls -l

Binary number system

U g o

rwx | r-x | r-- |

111 101 100

7 5 4

Permission is described as 754

Changing permissionschmod command

– changing permissions

let's create some files

– touch mango.txt

– touch pear.txtBinary arithmetic

chmod ug+x pear.txtChmod 777 mango.txtChmod ugo-w mango.txt

Adding groups and users

(all lower case )

- super user/root

- other users

- process users

“Sudo adduser john”

Check /etc/passwd

sudo addgroup <groupname>

adduser <username> <groupname>

Changing passwords

Passwd

sudo passwd <username>

sudo passwd -l/u <username>

Deluser <username>

Adding software

Software repositories

Distribution host

Software creators (original websites)

Third Party repositories (ppa) Trusted sources!!!

GitHub, other places

Compiling from Source

Managing RPM, deb packages

Downloading Download .deb package Download source code

− Tarball (tar, and then zipped gz, bz, )− tar -zxvf <filename>.tar.gz− -z to tell tar to run this file through gzip to decompress (use -j for bzip files)− -x to extract the files− -v for “verbose”, so we can see a list of the files it’s extracting− -f to tell tar that we’re working with a file

Or “Check out” source code− ./configure− make to create 'Makefile'− Make install− Run sample files

Package managers

Advanced Packaging Tool (on debian), yum on Red Hat, etc

Apt has a local package database, yum does not

Sudo apt-get install …

Let us try installing

Vlc. Inkscape

Pdfsam

Compiling source

sudo apt-get install build-essential

Example : Pdfsandwich – from source

Download source tarball

Extract

./configure

Make

Make install

Network GUI

Desktop Network tools, Edit Network Connections Command “ifconfig “

SSH

Secure shell access

Set up a server

Clients then 'ssh' into the server over the network

sudo apt-get install openssh-server

Edit “/etc/ssh/sshd_config

“sudo restart ssh “ or “sudo systemctl restart ssh”

From client : ssh <remote_username>@<host>

Use PUTTY as a client

Samba – File sharing

Install the samba server

Install

Configure it

Create the shared folders

Mapping drives, Mount the drives

Printer sharing

Wine

Compatibility layer (not an emulator) Many .exe files, there might be some

performance issues Some games, etc, (Steam)