You are on page 1of 43

Virtualization and Linux on System z Workshop

System z

Virtualization and Linux

Workshop

Part 2

Linux

Lab Exercises

Presented by

IBM

1
Virtualization and Linux on System z Workshop

User Agreement
This agreement ("Agreement") governs your use of the remotely accessed IBM system and the course
materials. By using the system or accessing the system (“Materials”) you agree to the terms of this
Agreement.
Under this Agreement, you may use the Materials only for the class attended and other use authorized
by IBM. Any other use (including distribution, reproduction, resale, publication or transmission) is not
permitted.
The Materials are provided on an "AS IS" basis. In addition, IBM makes no warranties or conditions,
either express or implied, including without limitation, warranties of title, non-infringement and the
implied warranties of merchantability and fitness for a particular purpose, concerning the Materials, or
any information accessed using the Materials.
The z/OS operating system and associated middleware Program(s) that were packaged with, or
preloaded onto, the IBM computer system are the property of the IBM Corporation. You receive no
express or implied patent or other license from IBM. IBM will not be liable for any damages resulting
from use of the Materials, including without limitation, lost profits, lost savings, or any incidental,
special or indirect damages or other economic consequential damages, even if IBM has been advised of
the possibility of such damages. Some jurisdictions do not allow the exclusion or limitation of
incidental or consequential damages, so the above limitation or exclusion may not apply to you.
This agreement does not grant you a license, either expressed or implied, to any IBM intellectual
property, including patents copyrights or trademarks. Unless IBM specifies otherwise, you may not
copy, modify, adapt, reproduce, translate, distribute, reverse engineer, decompile or disassemble any
aspect of the Materials. Neither IBM nor its Suppliers are responsible for: 1) the accuracy,
completeness, timeliness, reliability, content or availability of the Materials or any information
retrieved; 2) loss or damage to your records or data; or 3) your use of or results achieved from the
Materials or any information retrieved.
This Agreement is the complete and exclusive agreement regarding the Materials. IBM may, at any
time, 1) revoke your access to the Materials, or 2) modify, change or withdraw the Materials, in whole
or in part.
This Agreement is governed by the laws of the State of New York.

Notices
This information was developed for products and Materials offered in the U.S.A.
IBM may not offer the products, Materials, or features discussed in this document in other countries. Consult your local
IBM representative for information on the products and Materials currently available in your area. Any reference to an IBM
product, program, or Materials is not intended to state or imply that only that IBM product, program, or Materials may be
used. Any functionally equivalent product, program, or Materials that does not infringe any IBM intellectual property right
may be used instead. However, it is the user's responsibility to evaluate and verify the operation of any non-IBM product,
program, or Materials.
IBM may have patents or pending patent applications covering subject matter described in this document. The furnishing of
this document does not give you any license to these patents. You can send license inquiries, in writing, to:
IBM Director of Licensing, IBM Corporation, North Castle Drive Armonk, NY 10504-1785 U.S.A.

2
Virtualization and Linux on System z Workshop

The following paragraph does not apply to the United Kingdom or any other country where such provisions are inconsistent
with local law:
INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES
THIS PUBLICATION "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF NON-INFRINGEMENT,
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Some states do not allow disclaimer of express
or implied warranties in certain transactions, therefore, this statement may not apply to you.
This information could include technical inaccuracies or typographical errors. Changes are periodically made to the
information herein; these changes will be incorporated in new editions of the publication. IBM may make improvements
and/or changes in the product(s) and/or the program(s) described in this publication at any time without notice.
Any references in this information to non-IBM Web sites are provided for convenience only and do not in any manner serve
as an endorsement of those Web sites. The materials at those Web sites are not part of the materials for this IBM product
and use of those Web sites is at your own risk.
IBM may use or distribute any of the information you supply in any way it believes appropriate without incurring any
obligation to you.
Information concerning non-IBM products was obtained from the suppliers of those products, their published
announcements or other publicly available sources. IBM has not tested those products and cannot confirm the accuracy of
performance, compatibility or any other claims related to non-IBM products. Questions on the capabilities of non-IBM
products should be addressed to the suppliers of those products.
This information contains examples of data and reports used in daily business operations. To illustrate them as completely
as possible, the examples include the names of individuals, companies, brands, and products. All of these names are
fictitious and any similarity to the names and addresses used by an actual business enterprise is entirely coincidental.
COPYRIGHT LICENSE:
This information contains sample application programs in source language, which illustrates programming techniques on
various operating platforms. You may copy, modify, and distribute these sample programs in any form without payment to
IBM, for the purposes of developing, using, marketing or distributing application programs conforming to the application
programming interface for the operating platform for which the sample programs are written. These examples have not been
thoroughly tested under all conditions. IBM, therefore, cannot guarantee or imply reliability, Materials ability, or function of
these programs. You may copy, modify, and distribute these sample programs in any form without payment to IBM for the
purposes of developing, using, marketing, or distributing application programs conforming to IBM's application
programming interfaces.

3
Virtualization and Linux on System z Workshop

Table of Contents
Unit 1: Install Linux .................................................................................................................................. 5
1.1 Prepare the Linux virtual server ..................................................................................................... 5
1.2 Installation ..................................................................................................................................... 7
Unit 2: Setup Common Services............................................................................................................. 12
2.1 Automount ....................................................................................................................................12
2.2 VNC Server................................................................................................................................... 12
2.3 Managing Software....................................................................................................................... 14
2.4 NFS Server .................................................................................................................................. 14
2.5 Other services................................................................................................................................ 15
Unit 3: ECKD Disk Management.......................................................................................................... 17
3.1 View information ......................................................................................................................... 17
3.2 Add DASD Device .......................................................................................................................18
3.3 DASD tools .................................................................................................................................. 19
3.4 Create Filesystem with LVM........................................................................................................ 21
Unit 4: IBM Software ............................................................................................................................ 24
4.1 Universal Database (UDB) V8.2...................................................................................................24
4.2 DB2 Runtime Client .....................................................................................................................27
4.3 WebSphere Application Server V6.1 ........................................................................................... 29
4.4 IBM HTTP Server and the WebSphere Application Server Plug-in.............................................33
Unit 5: Other software..............................................................................................................................35
5.1 Oracle 10g2 on System z Linux.................................................................................................... 35
Unit 6: References....................................................................................................................................40
6.1 Navigating in Linux.......................................................................................................................40
6.2 Vi Cheat Sheet...............................................................................................................................42
6.3 Books.............................................................................................................................................43
6.4 Web Sites.......................................................................................................................................43

4
Virtualization and Linux on System z Workshop

Unit 1: Install Linux


