Sei sulla pagina 1di 21

Linux for S/390

Linux internals
Michael MacIsaac
mikemac@us.ibm.com

ITSO

Linux for S/390


Agenda

Agenda

ITSO

1-2
Linux for S/390
Agenda for the day

Introduction
Linux for S/390 history
Linux distributions
VIF
Positioning Linux for S/390
Linux for S/390 installation
Linux internals
Enterprise solutions, summary, demo

ITSO

Linux for S/390


Internals: Overview

Architecture
Shells, environment
Important commands, directories and files
Basic
Help
Networking
File systems
Software installation and maintenance
Startup, shutdown, daemons
Process management
Users, groups, passwords
Archiving, backup, restore
Searching
Application development

ITSO

3-4
Linux for S/390
Internals: Linux block structure

Linux applications

Linux kernel GNU runtime library

common,
network protocols filesystems

management
management
architecture

memory

process
agnostic code
common, generic drivers

S/390 dependent HW dependent driver


arh

arh
layer

S/390 instruction set and I/O Hardware

ITSO

Linux for S/390


Internals: Virtual file system
The VFS is an indirection layer which handles the file oriented system calls and calls the
necessary functions in the physical filesystem code to do the I/O

user process Linux kernel


system call system call interface
open(), close(), read(), write(), seek(), order()

ext2fs vfat32 NFG

device driver device driver device driver

I/O request

hardware device

ITSO

5-6
Linux for S/390
Internals: S/390 modifications

S/390 dependent,
architecture-independent
IBM-contributed

Linux applications
GNU GNU
debugger compiler GNU C runtime library
GNU
(gdb, (gcc) binutils
also
strace) Linux kernel, including
some device drivers

ITSO

Linux for S/390


Internals: Kernel code tree

linux

init kernel mm fs net include arch drivers

coda appletalk asm-alpha alpha block


ext2 decnet asm-arm arm char
fat/vfat ipv4/6 asm-i386 i386 cdrom
hfs ipx asm-m68k m68k isdn
hpfs x25 asm-mips mips macintosh
isofs asm-ppc ppc net
nfs asm-s390 s390 pci
ntfs asm-sprc sparc s390
asm-spr64 sparc64 scsi
sound
video

ITSO

7-8
Linux for S/390
Internals: Linux for S/390 native drivers
Console
Integrated Console
3215

DASD
ECKD (3380, 3390)

Expanded memory
XPRAM

Network (OCO)
LCS (OSA, 2216, 3172)
CTCA
QDIO (new)
OSA-express (new)

ITSO

Linux for S/390


Internals: What S/390 does NOT give you

Monitor, graphics card


Speakers, sound card
Mouse, keyboard
Local printer
CD, floppy disk
PCMCIA, Advanced Power Management (APM)
Many interrupts: Ctrl-Alt-Del, power-fail, power-restore

ITSO

9-10
Linux for S/390
Internals: Run levels

scripts in
runlevel 0: prepare the machine for turning off
/etc/inittab,
power, if the machine can turn the power off tell it
linuxconf as
to do so
tool
runlevel 1: system administrator mode, all file
systems mounted, only small set of kernel
processes running, single user mode

runlevel 2: multi-user mode

runlevel 3: multi-user mode with remote file


sharing, processes, and daemons

runlevel 4: user definable system state

telnet
runlevel 5: X11

runlevel 6: shutdown and reboot

runlevel 8: single-user mode, only root file system


mounted

ITSO

Linux for S/390


Internals: Shells and environment

Two main types of shells


Bourne - often /bin/sh, sometimes called System V shell
bash - Bourne Again SHell - default on most Linux distributions
Korn - Author David Korn of AT&T - ported to many platforms
ash - a shell
C shell - programming has a C-like syntax
tcsh is popular

Command search order


Environment variables, functions and aliases
Alias command

ITSO

11-12
Linux for S/390
Internals: Command search order

qualified
pathname

path reserved
variable word

function alias

built in command

ITSO

Linux for S/390


Internals: Environment variables

