hpc4 linux advanced

38
Mohammad Reza Gerami [email protected] 1

Upload: mohammad-reza-gerami

Post on 21-Jul-2015

43 views

Category:

Education


3 download

TRANSCRIPT

Page 1: Hpc4 linux advanced

Mohammad Reza Gerami [email protected] 1

Page 2: Hpc4 linux advanced

Linux Advanced

Mohammad Reza Gerami

2

Middleware Group

[email protected]

Page 3: Hpc4 linux advanced

Disk Management

Linux Advanced

Limiting Users

File System Health Check

Installing Software in GNU/Linux

Linux Introduction

Mohammad Reza Gerami [email protected] 3

Page 4: Hpc4 linux advanced

Linux Introduction

Mohammad Reza Gerami [email protected] 4

Page 5: Hpc4 linux advanced

Linux Introduction

Mohammad Reza Gerami [email protected] 5

A Linux distribution has software worth thousands of

dollars, for virtually no cost

Linux operating system is reliable, stable, and very

powerful

Linux comes with a complete development environment,

including compilers, toolkits, and scripting languages

Linux comes with networking facilities, allowing you to

share hardware

Linux utilizes your memory, CPU, and other hardware to

the fullest

A wide variety of commercial software is also available

Linux is very easily upgradeable

Supports multiple processors as standard

True multitasking. So many apps, all at once

Page 6: Hpc4 linux advanced

Linux Introduction

Mohammad Reza Gerami [email protected] 6

Freely Downloadable from websites

Available as sets of CDs

Installation is very simple

After installation you can create logins

for different users

Each user may login by his/her own login

and passwd – own login area

Upon login, default directory is home

directory of the user

Page 7: Hpc4 linux advanced

Linux Introduction

Mohammad Reza Gerami [email protected] 7

ls, Give a listing of the current directory. Try

also ls -l

cp, Copy file from source to destination

mv, Move file from source to destination. If both

are the same directory, the file is renamed

vi, Edit a file. vi is one of the most powerful

text editors

chmod, Change file permissions

mkdir, rmdir Make/Remove a directory

cd, Change directory

rm, Remove a file. Can also remove directory tree

man ls, Get help for ls. All commands have help

Page 8: Hpc4 linux advanced

Linux Introduction

Mohammad Reza Gerami [email protected] 8

/

bin boot dev

sdahda

etc home

reza

masoodali

lib sbin

Page 9: Hpc4 linux advanced

Linux Introduction

Mohammad Reza Gerami [email protected] 9

/

bin

boot

dev

etc

home

lib

lost+found

misc

mnt

opt

proc

root

sbin

tmp

usr

var

/bin System binaries, including the command shell

/boot Boot-up routines

/dev Device files for all your peripherals

/etc System configuration files

/home User directories

/lib Shared libraries and modules

/lost+found Lost-cluster files, recovered from a disk-check

/mnt Mounted file-systems

/opt Optional software

/proc Kernel-processes pseudo file-system

/root Administrator’s home directory

/sbin System administration binaries

/usr User-oriented software

/var Various other files: mail, spooling and logging

Page 10: Hpc4 linux advanced

Login

Sudoers

Process

File Size

Limiting Users

Mohammad Reza Gerami [email protected] 10

Page 11: Hpc4 linux advanced

Limiting Users

Directory

/etc/security

Login edit limits.conf@test - maxlogin 1

Process@test hard nproc 6 (count of Process)

File Size@test hard fsize 500 (kilobyte)

Mohammad Reza Gerami [email protected] 11

Page 12: Hpc4 linux advanced

Limiting Users

core -- Limits the core file size (KB); usually set to 0 for most users to prevent core dumps.data -- Maximum data size (KB).fsize -- Maximum file size (KB).memlock -- Maximum locked-in-memory address space (KB).nofile -- Maximum number of open files.rss -- Maximum resident set size (KB).stack -- Maximum stack size (KB).cpu -- Maximum CPU time (MIN).nproc -- Maximum number of processes.as -- Address space limit.maxlogins -- Maximum number of logins for this user or group.priority -- The priority to run user process with.