1.1 Prepare the Linux virtual server
1.1.1 Create PROFILE EXEC
Logon to your team ID and IPL CMS.
Create a simple PROFILE EXEC file and add the following statements:
===> x profile exec
/* PROFILE EXEC */
'cp set run on'
'cp set pf12 ret'
'acc 592 f'

Save the changes and exit the file.

===> file

Execute the profile. Now you have a RETRIEVE key (F12) defined!
===> profile
Link to the disk that contains the FTP commands:
===> vmlink tcpmaint 592

1.1.2 FTP the boot files


There are three files we need to transfer from the Linux installation CD to the “A” disk. You will use
FTP to connect to the workshop server and copy the following files under the /mnt/rhel4xu4root/
directory.
● Kernel – images/kernel.img
● RAMdisk – images/initrd.img
● Parameter file – images/generic.prm

Connect to the workshop NFS server:


===> ftp 129.40.35.3
ftp> user1/user1
ftp> cd /mnt/rhel4xu4root/images
ftp> get generic.prm rhel4.parmfile
ftp> locsite fix 80
ftp> bin
ftp> get kernel.img rhel4.kernel
ftp> get initrd.img rhel4.initrd

5
Virtualization and Linux on System z Workshop

ftp> quit
These files should now be on your A-disk.

1.1.3 Update the parameter file


Now create the parameter file, RHEL4 PARMFILE. There is a limit of 32 total parameters in the
parameter file. In order to accommodate limitations with parameter files, a new configuration file on a
CMS DASD should be used to configure the initial network setup and the DASD specification.
A parameter file is still required for the real kernel parameters. Add two lines to the parameter file to
point to the configuration file on the 191 disk and to set up VNC and the password.
===> x rhel4 parmfile
CMSDASD=191 CMSCONFFILE=RHEL4.CONF
vnc vncpassword=123456
Save and exit the file.
===> file

1.1.4 Update the configuration file


Copy a sample configuration file from the workshop shared 702 disk.
===> copy rhel conf b rhel4 conf a
Modified it as follows:
===> x rhel4 conf
DASD=200-203
HOSTNAME=pbc35<n>1.pbm.ihost.com
NETTYPE=qeth
IPADDR=129.40.35.<n>1
SUBCHANNELS=0.0.0800,0.0.0801,0.0.0802
NETWORK=129.40.35.0
NETMASK=255.255.255.0
SEARCHDNS=pbm.ihost.com
BROADCAST=129.40.35.255
GATEWAY=129.40.35.3
DNS=129.40.35.3
MTU=1500
PORTNAME=DONTCARE

Save and exit the file.


===> file

6
Virtualization and Linux on System z Workshop

1.1.5 Create an install script


Create a RHEL5 EXEC with the following contents. This script will be used to start the installation
process.
===> x rhel4 exec
/* EXEC to start RHEL-4 install */
'CP SPOOL PUN *'
'CP CLOSE RDR'
'PUR RDR ALL'
'PUN RHEL4 KERNEL * (NOH'
'PUN RHEL4 PARMFILE * (NOH'
'PUN RHEL4 INITRD * (NOH'
'CH RDR ALL KEEP'
'IPL 00C CLEAR'

Save your changes.


===> file
This EXEC sets up the reader for the punch files, punches the kernel, the parameter file and the initial
RAMdisk, then IPLs (boots) from the reader (address 00C).
You now should have all the files necessary to start the Linux installation.

1.2 Installation
Execute RHEL4 EXEC to start the initialization process.
===> rhel4
When you see the following messages, you are ready to start the loader, the core installation program.
Starting telnetd and sshd to allow login over the network.

Connect now to 129.40.35.51 to start the installation.


eth0: no IPv6 routers present

1.2.1 Loader
Run the loader, the core installation program:
ssh to 129.40.35.<n>1
Login as root
There is no password at this point. The system presents a series of curses based panels to collect
information on how to proceed with the installation.
Language selection: Accept the default – English
Tab to OK and press Enter
Installation Media:

7
Virtualization and Linux on System z Workshop

Use the down cursor to select NFS Image


Tab to OK and press Enter
NFS Information:
Tab to NFS Server Name and enter 129.40.35.3
Tab to Red Hat Enterprise Linux directory and enter /mnt/rhel4xu4root
When you see these messages indicating the VNC Server is started,
Running anaconda, the Red Hat Enterprise Linux system installer - please
wait...
Starting VNC...
The VNC server is now running.
Please connect to 129.40.35.51:1 to begin the install...
Starting graphical installation...
XKB extension not present on :1
Use the vncviewer to connect and continue the installation.

Launch the vncviewer and connect to 129.40.35.<n>1:1


You are now ready to complete the installation specification via the Graphical Installation Program.

1.2.2 The Graphical Installation Program

Welcome to Red Hat Enterprise Linux


The Welcome screen does not prompt you for any input. Continue with the installation.
Click on Next

FCP Devices
FCP (Fibre Channel protocol) devices enable System z Linux servers to use SCSI devices rather than
DASD devices. There is no FCP device to configure, skip this step.
Click on Next
You will receive warning messages about initializing your disk volumes,
Select Yes to format the devices

Disk Partitioning Setup


Select automatic partitioning:
Select Automatically partition
Click on Next
Accept the defaults to “Remove all partitions on this system” and to use all available DASDs for this
installation.

8
Virtualization and Linux on System z Workshop

Click on Next
Reply yes to remove all partitions:
Click on Yes

Disk Setup
The following partitions are now configured:
● A /boot partition of 100 MB - the partition mounted on /boot/ contains the operating system
kernel (which allows your system to boot Red Hat Enterprise Linux), along with files used
during the bootstrap process.
● Logical volume group VolGroup00
○ LogVol01 - A swap partition of 1504 MB - swap partitions are used to support virtual
memory. In other words, data is written to a swap partition when there is not enough RAM
to store the data your system is processing. Unlike the Intel or other UNIX platforms,
swapping is better managed by z/VM and it is typically unnecessary to allocate the normal
rule of thumb amount for swap. Reduce the amount to 256 MB
Double click on VolGroup00
Double click on LogVol01
Change the size to 256
Click on OK
Review the updated configuration and continue.
Click on Next
Reply yes to ignore the warning message about the SWAP space size too small.
Click on Yes

Network Configuration
The installation program automatically detects any network devices you have and displays them in the
Network Devices list. A network interface of eth0 is detected.
Manually enter the hostname in the field provided:
Enter pbc35<n>1.pbm.ihost.com
Click on Next

Firewall Configuration
In this workshop, you will disable the firewall.
No Firewall provides complete access to your system and does no security checking. Security
checking is the disabling of access to certain services. This should only be selected if you are running
on a trusted network (not the Internet) or plan to do more firewall configuration later

9
Virtualization and Linux on System z Workshop