Environment variables help personalize a shell


Use the env command to query
[mikem@linux390 mikem]$ env
HISTSIZE=1000
HOSTNAME=linux390
LOGNAME=mikem
HISTFILESIZE=1000
MAIL=/var/spool/mail/mikem
TERM=vt100
HOSTTYPE=s390
PATH=/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin
HOME=/home/mikem
...

C function getenv() queries environment variables

ITSO

13-14
Linux for S/390
Internals: Functions and aliases

Shell functions: can be defined and invoked. For


example:
[mikem@linux390 /usr]$ function foo
> {
> echo "this is the function foo"
> }
[mikem@linux390 /usr]$ foo
this is the function foo

ITSO

Linux for S/390


Internals: Environment variables example

Environment variable: PATH example


[mikem@linux390 mikem]$ echo $PATH
/bin:/usr/bin:/usr/X11R6/bin
[mikem@linux390 mikem]$ export PATH=/usr/local/bin:$PATH
[mikem@linux390 mikem]$ echo $PATH
/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin
[mikem@linux390 mikem]$ unset PATH
unset: PATH: cannot unset

Alias: ls example
[mikem@linux390 /usr]$ alias ls='ls -tF'
[mikem@linux390 /usr]$ ls
bin/ sbin/ local/ lib/ info/ src/ man/ X11R6/ ...
[mikem@linux390 /usr]$ unalias ls
[mikem@linux390 /usr]$ ls
X11R6 dict etc include lib local s390-ibm-linux ...

ITSO

15-16
Linux for S/390
Internals: Bash built-ins, reserved words

Built-ins
bash, :, ., alias, bg, bind, break, builtin, cd, command,
continue, declare, dirs, disown, bash-echo, enable, eval, exec,
exit, bash-export, fc, fg, getopts, hash, help, history, jobs,
bash-kill, let, local, logout, popd, pushd, bash-pwd, read,
readonly, return, set, shift, shopt, source, suspend,
bash-test, times, trap, type, typeset, ulimit, umask, unalias,
unset, wait

Reserved words
case do done elif else esac fi for function if in select then until
while

ITSO

Linux for S/390


Internals: Basics

Basic commands
ls : list files
ls -l : directory (detailed) listing
ls -a : list hidden files
ls -F : trail file names with helpful characters
cd, pwd : change, show directories
cd .. : move up a directory
cd - : return to previous directory
cd : return to home directory
cp : copy files/directories
cp files directory : copy one or more files to a directory
cp -r files directory : copy recursively
rm : remove (delete) files/directories
rm -f : don't prompt
rm -r : remove files recursively
ITSO

