GNU Linux Fundamentals Presentation

Post on 27-Apr-2015

1,051 views 4 download

description

GNU Linux Fundamentals is given in this presentation

transcript

GNU/Linux Fundamentals Installing & Using

Prepared by Yağız KaymakPrepared by Yağız Kaymak

yagiz.kaymak@ieu.edu.tryagiz.kaymak@ieu.edu.tr

Changes/additions & design changes Changes/additions & design changes by Dr. Enis Karaarslanby Dr. Enis Karaarslan

What is linux?What is linux?

Linux refers to the family of Unix-like Linux refers to the family of Unix-like computer operating systems using computer operating systems using the Linux kernel. the Linux kernel.

Linux can be installed on a wide Linux can be installed on a wide variety of computer hardware, variety of computer hardware, ranging from mobile phones, tablet ranging from mobile phones, tablet computers and video game consoles, computers and video game consoles, to mainframes and supercomputersto mainframes and supercomputers. .

Linux – Server OSLinux – Server OS

Linux is the leading server OS, Linux is the leading server OS, accounting for more than 50% of accounting for more than 50% of installationsinstallations and runs the top 10 and runs the top 10 fastest supercomputers in the world.fastest supercomputers in the world.

(http://en.wikipedia.org/wiki/Linux )(http://en.wikipedia.org/wiki/Linux )

Linux - DesktopLinux - Desktop

Desktop use of Linux has increased in Desktop use of Linux has increased in recent years, recent years, • partly owing to the popular Ubuntu, partly owing to the popular Ubuntu,

Fedora, and openSUSE distributionsFedora, and openSUSE distributions • the emergence of netbooks and the emergence of netbooks and

smartphones running an embedded smartphones running an embedded Linux.Linux.

Linux (cntd.)Linux (cntd.)

The name "Linux" comes from the The name "Linux" comes from the Linux kernel, originally written in Linux kernel, originally written in 1991 by Linus Torvalds. 1991 by Linus Torvalds.

The main supporting user space The main supporting user space system tools and libraries from the system tools and libraries from the GNU Project (announced in 1983 by GNU Project (announced in 1983 by Richard Stallman) are the basis for Richard Stallman) are the basis for the Free Software Foundation's the Free Software Foundation's preferred name GNU/Linux.preferred name GNU/Linux.

Linux (cntd.)Linux (cntd.) Linux is an Linux is an open sourceopen source operating system operating system

kernelkernel.. IIt is a complete, free, open, t is a complete, free, open, operating operating systemsystem..

It already belongs to you – It already belongs to you – GNU GNU GPLGPL(General (General Public License)Public License)

Although you can build a Linux system Although you can build a Linux system from from scratchscratch, you don't have to. There are , you don't have to. There are distributions that let you install and maintain a distributions that let you install and maintain a Linux system easily.Linux system easily.

Ubuntu, Pardus, Fedora, SuSE, Slackware and Ubuntu, Pardus, Fedora, SuSE, Slackware and Debian and hundreds more!Debian and hundreds more!

GNU

FREE SOFTWARE

OPEN SOURCE

KERNEL

Some ConceptsSome Concepts

GNUGNU

The GNU Project was launched in The GNU Project was launched in 1984 to develop a complete Unix-like 1984 to develop a complete Unix-like operating system which is free operating system which is free software—software which respects software—software which respects your freedom.your freedom.

The combination of GNU and Linux is The combination of GNU and Linux is the GNU/Linux operating system, now the GNU/Linux operating system, now used by millions and sometimes used by millions and sometimes incorrectly called simply “Linux”.incorrectly called simply “Linux”.

Unix-like OS, KernelUnix-like OS, Kernel

Unix-like operating systems are built Unix-like operating systems are built fromfrom::• a collection of applications, libraries, a collection of applications, libraries,

and developer tooland developer toolss• a program to allocate resources and talk a program to allocate resources and talk

to the hardware, known as a kernel.to the hardware, known as a kernel.

Free SoftwareFree Software

““Free software” is a matter of liberty, Free software” is a matter of liberty, not pricenot price

Think of free as in “free speach”Think of free as in “free speach”

Not as in “Free Beer”Not as in “Free Beer” Free means FreedomFree means Freedom

(http://www.gnu.org)(http://www.gnu.org)

Free Software (cntd.)Free Software (cntd.)

Free software is a matter of the Free software is a matter of the users' freedom to run, copy, users' freedom to run, copy, distribute, study, change and distribute, study, change and improve the software. improve the software.

More precisely, it refers to four kinds More precisely, it refers to four kinds of freedom, for the users of the of freedom, for the users of the softwaresoftware

Free software - Freedom Free software - Freedom

1.1. The freedom to run the program, for any The freedom to run the program, for any purpose .purpose .

2.2. The freedom to study how the program works, The freedom to study how the program works, and adapt it to your needsand adapt it to your needs..

3.3. The freedom to redistribute copies so you can The freedom to redistribute copies so you can help your neighbor.help your neighbor.

4.4. The freedom to improve the program, and The freedom to improve the program, and release your improvements to the public, so release your improvements to the public, so that the whole community benefitsthat the whole community benefits..

Open SourceOpen Source ““Free software” requires “open Free software” requires “open

source”source” All software has source code. Open All software has source code. Open

source software grants every user source software grants every user access to that code. access to that code.

Freedom means choice. Freedom means choice. Choice means powerChoice means power

Why Open SourceWhy Open Source

Customer BasedCustomer Based Bugs are found and fixed more Bugs are found and fixed more

quicklyquickly TTechnology revolution driven by echnology revolution driven by

market demand.market demand.

For details:For details:

http://www.redhat.com/about/whyopensourcehttp://www.redhat.com/about/whyopensource/ /

Open Source WorldOpen Source World

Why should I use Linux?

Linux is a UNIX variant – UNIX is everywhere and so is Linux.

Linux is rock solid – stable, fast and secure.

Servers, which have to run 24/7 and have to handle millions of requests run Linux.

It is highly likely that you'll sit in front of a Linux/Unix machine at least once in your career.

It is easy to learn and use.

Virus infection is difficult and rare …

Before we begin

Get rid of all your prejudices.

Do not expect it to work like Windows.

Do not hesitate to read manuals and documentations or to do a simple search on Google in case you have a problem.

Everyone can use it, so why can't you – it's not rocket science; and you are to-be-engineers in a ‘Department of Computer Computer EngineeringEngineering' – so no excuses!

Also...

Linux is an Operating System,

Perfect for learning fundamentals of OS

Modifying and testing the systems

Ready for Open Source Projects

You will be responsible and will be expected to expected to useuse it in many courses during your study.

Getting Linux

ftp.linux.org.tr

Live CD /USBLive CD /USB

Many distributions have Live versions Many distributions have Live versions where you can test using it without where you can test using it without installing.installing.

Just be sure that device priority is set Just be sure that device priority is set for CD or USB in BIOS.for CD or USB in BIOS.

Installing Linux

Simple.

Boot from the install CD.

You need space on your hard-diskA partition that will belong only to Linux, 10 GB

minimumA swap partition that will be used as extra RAM in

case you run out of it, around 1-2 GB.

A Linux install CD – Ubuntu, Pardus, etc.

You can get a copy from Internet

Very Important Tips

If you want to have more than one Operating system on your PC/laptop

Have a partition/space plan of your hard disk

First install Windows in one partition Then Linux in other partitions.

A Partition For root (/) A Partition For /home A Partition For swap

Very Important TipsVery Important Tips (cntd.) (cntd.) Make sure you manually partition the Make sure you manually partition the

hard-disk, most Linux installers use hard-disk, most Linux installers use the the whole diskwhole disk as the as the defaultdefault option. option.

Do Do NOTNOT use Turkish characters such use Turkish characters such as ğ,ı,ş in your usernames and as ğ,ı,ş in your usernames and passwords. passwords.

Linux is case sensitiveLinux is case sensitive Make sure you don't lose or forget Make sure you don't lose or forget

your password, unless you want to your password, unless you want to install again. install again.

Linux Desktop

Depending on your op. sys. choice, you'll likely to get one of the following desktop environments: GNOME (Ubuntu, Fedora, Centos …etc) or KDE (Kubuntu, Pardus …etc).

There are other desktop environments (XFCE, Window Maker, Fluxbox, IceWM etc.) But GNOME and KDE are the most popular.

Both of them will look familiar with a 'Start' menu, taskbar, system tray, icons on desktop, drag and drop etc.

A Screenshot (GNOME)

A Screenshot (KDE)

KDE 3D Desktop

Desktop Applications

You may be familiar with: Firefox, Thunderbird, OpenOffice, GIMP, Opera, Skype, CodeBlocks...

You may want to try: Amarok, Kopete, Pidgin, Kdevelop...

Java Applications run too: Eclipse, Netbeans, Limewire and many more I cannot remember now.

What if you need more applications?

Repositories

There are not many 'Next, next Wizards' to install applications on Linux.

Usually, every distro has a central repository, where applications can be searched and installed with one command.

For example, let's say you need kwrite for the Op. Sys. course; it is highly likely that it is already installed, but let's try to install it using the repository.

Repository Tips

Always search the repository first before you install an application. Do not bother going to their web-site and downloading.

Both Ubuntu and Pardus have huge repositories, this will save you time.

Don't bother going to the application's web site and download a package. Do not bother to compile from source.

Installing a packageYou can download a package(e.g. kwrite) using

CLI with apt-get install kwrite command,

Installing a package(cont.)

Or you can use package repository.

More Repository Tips

You can also remove and update a package via the repositories.

The operating system may prompt you to update your system when updates are available.

Other than the official repositories of the distro, you may add additional repositories for more applications.

Kernel, Shell, CommandsKernel, Shell, Commands

Shell is...

An interpreter. It can execute commands.

A programming language. It has control structures, loops, variables and NO pointers :)

GUI vs CLI

CLI = Command Line Interface

Shell: Bash, Sh, Csh, Zsh, etc...

Interface between the user and the OS

Hello Bash!

Users in Linux

Superuser (root)Normal users (example: yagiz)A normal user account is used for daily usage

of the system.Superuser account is reserved for system

administrationEvery user belongs to one or more groupsLinux is very strict about permissionsEvery file belongs to a user

Becoming 'root'

From time to time you may need to become the superuser; for installing applications, setting system settings etc.

The commands: su and sudo

When you are root, BE VERY CAREFUL! The system considers you know what you are doing and does not ask you 'if you are sure' – it just executes the command!

Directory StructureDirectory Structure

Directory Explanation

/ Root - Starting Point of Directory Structure

/etc Configuration Files

/bin /sbin Binaries (programs)

/home Personal Files

/var Variable data about system

/usr User Applications and alike

/tmp Temporary Files

/dev Devices

/mnt Mount Points

/proc Virtual directory, some info about kernel

FilesPermissions user Size Date-Time File Name-rw-r--r-- 1 yagiz 99039 2009-09-29 18:57 file_system.png

-rwxr-xr-x 1 yagiz 475 2009-09-29 18:42 gnome-terminal.desktop

-rw-r--r-- 1 yagiz 67702 2009-09-29 18:36 kwiret_inst_1.png

-rw-r--r-- 1 yagiz 99798 2009-09-29 18:37 kwrite_inst_2.png

Changing Permission Examples (details later)

$ chmod 655 dosyaAdi

$ chmod 777 dosyaAdi2

$ chmod -R 546 dizinVeIcindekiler

Basic OS Commands

Command Description

ls Lists files in a directory

cd Change Directory

cp Copies file(s)

mv Moves (Renames) files

mkdir Creates a directory

rm Removes files or folders

less Less is more

mc Midnight Commander

man Manuals

Learning More

Manuals – the man command gives you more information about a command.

Try:man lsman cp

Reading the manuals, you can learn about the parameters and other features of the commands.

Redirecting

You can redirect the output of a command to a file.

For example:ls -l > filesList.txt

The '>' directs the output to the file.

Pipe

Pipes let you use the output of a program as the input of another one!

Here are a few samples:

ls -l | less ps aux | grep firefox | less

More Linux Commands

Text editors: vi, vim, pico, nanoChanging your password: passwdPrint Working Directory: pwdWho are you?: whoamiWho is logged in now?: whoHow long has it been?: uptimeSystem information: unameListing the tasks, processes: top, psStop the processes!: kill, killall

More!

How much space?: du, df, freeFile contents: lessPrint on screen: echoPath of a command: whichRename command: aliasCompressing: tarLinks: lnCompiling: gcc, g++, javac

Compiling and running a C program in Linux

To compile a C program you must have a compiler like gcc or g++ (we will use gcc)

If you already have a compiler to compile a source code just type

gcc -o outputfile file1.c

To run the executable file type

./outputfile and press enter

A Few LinksPardus - http://www.pardus.org.tr/

Özgürlük İçin, Pardus http://www.ozgurlukicin.com/

Ubuntu - http://www.ubuntu.com/

Ubuntu Guide – http://www.ubuntuguide.org

LKD (Linux Kullanıcıları Derneği) http://www.linux.org.tr/

Linux Belgelendirme Grubu http://www.belgeler.org/

All Distros: Distrowatchhttp://distrowatch.com/