Select No firewall
Click on Next
Reply Proceed to get past the No Firewall message.
Click Proceed

Language Support Selection


You can install and support multiple languages for use on your system. You will accept the default –
English (USA).
Click on Next

Time Zone Selection


Accept the default – America/New_York Eastern Time.
Click on Next

Select root password


Set a password for the root user. For simplicity and easy access by the instructor to for server, please
use 123456.
Enter a password of 123456
Confirm the password
Click on Next

Package Installation Defaults


Now that you have made most of the choices for your installation, you are ready to customize packages
for your system.
Click on Customize software packages to be installed
Click on Next

Package Group Selection


Customize the Application section:
Scroll down to the Application section
Select Editors
Customize the Server section:
Scroll down to the Servers section
Select DNS Name Server

10
Virtualization and Linux on System z Workshop

Select FTP Server


Customize the Development section:
Scroll down to the Development section
Select Compatibility Arch Development Support
Select Legacy Software Development
Customize the System section
Scroll down to the System section
Select System Tools
Complete the customization
Click on Next
Start the packages installation.
Click on Next

Installing packages
A screen preparing you for the installation now appears. For your reference, a complete log of your
installation can be found in /root/install.log once you reboot your system.
This will take approximately 30-45 minutes.

Completing the installation


The installation program prompts you to prepare your system for reboot. Once the installation is
complete, you must IPL (boot) from the DASD(s) where Red Hat Enterprise Linux has been installed.
Click on Reboot
Return to the 3270 terminal console and enter:
===> #cp i 200 clear

1.2.3 Connect to the installed system


For security purposes, the telnet daemon is not started by default. You may use a secure shell client to
connect, putty, a freely available open-source SSH software, is loaded on your workstation.
Launch putty and connect to the IP address of your Linux server
Login as root

11
Virtualization and Linux on System z Workshop

Unit 2: Setup Common Services


2.1 Automount
Automounting is the process where mounting and unmounting of certain file systems is done
automatically by a daemon. If the file system is unmounted, and a user attempts to access it, it will be
automatically (re)mounted.
Autofs is a kernel-based automounter for Linux. Let’s set it up so that it automatically mounts the
labstuff file system (where all the necessary files for the exercises reside).

Create the configuration files


Edit the auto.master map to add a new mount point /mnt. This file is consulted when the autofs script
is invoked to set up the necessary mount points for the automounter. Each line in this file describes a
mount point and points to another file describing the file systems to be mounted under this mount point.
# vi /etc/auto.master
Add the following line:
/mnt /etc/auto.mnt

Create the file /etc/auto.mnt to contain information for the file system we want to automount.
# vi /etc/auto.mnt
Add the following line:
labstuff -ro,rsize=8192 129.40.35.3:/nfs/labstuff

This line specifies that the directory /labstuff at host IP address 129.40.35.3 to be mounted at mount
point /mnt/labstuff. The mounted file system will be read-only and have a read buffer size of 8192
bytes.
The autofs service is started automatically at boot time. To make the changes effective immediately,
restart the autofs status.
# service autofs restart
Verify that the new mount point has been added.
# service autofs status
# ls –l /mnt/labstuff

2.2 VNC Server


The VNC server is included in our Redhat installation.

12
Virtualization and Linux on System z Workshop

Configure the VNC Server