Mohammad Reza Gerami [email protected] 12

Page 13: Hpc4 linux advanced

Limiting Users

Sudoers

The super user with unrestricted access to all system resources and

files in Linux is the user named root.

If a server needs to be administered by a number of people it is

normally not a good idea for them all to use the root account. This is

because it becomes difficult to determine exactly who did what, when

and where if everyone logs in with the same credentials. The sudo

utility was designed to overcome this difficulty.

Mohammad Reza Gerami [email protected] 13

Page 14: Hpc4 linux advanced

Sudoers Example

/etc/sudoers

User_Alias OPERATORS = reza,masood

Runas_Alias OP = root, operator

Host_Alias DataCenter = 10.10.10.0/255.255.255.0

Host_Alias Servers = 20.20.20.0/24

Cmd Server_cmd = ls,vi,cat,top

OPERATORS ALL=ALL

reza ALL=(ALL) ALL

masood DataCenter = (ALL) ALL

reza Servers = (reza) Server_cmd

Mohammad Reza Gerami [email protected] 14

Page 15: Hpc4 linux advanced

Journaling Filesystems

Foreign Filesystems

DISK Management

Mohammad Reza Gerami [email protected] 15

Page 16: Hpc4 linux advanced

Disk Management Journaling

A journaling file system is a file system that keeps track

of the changes that will be made in a journal (usually a

circular log in a dedicated area of the file system) before

committing them to the main file system.

In the event of a system crash or power failure, such file

systems are quicker to bring back online and less likely to

become corrupted

Mohammad Reza Gerami [email protected] 16

Page 17: Hpc4 linux advanced

Disk Management Journaling

Third Extended The Third Extended Filesystem (ext3 or ext3fs)

ReiserFS This filesystem is a completely new design, which was added to the 2.4.1 Linux kernelXFS XFS is Silicon Graphics's (SGI's) journaling filesystemJFS IBM's Journaled Filesystem (JFS)

Mohammad Reza Gerami [email protected] 17

Page 18: Hpc4 linux advanced

Disk Management Journaling

Mohammad Reza Gerami [email protected] 18

Page 19: Hpc4 linux advanced

Disk Management Foreign Filesystems

Microsoft FilesystemsFAT The File Allocation Table (FAT)HPFS Microsoft developed the High−Performance Filesystem

(HPFS)NTFS The New Technology Filesystem (NTFS)

Network FilesystemsNFS Sun's Network Filesystem (NFS)Coda This is an advanced network filesystem that supports

features omitted from NFSSMB/CIFS The Server Message Block (SMB) protocol, which

has been renamed the Core Internet Filesystem (CIFS)

Mohammad Reza Gerami [email protected] 19

Page 20: Hpc4 linux advanced

File System Health Check

File System Health Check

Mohammad Reza Gerami [email protected] 20

Page 21: Hpc4 linux advanced

File System Health Check

On a Linux or Unix server, you can run the fsck command to check

your file system’s integrity and also make repairs when necessary.

Under normal circumstances, you probably have no reason to run this

command, and Linux will detect problems at boot and run fsck in the

event of a power failure or other abnormal shutdown. If you do need to

run it, you will have to unmount the file system you want to check.

Follow these steps:

As Root, go to single user mode:

# init 1

Unmount the partition you want to check:

# umount /dev/sda1

Run fsck:

# fsck /dev/sda1

Remount the filesystem:

# mount -a

Return to multiuser mode (Init 2 or 3)

# init 3

Mohammad Reza Gerami [email protected] 21

Page 22: Hpc4 linux advanced

Command-line process

Installing Software in GNU/Linux

Graphical (GUI) process

Mohammad Reza Gerami [email protected] 22

Page 23: Hpc4 linux advanced

Command-line process

Compiling and Installing software from sourceInstalling RPM's using the Red hat Package ManagerInstalling using Debian's apt-getInstalling with fedora / yum

Mohammad Reza Gerami [email protected] 23

Page 24: Hpc4 linux advanced

Compiling and Installing software