17-18
Linux for S/390
Internals: Basics (cont'd)
mv : move (rename) files
mv files... directory : move a file to a directory
mkdir : make a new directory
rmdir : remove an empty directory
chmod : change permission bits
chmod octal-val files... : change to a specific value
chmod mode files... : change relative (ex: chmod +x file)
chown : change ownership of a file
chown owner.group files... : change owner and group
cat files ... : concatenate (type) files to stdout
more, less: pagers
echo: print to stdout

ITSO

Linux for S/390


Internals: Basics (cont'd)
vi is the most common UNIX editor; 2 modes:
Input mode
'Esc' - brings you to command mode
Command mode
i - brings you back to input mode
dd - deletes a line and puts it in the buffer
p - add the buffer past the current location
P - add the buffer before the current location
o - add a line and go into insert mode
/string - search for string
n - do the last command again
: - go to a command prompt
jkl; - cursor movement (or hopefully arrow keys)
A - add text at the end of the line
:wq - write & quit
:q! - quit and discard changes

ITSO

19-20
Linux for S/390
Internals: Help

Commands
man - heavily used, expected to be present
info - full screen man
apropos command - not used much

Directories and files


/etc/man.config - configures man command

HOW-TOs
documents which describe in detail a certain aspect of
configuring or using Linux
http://metalab.unc.edu/pub/Linux/docs/HOWTO/

ITSO

Linux for S/390


Internals: Networking

Commands
ifconfig
netstat -n -r
arp -a

Directories & files


/etc/sysconfig/network - file that brings up networking

ITSO

21-22
Linux for S/390
Internals: File systems

Types
local (ext2, reiserfs, etc)
in memory
NFS
AFS

Commands
df
du
mount
mke2fs, e2fsck, dumpe2fs
dasdfmt (specific to S/390)
mkswap, swapon

ITSO

Linux for S/390


Internals: File systems

Directories and Files


/etc/fstab - file system table
[root@linux390 /etc]# cat fstab
/dev/mnda / ext2 defaults,errors=remount-ro 0 1
none /proc proc defaults 0 0
/etc/exports - NFS file systems exported

ITSO

23-24
Linux for S/390
Internals: Filesystems Hierarchy Standard

Filesystems Hierarchy Standard (FSH) - a standard


which most Linux distributors already do (or will
hopefully) comply with
A subset of the larger Linux Standards Base (LSB)
See http://www.linuxbase.org/

Current version is 2.1 (release April 12, 2000)


See http://www.pathname.com/fhs/

ITSO

Linux for S/390


Internals: FSH 2.1 Specification (partial)

usr/ opt/ var/ boot/ etc/ bin/


dev/
home/
lib/
sharable r/o unsharable r/o
mnt/
root/
sbin/
spool/ mail/ run/ lock/ tmp/

news/

sharable r/w unsharable r/w

ITSO

25-26
Linux for S/390
Internals: Software installation

rpm - RedHat, Marist, many others


rpm -q: query; examples:
rpm --query samba
rpm --query --all
rpm -i: install (--initdb, --rebuilddb)
rpm -b: build (-b package_spec, --rebuild RPM)
rpm -u: upgrade
rpm -e:

dpkg - SuSE, Debian

ITSO

Linux for S/390


Internals: Startup, shutdown

Commands
runlevel - query the current level
init - set the current level
dmesg - display boot up messages
shutdown -h now: shutdown the system now
reboot: shutdown the system and bring it backup

ITSO

27-28
Linux for S/390
Internals: Startup, shutdown (cont'd)

Directories & files


/lib/modules/2.2.15/net/lcs.o - OSA2 driver
/lib/modules/2.2.15/block/xpram.o - expanded memory driver
/etc/inittab - initialization table:
format: id_number:runlevel:action:process args
id_number can be an integer or a reserved abbreviation:
si: system initialization
id: set default run level
l'n': where 'n' is 0 - 6
ud: run in every runlevel
/etc/rc.d/init.d
/etc/rc.d/rc[0-5].d
/var/log/dmesg
/boot

ITSO

Linux for S/390


Internals: Startup, shutdown (cont'd)
/etc/inittab example
id:3:initdefault:
# System initialization.
si::sysinit:/etc/rc.d/rc.sysinit
l0:0:wait:/etc/rc.d/rc 0
l1:1:wait:/etc/rc.d/rc 1
l2:2:wait:/etc/rc.d/rc 2
l3:3:wait:/etc/rc.d/rc 3
l4:4:wait:/etc/rc.d/rc 4
l5:5:wait:/etc/rc.d/rc 5
l6:6:wait:/etc/rc.d/rc 6
# Things to run in every runlevel.
ud::once:/sbin/update
# Run gettys in standard runlevels
1:2345:respawn:/sbin/sulogin /dev/console
#1:2345:respawn:/sbin/mingetty tty1
#2:2345:respawn:/sbin/mingetty tty2

ITSO

29-30
Linux for S/390
Internals: Startup, shutdown (cont'd)
/etc/rc.d directory
[root@linux390 rc.d]# ls -l init.d
-rwxr-xr-x 1 root root 1031 May 18 03:26 crond
-rwxr-xr-x 1 root root 7386 Sep 20 1999 functions
-rwxr-xr-x 1 root root 3129 Sep 20 1999 halt
-rwxr-xr-x 1 root root 865 May 18 09:05 httpd
-rwxr-xr-x 1 root root 1509 May 17 23:15 inet
-rwxr-xr-x 1 root root 449 Sep 11 1999 killall
-rwxr-xr-x 1 root root 3217 Sep 20 1999 netfs
-rwxr-xr-x 1 root root 6573 Sep 21 1999 network
-rwxr-xr-x 1 root root 1603 May 18 13:04 nscd
-rwxr-xr-x 1 root root 986 May 17 23:44 portmap
-rwxr-xr-x 1 root root 1532 Feb 4 1999 random
...
[root@linux390 rc.d]# ls -l rc1.d
lrwxrwxrwx 1 root 13 Aug 18 08:42 K10xfs -> ../init.d/xfs
lrwxrwxrwx 1 root 15 Aug 18 08:42 K15httpd -> ../init.d/httpd
lrwxrwxrwx 1 root 14 Aug 18 08:42 K50inet -> ../init.d/inet
...

ITSO

Linux for S/390


Internals: daemons
/usr/sbin/ntsysv
/usr/bin/chkconfig
inetd
telnetd
in.ftpd, in.tftpd
in.talkd
syslogd, logrotate
rlogind
crontab
nmbd, smbd
httpd
atd
...

ITSO

31-32
Linux for S/390
Internals: Daemon master - ntsysv

ITSO

Linux for S/390


Internals: Process management

Commands
ps - list processes
ps -ef
ps aux
jobs - list jobs/process started by current shell
kill - sends SIGTERM signal
kill -9 sends SIGKILL signal
Ctrl-Z - sends suspend character - suspend current process
bg, fg - send process to background, foreground
nohup - don't kill process on "hangup" signal

ITSO

33-34
Linux for S/390
Internals: Users, groups, passwords

Commands
passwd - set passwords
adduser - add a user
useradd, usermod, userdel
groupadd, groupdel
whoami - display user name
id - display user and group IDs

Directories & files


/etc/passwd - user and password file
/etc/group - group file
/etc/skeleton - skeleton home directory for new users

ITSO

Linux for S/390


Internals: Archiving, compression, etc.

Commands
tar - archival
tar -xf file.tar - extract from tarball
tar -cf file.tar files - create tarball
tar -tf file.tar - list files in tarball
gzip, gunzip - GNU compression
compress, uncompress - LZW compression
cpio - old archival command
iconv - translation
dump, restore - ext2 file system backup

ITSO

35-36
Linux for S/390
Internals: Searching

Commands
grep - search through files
find - find files or directories by name
locate - find files using an indexed DB - FAST!
updatedb - update the find database

ITSO

Linux for S/390


Internals: Security

Secure shell (ssh)


Pluggable authentication module (PAM)
Shadow passwords
Top ten Internet security threats (Sans Institute)
http://www.sans.org/topten.htm

ITSO

37-38
Linux for S/390
Desktop

KDE - A desktop
Gnome - The other desktop
xdm - X display manager
Files & directories
/usr/X11R6/lib/X11/xdm/
Xservers
Xaccess
xdm-config
/usr/X11R6/lib/X11/xinit

ITSO

Linux for S/390


Internals: Desktop philosophy

Quote from linux-390 list server:


> To run a desktop was more of a rhetorical question ...

I routinely run a desktop from Linux/390.


I don't have KDE, though, so I didn't answer your question.
I do it when I want/need to be fully immersed in a Linux/390
environment. It is not my *primary* desktop because of
economics (time, money, and similar resource costs).
But when it makes sense, you bet I do!

ITSO

39-40
Linux for S/390
Internals: Application dev'nt, debugging
Shell, command language
Perl
sed, awk, getopts

C/C++
make (gmake)
rcs, cvs - source code control
gcc, g++ (cc, c89, c++) - compilers
flex, bison
cflow

Library processing
ar

Java
ITSO

Linux for S/390


Internals: Building packages

optional

configure.in configure C or C++


autoconf makefile make
script compiler and
linker

optional
config.h .C executable
files files

.h files

libraries

ITSO

41-42

Potrebbero piacerti anche