Edit the VNC configuration file located in the system configuration directory.
# vi /etc/sysconfig/vncservers
Uncomment (remove #) the following lines and make the changes as follows:
VNCSERVERS='1:root”
VNCSERVERARGS[1]=”geometry 1024x768”

Assign a VNC password for root. To be consistent, use 123456


# vncpasswd

Configure vncserver to start automatically


Use the 'chkconfig' command is configure vncserver to start next time at boot time.
# chkconfig vncserver on
# chkconfig --list vncserver

Start vncserver manually


# service vncserver start

Configure the window manager


The default window manager is twm, or the tiny window manager. You will change the window
manager to use gnome.
Edit the xstartup file which contains startup parameters for VNC.
===> vi /root/.vnc/xstartup
Uncomment the following two lines by removing the '#” .
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

Restart the VNC server:


===> service vncserver restart

Test the configuration


Launch the vncviewer, connect to your linux server and then strt a window.
Launch vncviewer
Connect to 129.40.35.<n>1:1
Type in root's VNC password

13
Virtualization and Linux on System z Workshop

Right click and select Open Terminal

2.3 Managing Software


2.3.1 Red Hat Package Manager (RPM)

Query the RPM database


You can query all the packages installed on your system by using the -qa option. If you pipe the
output through sort and into a pager, then it's a nice way to get a glimpse of what's installed on your
system. Experiment with various options:
Get a list of all installed software packages from the RPM database, sort the resulted list and display it
with the 'less' program.
# rpm -qa | sort | less
Press Enter to advance 1 line
Press Space Bar to advance 1 page
Enter 'q' to quit
Get a list of all installed software packages from the RPM database, search the resulted list for the
phrase 'open' and display it ti the console.
# rpm -qa | grep open

Install a software package


You use the 'i' (install) option to install a package. Install the webmin software package from the
workshop NFS server. Webmin is a open source system administration tool. You can learn how to
configure it later if you are interested.
# cd /mnt/labstuff/admin
# rpm -ivh webmin-1.210-1.noarch.rpm
Start a browser and login to webwin using the root user. Explore the system administration functions
that are available.
http://129.40.35.<n>1:10000
Feel free to explore how webmin can be used to perform many system administration tasks.

2.4 NFS Server


The NFS server is included in your base Red Hat installation and it is started automatically.

14
Virtualization and Linux on System z Workshop

Add a share
There are two ways to add shares to your NFS server under Red Hat Linux: use the NFS Server
Configuration Tool (system-config-nfs), or manually edit its configuration file (/etc/exports) and then
export the directories with the /usr/sbin/exportfs command.
First let's use the manual method.
1. Start the NFS server.
# chkconfig nfs on
# service nfs start
2. Edit the /etc/exports file:
# vi /etc/exports
3. Add a share as follows to allow everyone to access the /tmp directory:
/tmp *(ro,sync)

4. Use the exportfs command to make the share available immediately.


# exportfs -a
5. Print the exported directory list. You should see /tmp on this list
# showmount –e
Next, use the Red Hat provided GUI tool to add a new share to allow 129.40.35.3 to read the /root
directory.
Return to the vncviewer terminal session
# system-config-nfs
...
...

2.5 Other services


Other common services that can be installed, configured and started are:
● FTP server - vsftpd
● DNS server - named
● Samba server - smb
● LDAP server - ldap
● Email – sendmail
● Apache - httpd

15
Virtualization and Linux on System z Workshop

16
Virtualization and Linux on System z Workshop

Unit 3: ECKD Disk Management


3.1 View information
sysfs
The sysfs file system enumerates the devices and buses attached to the system into a file system
hierarchy that can be accessed from user space. It is designed to handle the device and driver specific
options that have previously resided in /proc/, and encompass the dynamic device addition
previously offered by devfs. At this early point in the implementation of sysfs, there are many
drivers and utilities that still refer to the older proc entries. However, it is understood that sysfs is
the way of the future.
The sysfs file system is mounted at /sys/ and contains directories that organize the devices
attached to the system in several different ways. You can view information about your DASDs via the
sysfs. A directory is created for every DASD attached to the system which contains attributes of the
device.
1. For example, attributes for the device 0200 can be read from files found in the
/sys/bus/ccw/drivers/dasd-eckd/0.0.0200 directory.
# ls /sys/bus/ccw/drivers/dasd-eckd/0.0.0200
. availability cmb_enable detach_state discipline readonly
.. block cutype devtype online use_diag

2. Display the status of this device.


# cat /sys/bus/ccw/drivers/dasd-eckd/0.0.0200/online
1

It should return a value of 1, indicating that the device is online.

lsdasd
The lsdasd command uses sysfs to report information on DASD devices.
# lsdasd
0.0.0200(ECKD) at ( 94: 0) is dasda : active at blocksize 4096, 600840
blocks, 2347 MB
0.0.0201(ECKD) at ( 94: 4) is dasdb : active at blocksize 4096, 600840
blocks, 2347 MB
...
...

The DASD device driver uses a device name of the form dasd<x> for each DASD. In the name,
<x> is one to four lowercase letters. “dasda” refers to the whole of the first disk in the system,
device 200 added during installation of linux.

17
Virtualization and Linux on System z Workshop

systool
The systool command is another tool that uses sysfs to report devices by bus, class, and topology. The
-v option reports all device attributes; the -b option reports device information for a specific bus
(device):
# systool -vb ccw 0.0.0200
Bus = "ccw"

Device = "0.0.0200"
Device path = "/sys/devices/css0/0.0.0002/0.0.0200"
availability = "good"
cmb_enable = "0"
cutype = "3990/e9"
detach_state = "0"
devtype = "3390/0a"
discipline = "ECKD"
online = "1"
readonly = "0"
use_diag = "0"

3.2 Add DASD Device


Add DASD devices 0300-0301
1. Edit the /etc/modprobe.conf file.
# vi etc/modprobe.conf
You should see something like the following:
alias eth0 qeth
options dasd_mod dasd=200-203

2. Add disks 300-301 by modifying the dasd= option.


alias eth0 qeth
options dasd_mod dasd=200-203,300-301

3. After we modify modprobe.conf, we must then use the mkinitrd and zipl commands to create a
new initial RAM disk (initrd) for the system to use when it boots. The new initrd will include
the 2 new disks we have just added.
mkinitrd creates an initial image used by the kernel for preloading the block device modules
(such as DASD) which are needed to access the root filesystem. In this case initrd-2.6.9-
42a.EL.img is the image to be built and 2.6.9-42.EL is the kernel version.
# mkinitrd -v /boot/initrd-2.6.9-42a.EL.img 2.6.9-42.EL
4. Edit the /etc/zipl.conf file to tell the zipl command to use the new image we just built,
/boot/initrd-2.6.9-42a.EL.img:

18
Virtualization and Linux on System z Workshop

# vi /etc/zipl.conf
[defaultboot]
default=linux
target=/boot/
[linux]
image=/boot/vmlinuz-2.6.9-42.EL
ramdisk=/boot/initrd-2.6.9-42a.EL.img
parameters="root=/dev/VolGroup00/LogVol00"

5. Execute the zipl command to write the new initrd to the boot device:
# zipl
6. Shutdown and reboot your Linux server
# reboot
7. When the server comes back up, reconnect and login.
Login as root

3.3 DASD tools


dasdfmt
dasdfmt is used to format a DASD device. Remember that the formatting process can take quite a long
time (hours for large DASD). Use the -p option to monitor the progress.
1. Use the lsdasd command to find out the file names for devices 300 and 301:
# lsdasd
/dev/dasd<300> is _____________________
/dev/dasd<301> is _____________________

2. Format DASD devices 300 and 301. Use a the file names obtained from the last step and a
block size of 4096.
# dasdfmt -b 4096 -f /dev/dasd<300>
Reply 'yes' to continue
# dasdfmt -b 4096 -f /dev/dasd<301>
Reply 'yes' to continue

fdasd
fdasd is used to make partitions on a DASD device. The compatible disk layout allows you to split
DASD into several partitions. Use fdasd to manage partitions on a DASD. You can use fdasd to
create, change and delete partitions, and also to change the volume serial number.

19
Virtualization and Linux on System z Workshop

1. Use the -a option to partition DASDs 300 and 301 into one single partition each:
# fdasd -a /dev/dasde
# fdasd -a /dev/dasdf

Dasdview
dasdview displays the following DASD information in hexadecimal, EBCDIC, and ASCII format :
• The volume label
• VTOC (Volume Table of Content) details
• Content of the DASD
1. Display VTOC information for device 300:
# dasdview -–vtoc -f /dev/dasde
--- VTOC info -----------------------------------------------------------------
The VTOC contains:
2 format 1 label(s)
1 format 4 label(s)
1 format 5 label(s)
0 format 7 label(s)
Other S/390 and zSeries operating systems would see the following data sets:
+----------------------------------------------+--------------+--------------+
| data set | start | end |
+----------------------------------------------+--------------+--------------+
| LINUX.V0X0200.PART0001.NATIVE | trk | trk |
| data set serial number : '0X0200' | 2 | 2134 |
| system code : 'IBM LINUX ' | cyl/trk | cyl/trk |
| creation date : year 2007, day 162 | 0/ 2 | 142/ 4 |
+----------------------------------------------+--------------+--------------+
| LINUX.V0X0200.PART0002.LVM | trk | trk |
| data set serial number : '0X0200' | 2135 | 50069 |
| system code : 'IBM LINUX ' | cyl/trk | cyl/trk |
| creation date : year 2007, day 162 | 142/ 5 | 3337/ 14 |
+----------------------------------------------+--------------+--------------+

2. Display the content of the first 100 bytes of DASD 300:


# dasdview -b 0 -s 100 -f /dev/dasde
| 01....04 05....08 09....12 13....16 | 1.............16 | 1.............16 |
+----------------------------------------+------------------+------------------+
| FFFFFFC9FFFFFFD7FFFFFFD3FFFFFFF1 000A0000 0000000F 03000000 | IPL1............
| ????............ |
| 00000001 00000000 00000000 FFFFFFE5FFFFFFE5FFFFFFE5FFFFFFE5 | ................
| ................ |
| FFFFFFE5FFFFFFE5FFFFFFE5FFFFFFE5 FFFFFFE5FFFFFFE5FFFFFFE5FFFFFFE5
FFFFFFE5FFFFFFE5FFFFFFE5FFFFFFE5 FFFFFFE5FFFFFFE5FFFFFFE5FFFFFFE5 |
VVVVVVVVVVVVVVVV | ???????????????? |
| FFFFFFE5FFFFFFE5FFFFFFE5FFFFFFE5 FFFFFFE5FFFFFFE5FFFFFFE5FFFFFFE5
FFFFFFE5FFFFFFE5FFFFFFE5FFFFFFE5 FFFFFFE5FFFFFFE5FFFFFFE5FFFFFFE5 |
VVVVVVVVVVVVVVVV | ???????????????? |

20
Virtualization and Linux on System z Workshop

tunedasd
tunedasd is used to tune DASD performance. It can:
● Display and reset DASD performance statistics
● Query and set a DASD’s cache mode. Today’s ECKD devices support the following behaviors:
● normal for normal cache replacement
● bypass to bypass cache
● inhibit to inhibit cache
● sequential for sequential access
● prestage for sequential prestage
● record for record access.
● Reserve and release DASD
● Breaking the lock of a known DASD (for accessing a boxed DASD while booting Linux)

1. Query the current setting for the cache mode of DASD 300:
# tunedasd -g /dev/dasde

normal (0 cyl)

2. Set the cache mode of DASD 300 to bypass caching:


# tunedasd -c bypass /dev/dasde
Setting cache mode for device </dev/dasde>...
Done.

3.4 Create Filesystem with LVM


Create a new file system with the DASD devices that you have just formatted.
DASDs 300 (dasde1) and 301 (dasdf1)
Mount point /opt
Size 4.5 GB
Number of stripes: 0
File system type Ext3

3.4.1 Create Physical Volumes


1. You have to initialize the partitions before using them as Physical Volumes. Run the pvcreate
command to initialize dasde1 and dasdf1.
# pvcreate /dev/dasde1 /dev/dasdf1
2. Use the pvdisplay command to display information about these physical volumes.

21
Virtualization and Linux on System z Workshop

# pvdisplay

3.4.2 Create the Volume Group


1. Use the vgcreate command to create a volume group named “lvmgrp1” with physical volumes
/dev/dasde1 and /dev/dasdf1.
# vgcreate lvmgrp1 /dev/dasde1 /dev/dasdf1
2. Use the vgdisplay command to display information about this volume group.
# vgdisplay lvmgrp1
3. What is the size of the volume group?
____________________________________________________

3.4.3 Create the Logical Volume


1. Create a Logical Volume named “volume1” with a size of 4.5 GB. This will be the actual
container for the file system that you are creating.
# lvcreate -L4.5G -nvolume1 lvmgrp1
2. A file name of /dev/<vgname>/<lvname> is created for this logical volume. It is a symbolic
link for /dev/mapper/lvmgrp1-volume1, the file actually used by the kernel (device mapper).
# ls -l /dev/lvmgrp1/volume1

3.4.4 Create a file system


1. Create an ext3 (journaled) file system on the “volume1” logical volume. Make the file system
available by mounting it at mount point /oracle.
# mke2fs -j -b 4096 /dev/lvmgrp1/volume1
2. Use the 'tune2fs' command to verify that a journal has been created for this file system.
# tune2fs -l /dev/lvmgrp1/volume1
3. Mount the newly created ext3 file system.
# mkdir /test
# mount /dev/lvmgrp1/volume1 /test
4. Use the 'df' command to display the disk space usage information. You should see /test is now
mounted.
# df –h

22
Virtualization and Linux on System z Workshop

3.4.5 Mount filesystem at system startup time


The /etc/fstab (short for filesystem tables) file is a text file that lists what file systems to mount and
how they are mounted when your server starts.
Add the /oracle file system to the /etc/fstab file:
# vi /etc/fstab
Add the following line to the end of the file.
/dev/lvmgrp1/volume1 /test ext3 defaults 0 0

23
Virtualization and Linux on System z Workshop

Unit 4: IBM Software


4.1 Universal Database (UDB) V8.2
4.1.1 Install UDB
The UDB Setup wizard is a GUI installer. It provides an easy-to-use interface for installing UDB and
for performing initial setup and configuration tasks.
1. Launch vncviewer from your workstation
Connect to Linux, login as root and start a shell
2. Start the UDB Setup wizard.
# /mnt/labstuff/udb91x/db2setup
3. After a moment, the IBM UDB Setup Launchpad opens.
Click on 'Install a Products'

4. Under the 'DB2 Enterprise Server Edition' section:


Click on 'Install New'

5. At the welcome window, continue with the setup wizard.


Click on 'Next'
6. Read and accept the 'Software License Agreement'.
Click on 'Accept'
Click on 'Next'
7. Select the 'Typical' installation type. Accept the default of 'Typical'.
Click on 'Next'
8. Accept the installation action of 'Install DB2 UDB Enterprise Server Edition on this computer
and save my settings in a response file'.
Click on 'Next'
9. Accept the default installation directory of /opt/ibm/db2/V9.1.
Click on 'Next'
10.Set user information for the Database Administration Server (DAS). This user administers the
Database Administration Server.
Type in a password __(dasusr1)________
Confirm the password
Click on 'Next'

24
Virtualization and Linux on System z Workshop

11.Accept the default to 'Create a DB2 instance'.


Click on 'Next'
12.Accept the default of 'Single-partition instance'.
Click on 'Next'
13. Set user information for the DB2 instance owner: db2inst1.
Type in password __(db2inst1)___
Confirm the password
Click on 'Next'
14.Set user information for the fenced user: db2fenc1.
Type in password ___(db2fenc1)____
Confirm the password
Click on 'Next'
15.Accept the default to 'Do not prepare the DB2 tools catalog on this computer'.
Click on 'Next'
16.Do not set up for notification at this time.
Select 'Do not set up your DB2 server to send notifications at this time'
Click on 'Finish'
This will start the installation of UDB.
17.A status report is presented when the installation is complete. Exit the DB2 Setup Wizard.
Click on 'Finish'

4.1.2 Create the sample database


The DB2 installation comes with some sample databases. You can use the provided scripts to create
these samples. Let's verify that your DB2 installation is complete and successful by accessing the
STAFF table from the SAMPLE database..
1. Log in as the db2 administrator, 'db2inst1'.
Start a new SSH session
Log in as db2inst1

2. Create the SAMPLE database.


$ db2sampl
This command may take a few minutes to process. There is no completion message; when the
command prompt returns, the process is complete. The SAMPLE database is automatically

25
Virtualization and Linux on System z Workshop

cataloged with the database alias SAMPLE when it is created.


3. Invoke the DB2 command line processor.
$ db2

4. Connect to the SAMPLE database.


=> connect to sample

5. Retrieve a list of all the employees who work in department 20.


=> select * from staff where dept = 20

6. Release the database connection.


=> connect reset

26
Virtualization and Linux on System z Workshop

4.2 DB2 Runtime Client


2.1.1 Remote access to DB2 for z/OS
When you installed DB2 Enterprise server edition, the DB2 Run-Time Client was also installed.
The DB2 Run-Time Client is a light-weight client that provides the functionality required for an application to
access DB2 Universal Database servers and DB2 Connect servers. Functionality includes communication
protocol support and support for application interfaces such as JDBC, SQLj, ODBC, CLI, and OLE DB.
Let's configure a database connection to access a remote z/OS DB2 database .
Continue with the db2inst1 user login session
Continue with the DB2 Command Line Processor
1. Add a TCP/IP node directory entry
The node directory stores all connectivity information for remote database servers. If you use the TCP/IP
protocol, this directory shows entries such as the host name or IP address of the server where the
database to which you want to connect resides, and the port number of the associated DB2 instance.
=> catalog tcpip node zosdb2 remote 129.40.178.26 Server 446
db2 => catalog tcpip node zosdb2 remote 129.40.178.26 Server 446
DB20000I The CATALOG TCPIP NODE command completed successfully.
DB21056W Directory changes may not be effective until the directory cache
is refreshed.

2. Add a Database Connection Services entry


The Database Connection Services (DCS) directory contains connectivity information for host
databases residing on a zSeries (z/OS or OS/390) or iSeries (OS/400) server. You need to have
DB2 Connect software installed unless the server you are working on has DB2 UDB Enterprise
Server Edition (ESE) installed. DB2 ESE comes with DB2 Connect support built in.
=> catalog dcs db mydb as dbwg
db2 => catalog dcs db mydb as dbwg
DB20000I The CATALOG DCS DATABASE command completed successfully.
DB21056W Directory changes may not be effective until the directory cache
is refreshed.

3. Add a System Database directory entry


The system database directory (or system db directory) is the main "table of contents" that
contains information about all the databases to which you can connect from your DB2 system.
=> catalog database dbwg as mydb at node zosdb2 authentication dcs
db2 => catalog database dbwg as mydb at node zosdb2 authentication dcs
DB20000I The CATALOG DATABASE command completed successfully.
DB21056W Directory changes may not be effective until the directory cache
is refreshed.

4. Connect to the remote database

27
Virtualization and Linux on System z Workshop

Refresh the DB2 directory cache by exiting the DB2 Command Line Processor.
=> terminate
Start the DB2 Command Line Processor again.
$ db2
Now access the remote database you have just configured.
=> connect to mydb user db2user using db2user
5. Retrieve data from a sample employee table.
=> select * from dsn8810.emp
Your query should return data for 42 employees.
6. Release the remote connection and exit the DB2 Command Line Processor.
=> terminate

28
Virtualization and Linux on System z Workshop

4.3 WebSphere Application Server V6.1


In Version 6.1, installation of WebSphere Application Server Network Deployment typically performs
two actions. First the installation wizard installs a shared set of core product files. Second, the
installation wizard optionally creates a profile.
A profile is a separate data partition that includes the files that define a runtime environment for an
application server process, such as a deployment manager or an application server.
During installation, you can choose to create an application server profile, a deployment manager
profile, a cell set of profiles which contains a deployment manager and a federated application server,
or a custom profile. The installation wizard also has an option not to create a profile during installation.
However, at least one profile must exist to have a functioning application server environment.
After installation, you can use the Profile Management Tool to create additional profiles.
In the following exercise, you will install the websphere product and create a cell set of profiles which
contains a deployment manager and a federated application server as depict in the following figure.

4.3.1 Install WAS Network Deployment edition


1. Launch the vncviewer from your workstation.
Connect to Linux, login as root and start a shell
2. Go to the directory containing the WAS product installation files.
# cd /mnt/labstuff/wasnd61x/WAS
3. Launch the installation wizard.
# ./install
4. The Welcome panel appears.
Click on 'Next'
5. Accept the license agreement .

29
Virtualization and Linux on System z Workshop

Select “I accept both the IBM and non-IBM terms”


Click on Next
6. After you accept the licensing terms, the Installation wizard checks for a supported operating
system and prerequisite patches.
This check will fail because your Linux server is at Update 4 level – a non supported version.
For our purpose, you can ignore this failure and proceed with the installation.
Click on Next
7. Install the sample applications.
Select “Install the sample applications”
Click on Next
8. Accept the default location of the installation root directory, /opt/IBM/WebSphere/AppServer, for
the core product files, which are also known as the shared system files or the product binaries.
Click on Next
9. Select the default WebSphere Application environment to create - Cell (deployment manager
and a managed node)
Click on Next
10. Do not enable administrative security
De-select “Enable administrative security”
Click on Next
11. Review the summary for correctness and begin the installation.
Click on Next
12. The Installation wizard creates the uninstaller program and then displays a progress panel that shows
which components are being installed. At the end of the installation, the wizard displays the Installation
complete panel.
13. Your installation will complete with a “partial success” status. This is because the system prerequisite
check failed earlier. You can safely ignore this message.
Click on Finish

30
Virtualization and Linux on System z Workshop

4.3.2 Using the Administrative client


When you installed the base code previously, the deployment manager and one node, AppSrv01, were
created. This node contains one default application server named 'server1'. Use the Integrated
Solutions Console to start this application server.
1. Start the Deployment Manager.
# /opt/IBM/WebSphere/AppServer/profiles/Dmgr01/bin/startManager.sh
2. Start the node agent for the application node AppSrv01 The node agent must be started before
the Deployment Manager can manage it via the administrative client.
# /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin/startNode.sh
3. From a web browser, start the Integrated Solutions Console (no user / password needed).
http://129.40.35.<n>1:9060/admin
4. Expand the 'Servers' tab and select 'Applications servers'.
You should see an application server named server1.
5. Start the application server 'server1'.
Check the box next to 'server1'
Click on 'Start'
A Successful message is displayed and the Status of the server indicated that is is now started
(green arrow).

4.3.3 Run the sample applications


1. The snoop servlet:
http://129.40.35.<n>1:9080/snoop
2. PlantsByWebSphere:

31
Virtualization and Linux on System z Workshop

http://129.40.35.<n>1:9080/PlanstByWebSphere
3. Explore the rest of the available samples.
1. Http://129.40.35.<n>1:9080/WSsample

32
Virtualization and Linux on System z Workshop

4.4 IBM HTTP Server and the WebSphere Application


Server Plug-in
The WebSphere Application Server works with a Web server to route requests for dynamic content,
such as servlets, from Web applications. The Web servers are necessary for directing traffic from
browsers to the applications that run in WebSphere Application Server. The Web server plug-in uses a
configuration file to determine whether a request is from the Web server or the Application Server.

1. Start the installation


# cd /mnt/labstuff/wasnd61x/IHS
# ./install
2. After launching the Installation wizard, the ISMP wizard initializes and then presents the
Welcome panel.
Click on Next
3. The License agreement panel appears. Accept the license agreement
Select “ I accept... “
Click on Next
4. An operating system prerequisites check is performed next. This will report a failure because
we are running RHEL4 U4, which is not yet supported. Ignore this failure for now.
Click on Next
5. Accept the default installation root directory, /opt/IBM/HTTPServer.
Click on Next
6. The default port values are 80 for IBM HTTP Server and 8008 for the IBM HTTP
administration module. Accept these values.

33
Virtualization and Linux on System z Workshop

Click on Next

7. The IBM HTTP Server Administration Server Authentication panel.


De-select “Create a user ID...”
Click on Next
8. The IBM HTTP Server Administration Server setup panel. This panel collects information to
enable the installation to grant a user ID write access to the necessary IBM HTTP Server and
plug-in configuration files. The IBM HTTP Server administration server runs as the specified
user ID.
De-select “Setup IBM HTTP Administration Server ....”
De-select “ Create a unique user ID....”
Click on Next
9. Tthe IBM HTTP Server Plug-in for Websphere Application Server panel. This panel collects
information to install the Websphere Application Server Plug-in into a directory that is relative
to the IBM HTTP Server installation location, using the remote setup type. Accept the default.

Click on Next

10. Review the confirmation panel to verify your selections. Begin installing IBM HTTP Server.
Click on Finish
11. When the installation is complete:
Click on Next
12. Start the HTTP Server.
# /opt/IBM/HTTPServer/bin/apachectl start
13. Launch a browser and start the test the HTTP server. You should see the IBM HTTP server
home page.
Http://129.40.35.<n>1
14. Test the plug-in to Websphere. Invoke the snoop servlet without using the application server
specific sport. The request will first send to the HTTP server and then forward to the
application server for processing via the plug-in.
Http://129.40.35.<n>1/snoop

34
Virtualization and Linux on System z Workshop

Unit 5: Other software


5.1 Oracle 10g2 on System z Linux
5.1.1 Introduction
For additional installation information on a Red Hat distribution, please refer to the following IBM
redbook: http://www.redbooks.ibm.com/abstracts/sg247191.html?Open

5.1.2 Preparing the Environment


Oracle recommends a minimum of 1024 MB of RAM and 1.5 GB of swap space. In this lab exercise,
we will use less because of resource constraints. Warning messages will appear during installation. For
our purpose, you can safely ignore these messages.

1.2.1 Install additional packages


Install the additional packages that are not in our base system (Check the full list above). From the root
user:
# cd /mnt/labstuff/oracle
# rpm -ivh libaio-devel-0.3.105-2.s390x.rpm
# rpm -ivh gcc-3.4.6-3.s390x.rpm

1.2.2 Create the Oracle user


1. Create two groups.
# groupadd oinstall
# groupadd dba
2. Create the oracle user.
# useradd –m –g oinstall –G dba oracle
3. Give the oracle user a password
# passwd oracle ________________________
4. Ensure that the oracle user can write to the /opt/oracle directory.
# mkdir /opt/oracle
# chown oracle:dba /opt/oracle

1.2.3 Set kernel parameters


1. Edit the /etc/sysctl.conf file and add these lines: (or copy from /mnt/labstuff/oracle/sysctl)

35
Virtualization and Linux on System z Workshop

# vi /etc/sysctl.conf
net.ipv4.ip_local_port_range=1024 65000
kernel.sem=250 32000 100 128
kernel.shmmax=536870912 #Set to roughly 2/3 of the guest memory size.
fs.file-max=65536
net.core.rmem_default=1048576
net.core.rmem_max=1048576
net.core.wmem_default=262144
net.core.wmem_max=262144
2. Apply the changes.
# sysctl -p

1.2.4 Set shell limits for the Oracle user


1. Edit the /etc/security/limits.conf file to set the “files” and “process” limits. Add the following
lines to the end of the file (before the last line):
# vi /etc/security/limits.conf
oracle soft nofile 4096
oracle hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384
2. Make sure these limits are in effect when the ssh, su and login commands are used.
3. Change the oracle user’s default limit to 65536. Edit the /home/oracle/.profile file and add the
following line to the end of the file:
ulimit -n 65536

1.2.5 Set Oracle environment variables


Edit the /home/oracle/.profile file and add the following lines to the end of the file:
# vi /home/oracle/.profile
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/db
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:$PATH
umask 022

36
Virtualization and Linux on System z Workshop

1.2.6 Set up VNC Server


1. Perform this task with the oracle user.
Login as oracle
2. Start the VNC server.
# vncserver
3. Give a password for the VNC Server:
# vncpasswd (use oracle)
4. Edit the xstartup file to enable the window manager.
===> vi /oracle/.vnc/xstartup
Uncomment the following two lines by removing the '#” .
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

5. Restart the VNC server.


# vncserver -kill :2
# vncserver

5.1.3 Install Oracle 10gR2


1. Launch the vncviewer on your workstation and connect to oracle and start a shell.
Connect to 129.40.35.<n>1:2
Right click & select Open Terminal
2. Products media have been made available on a NFS server. Mount this directory.
# mkdir /oracle
# mount 129.40.35.3:/nfs/ISV/oracle10gnew/database /oracle
3. Start VNC Viewer, connect to your linux server, log in as oracle and start a shell.
4. Start the installation by running the installer script:
# /oracle/runInstaller
5. The Welcome window appears.
Select Advanced Installation
Click on Next
6. Accept the defaults for Inventory Directory and Credentials
Click on Next
7. Accept the default Installation Type of “ Enterprise Edition”

37
Virtualization and Linux on System z Workshop

Click on Next
8. Accept the defaults for Home destination
Click on Next
9. Start the Product-Specific Prerequisite Checks
Click on Next
10. Ignore the warning. We do not have the recommended memory and swap space allocated. This
will not affect this installation.
Click on Yes
11. Accept the default Configuration Option to create a database
Click on Next
12. Accept the default of “General Purpose” database
Click on Next
13. Accept the default Database Configuration Options
Click on Next
14. Accept the default Database Management Option to use Database Control
Click on Next
15. Accept the default Database Storage Option of File System
Click on Next
16. Accept the default to Not enable Automated backups
Click on Next
17. Set account passwords
Select Use the same password for all the accounts
Type in a password of ‘oracle’
Click on Next
18. Review the summary and start the installation
Click on Next
19. When the Database Configuration Assistant presents the Database creation complete window.
Continue with next step
Click on OK
20. When the Execute Configuration scripts window appear, go to a root user session and execute
the scripts listed in this window...
# ________________________________________________________
# ________________________________________________________

38
Virtualization and Linux on System z Workshop

21. When the installation completes, exit the installer.


Click on Exit
At this point, you have a running database.

5.1.4 Using OEM to manage an Oracle database


You can use Oracle Enterprise Manager (OEM) through to manage an Oracle database. After the
successful completion of the installation of the database, you can invoke Oracle Enterprise Manager by
entering the following URL: http://129.40.35.<n>1:1158/em
Enter User Name: sys
Enter Password: oracle
Connect As: SYSDBA
Click on Login

You can use this panel to manage your single instance database, such aschecking for patches, running
the Automatic Workload Repository, and so on.

5.1.5 Using iSQL*Plus


You can also use SQL*Plus from the browser. Enter the following URL:
http://129.40.35.<n>1:5560/isqlplus
Enter Username: system
Enter Password: oracle
Connect Identifier: orcl
You will be presented with an SQL worksheet where you can query the database, build PL/SQL blocks
of code etc.
Try this SQL statement. Type:
select owner, table_name from all_tables
You should see the output displayed.

39
Virtualization and Linux on System z Workshop

Unit 6: References
6.1 Navigating in Linux
Some basic commands
pwd Print current (working) directory.

ls List directory contents.


ls -l long listing with dates and permissions
ls -a list all, including hidden files (hidden files start with a period)
cd Change directory.
cd - change to previous directory
cd ~ change to home directory
cd .. change to parent directory
cp Copy file(s).
cp -r somedir somedest Copy recursively (directory and all contents)
mv Move (or rename) a file (or directory)

rm Delete (remove) a file.


rm -r somedir Delete recursively (directory and all contents)
rm -ri somedir Delete recursively, but prompt before each removal
rm -rf somedir Delete recursively, never prompt

mkdir Create directory.


rmdir Remove (empty) directory.

cat Print file contents (to console).


less Scroll through file contents, one page at a time.
SPACEBAR to advance a page, B to go back a page, Q to quit, /pattern to search for pattern
exit Close shell. If this is your login shell, you will log out.

Getting help
To get detailed help on a particular command or program, you can try the following:
Man pages If you want help on a specific command (ls for example), type man ls. You move around in
man as you do with less: SPACEBAR is forward a page, B is back a page, Q is quit.

Info pages Info pages are similar to man pages, but contain links and other complex structures. There are
many key-strokes for navigating info; if you call info without any arguments, then hit H, you'll
get some help on using info.

40
Virtualization and Linux on System z Workshop

Man pages If you want help on a specific command (ls for example), type man ls. You move around in
man as you do with less: SPACEBAR is forward a page, B is back a page, Q is quit.

/usr/share/doc Every package must install at least some minimal help into a subdirectory in
/usr/share/doc. Sometimes it's in html format (read with a browser),
sometimes it's plain text (read with less), sometimes it's compressed text (has an
ending like .gz, read with zless).

Copying and pasting


Copying and pasting in Linux is really easy.
To copy Mark the text you want to copy with the left mouse button
To paste Click right mouse button to paste.

Recalling previous commands

history Display the command history list with line numbers.


Up arrow key Scroll up to the previous event in the history list .

Down arrow key Scroll down to the next event in the history list.
!345 Execute command #345 in the history file.
!! Execute the last command you entered.
!$ Retrieve the parameter of the last command.
!<command> Execute the last <command> in the history list. For example, !cp will repeat
the last copy command in the history list.

Command and file name completion


Automatic file name completion is one of the most useful features of the Linux command line. You
don't have to type or even remember long file names. - just press the Tab key and the shell does the
typing for you! Bash can complete commands and file names for you if what you have already typed
in is unambiguous.
Try the following:
hist<hit the tab key>
Bash will complete it to the command 'history' for you.
Next try this:
cd /sys/b<hit the tab key>
In this case, nothing happens, except that bash may beep at you. Here, what you have typed is

41
Virtualization and Linux on System z Workshop

ambiguous, so bash can't complete it.


To see what commands are available:
hit the tab key twice in succession
Bash will display all the possibilities, and you can usually enter one or two more characters and hit tab
again, and bash will complete the command for you.

6.2 Vi Cheat Sheet


vi has 2 modes: command mode and insert mode. In command mode, everything you type is a
command. In insert mode what you type is written to the screen (file buffer). vi starts in command
mode.
To enter insert mode you can press:
i to start inserting at the current cursor position
I to start inserting at the beggining of the line
a to start append after the current cursor position
A to start appending at the end of line
o append a new line and start editing
O insert a new line and start editing

Press Esc to exit command mode.


To move around in command mode you can use the arrow keys.
Other useful movement commands
0 start of line
$ end of line
:nn goto line nn
G end of file

Editing commands: They can be preceded by a number of times to repeat the command, i.e. 4dd will
cut 4 lines.
dd cut line (delete)
yy copy line (yank)
p paste after cursor
P paste before cursor

42
Virtualization and Linux on System z Workshop

File commands:
:w save file
:w filename save as 'filename'
:q quit
:q! quit without saving
:e file open a file
:r file insert (read) a file

6.3 Books
• Linux in a Nutshell
• Linux for S/390 - Redbook
• zSeries HiperSockets - Redbook
• zSeries Linux Application Development - Redpiece
• ZSeries Linux Systems Management - Redpiece
• Linux for S/390: Device Drivers and Installation Commands
• Linux on IBM eServer zSeries and S/390: VSWITCH and VLAN Features of z/VM 4.4
www.redbooks.ibm.com/redpapers/pdfs/redp3719.pdf
• Getting Started with zSeries Fibre Channel Protocol - Redpaper
• Linux on IBM zSeries and S/390: High Availability for z/VM and Linux - Redpaper
• Linux on IBM zSeries and S/390: Securing Linux for zSeries with a Central z/OS LDAP Server (RACF)
-Redpaper
• Porting UNIX Applications to Linux - Hints and Tips (
ibm.com/servers/eserver/zseries/library/techpapers/pdf/gm130115.pdf)
• Linux for S/390 and zSeries porting hints and tips (
ibm.com/servers/esdd/articles/linux_s390/index.html)

6.4 Web Sites


• www.ibm.com/vm
• www.vm.ibm.com/linux
• linux.com
• linux.s390.org
• oss.software.ibm.com/developerworks/opensource/linux390

43

You might also like