from sourceInstalling from source code is the most difficult method for obtaining software on Linux and in most cases is not necessary. Most popular software can be found and installed quite easily using your distribution's package manager (see sections on "apt-get" and "yum"). Installing from source is recommended only for experienced Linux users and/or those who aren't afraid to break something for the purpose of learning

Mohammad Reza Gerami [email protected] 24

Page 25: Hpc4 linux advanced

Compiling and Installing software

from sourceTypically applications you must compile from source will come as a ".tar.gz", ".tar.bz2", or ".zip" file.

tar -zxvf <filename>ConfigureMakeMake install

Mohammad Reza Gerami [email protected] 25

Page 26: Hpc4 linux advanced

Installing RPM's using the Redhat Package Manager

Redhat RPM's offer a flexible and easy method to install new software. Software installed from an RPM package differs from compiling from source in a few ways, but the most important one of all is the software is already compiled for you. rpm -i <filename.rpm>rpm -qa <package>rpm -e <package>

Mohammad Reza Gerami [email protected] 26

Page 27: Hpc4 linux advanced

Installing RPM's using the Redhat Package Manager

Installing using Debian's apt-getapt-get install <package_name>apt-get remove <package_name>

Installing with fedora|CentOS / yumyum installyum removeyum update

Mohammad Reza Gerami [email protected] 27

Page 28: Hpc4 linux advanced

Graphical Based process

Using Synaptic (Fedora, Ubuntu)Using YaST2 (SuSE, openSuSE)

Mohammad Reza Gerami [email protected] 28

Page 29: Hpc4 linux advanced

IP Assignment

IPTables

Configuration File

Networking Tools

Linux Network Configuration

Firewall

Mohammad Reza Gerami [email protected] 29

Page 30: Hpc4 linux advanced

Linux Network Configuration

IP Asignment

ifconfig (device name) IP [netmask subnetmask]

ifconfig eth1 1.1.1.1 [netmask 255.255.255.0]

ifconfig eth1:0 1.1.1.2 netmask 255.255.255.0

/etc/init.d/network restart

Mohammad Reza Gerami [email protected] 30

Page 31: Hpc4 linux advanced

IP Assignment

DNS/etc/resolv.conf

nameserver 4.2.2.4

Default Gatewayroute add default gw <gw-ip>

route add default gw 192.168.10.1

route del default gw <gw-ip>

route del default gw 192.168.10.1

route -n

Mohammad Reza Gerami [email protected] 31

Page 32: Hpc4 linux advanced

Configuration File

Files Pathetc/sysconfig/network-scripts/ifcfg-eth1

DEVICE=eth1

ONBOOT=yes

BOOTPROTO=static

HWADDR=00:0c:29:24:8d:c6

TYPE=Ethernet

HOSTNAME=Nightingale

IPADDR=192.168.10.2

NETMASK=255.255.255.0

NETWORK=192.168.10.0

BROADCAST=192.168.10.255

GATEWAY=192.168.10.1

Mohammad Reza Gerami [email protected] 32

Page 33: Hpc4 linux advanced

Networking Tools

ping

Check a status of a host Alive or Not

ping 192.168.10.1

ethtool

Check Network Card

ethtool eth1

traceroute

see your hops between hosts

traceroute google.com

Mohammad Reza Gerami [email protected] 33

Page 34: Hpc4 linux advanced

Networking Tools

telnet

Diagnostics

telnet 192.168.10.1 80

nmap

nmap seeing what ports are open on a host

nmap 192.168.10.1

Mohammad Reza Gerami [email protected] 34

Page 35: Hpc4 linux advanced

Firewall

Mohammad Reza Gerami [email protected] 35

Page 36: Hpc4 linux advanced

FirewallNetwork firewall

Protect your network

Personal Firewall

Protect your personal system (pc/laptop,…)

Mohammad Reza Gerami [email protected] 36

Page 37: Hpc4 linux advanced

Firewall

Hardware

Appliance Device

Software

Combine software and hardware

Mohammad Reza Gerami [email protected] 37

Page 38: Hpc4 linux advanced

Firewall

State Less

Transmit traffic without check

State Full

Check all of data transmission

Mohammad Reza Gerami [email protected] 38