CIS 191 – Lesson 7 Lesson Module Status • • • • • • • • • • • • Slides – done Properties - done Flash cards Lessons 4-7 No-stress quiz – done Web Calendar summary – done Web book pages – Commands – Howtos – Skills pacing Lab – done Final Preparation (Test, Trouble, Build) - done Class & lab ISOS • • • • • debian-40r4a-i386-DVD-1.iso (for class exercise) CentOS-5.0-i386-bin-DVD.iso (for Lab 5) xampp-linux-1.6.8a.tar.gz (final) diagboot.img (final) Fedora 8 (Lab 4) • • • • Star – for X demonstration and Lab 5 Trouble (Final and XC) Duke (Lab 4) Dutch (Class exercise – Instructor station only) • Class VMs CIS 191 - Lesson 7 Quiz Please close your books, turn off your monitor, take out a blank piece of paper and answer the following questions: • True or False? - Package managers like RPM check for dependencies. • Which compression tool is faster, gzip or bzip2? • What command would install the VMwareTools1.0.5-80187.i386.rpm package? CIS 191 – Lesson 7 X Windows Objectives • • • • • Agenda Hour 1 - Debian Installation Hour 2 - Network Hour 3 – X Windows Hour 4 – Lab 5 and Final preparation Lab Time • Quiz • Questions from last week • The Networking Layer • Understanding X • Debian Install • Wrap up = hands on exercise for topic CIS 191A Course Skills Pacing Lesson 2 Lesson 3 VMware Server Ubuntu 8.04 Partitioning Make file systems RH9 Booting Dual boot Fedora 9/DOS Lesson 6 Lesson 5 RPM, apt-get Tarballs Troubleshooting CentOS Install Lesson 1 Lesson 7 X windows Debian Install Review Final Lesson 4 Rooting openSUSE 11 CIS 191 - Lesson 7 Last weeks Assignment • Questions on previous material or assignments? CIS 191 - Lesson 7 Debian CIS 191 - Lesson 7 Debian GNU/Linux • Debra and Ian Murdock • "Social Contract" with the Free Software Community 1. Debian will remain 100% free 2. We will give back to the free software community 3. We will not hide problems 4. Our priorities are our users and free software 5. Works that do not meet our free software standards • APT package management system • Ubuntu, Damn Small Linux, Knoppix many others based on Debian • buzz, rex, bo, hamm, slink, potato, woody, sarge, etch releases CIS 191 - Lesson 7 Debian GNU/Linux Installation TUI based Installation CIS 191 - Lesson 7 Debian GNU/Linux APT Package Manager Adding chess program CIS 191 - Lesson 7 Debian GNU/Linux APT Package Manager Removing chess program CIS 191 - Lesson 7 Debian Install CIS 191 - Lesson 7 Exercise: Debian installation 1. Install Debian 4.0 • • • • debian-40r4a-i386-DVD-1.iso Create a VM named dutch with 5 GB hard drive Install Debian any way you want on the VM Use APT to install the chess program • apt-get install gnuchess CIS 191 - Lesson 7 Networking Layer CIS 191 - Lesson 7 Networking Layer TCP/IP Configuration • • • • IP Addresses Netmask Gateway Name Server CIS 191 - Lesson 7 Networking Layer Network Files • /etc/hosts - Contains host name/ip-address pairs • /etc/resolv.conf - Contains DNS name server • /etc/sysconfig/network - Contains host name and default gateway • /etc/sysconfig/network-scripts/ifcfg-eth0 - Contains IP address and network mask Note: To make permanent network configuration changes, modify these files then restart the network. For Red Hat use: service network restart CIS 191 - Lesson 7 Networking Layer Network Files /etc/hosts - Contains host name/ip-address pairs [root@star ~]# cat /etc/hosts # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 star.localdomain star localhost.localdomain localhost ::1 localhost6.localdomain6 localhost6 [root@star ~]# CIS 191 - Lesson 7 Networking Layer Network Files /etc/resolv.conf - Contains DNS name server [root@star ~]# cat /etc/resolv.conf nameserver 192.168.0.1 [root@star ~]# CIS 191 - Lesson 7 Networking Layer Network Files • /etc/sysconfig/network - Contains host name and default gateway Example gateway configuration: Edit /etc/sysconfig/network To look like: NETWORKING=yes HOSTNAME=station01.mordor.rivendell.middleearth GATEWAY=172.24.1.100 CIS 191 - Lesson 7 Networking Layer Network Files /etc/sysconfig/network-scripts/ifcfg-eth0 - Contains IP address and network mask Example DHCP IP configuration: Edit /etc/sysconfig/network-scripts/ifcfg-eth0 To look like: DEVICE=eth0 BOOTPROTO=dhcp HWADDR=00:0C:29:22:F2:91 ONBOOT=yes DHCP_HOSTNAME=star.localdomain CIS 191 - Lesson 7 Networking Layer Network Files /etc/sysconfig/network-scripts/ifcfg-eth1 - Contains IP address and network mask Example static IP configuration: Edit /etc/sysconfig/network-scripts/ifcfg-eth1 To look like: DEVICE=eth1 BOOTPROTO=static BROADCAST=192.168.0.255 HWADDR=00:0C:29:22:F2:9B IPADDR=192.168.0.50 IPV6ADDR= IPV6PREFIX= NETMASK=255.255.255.0 NETWORK=192.168.0.0 ONBOOT=yes CIS 191 - Lesson 7 Networking Layer Network commands • ping ip-address - tests network connectivity. • ifconfig - sets or displays network parameters. • netconfig - configures the host network. • ftp ip-address - file transfer protocol. • ssh -l login_name [hostname] [command] • scp login@hostname:sourcefile login@hostname:sourcefile - remote secure copy. CIS 191 - Lesson 7 Networking Layer Network commands • ping ip-address - tests network connectivity. [root@star ~]# ping 192.168.0.1 PING 192.168.0.1 (192.168.0.1) 56(84) 64 bytes from 192.168.0.1: icmp_seq=1 64 bytes from 192.168.0.1: icmp_seq=2 64 bytes from 192.168.0.1: icmp_seq=3 64 bytes from 192.168.0.1: icmp_seq=4 bytes of data. ttl=254 time=8.44 ttl=254 time=2.93 ttl=254 time=2.89 ttl=254 time=2.83 ms ms ms ms --- 192.168.0.1 ping statistics --4 packets transmitted, 4 received, 0% packet loss, time 3001ms rtt min/avg/max/mdev = 2.830/4.275/8.441/2.406 ms You have new mail in /var/spool/mail/root [root@star ~]# Note: Used Ctrl-C to end pinging CIS 191 - Lesson 7 Networking Layer Network commands • ifconfig - sets or displays network parameters. [root@star ~]# ifconfig eth0 Link encap:Ethernet HWaddr 00:0C:29:22:F2:91 inet addr:192.168.0.25 Bcast:192.168.0.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fe22:f291/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:27512 errors:0 dropped:0 overruns:0 frame:0 TX packets:23667 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:3439418 (3.2 MiB) TX bytes:2180665 (2.0 MiB) Interrupt:185 Base address:0x1400 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:35927 errors:0 dropped:0 overruns:0 frame:0 TX packets:35927 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:2443383 (2.3 MiB) TX bytes:2443383 (2.3 MiB) [root@star ~]# CIS 191 - Lesson 7 Networking Layer Network commands • netconfig - configures the host network. CIS 191 - Lesson 7 Networking Layer Network commands • ftp ip-address - file transfer protocol. [root@star ~]# ftp 192.168.0.42 Connected to 192.168.0.42. 220 (vsFTPd 2.0.5) 530 Please login with USER and PASS. KERBEROS_V4 rejected as an authentication type Name (192.168.0.42:root): cis191 331 Please specify the password. Password: 230 Login successful. Remote system type is UNIX. Using binary mode to transfer files. ftp> ls 227 Entering Passive Mode (192,168,0,42,195,109) 150 Here comes the directory listing. drwxr-xr-x 2 1000 1000 1024 Aug 22 15:18 Desktop -rw------- 1 1000 1000 1923179 Oct 06 08:18 lab4.simmsmar 226 Directory send OK. ftp> mget * mget Desktop? n mget lab4.simmsmar? y 227 Entering Passive Mode (192,168,0,42,103,188) 150 Opening BINARY mode data connection for lab4.simmsmar (1923179 bytes). 226 File send OK. 1923179 bytes received in 0.44 seconds (4.3e+03 Kbytes/s) ftp> bye 221 Goodbye. [root@star ~]# CIS 191 - Lesson 7 X CIS 191 - Lesson 7 Understanding X Overview • One of the original open source projects • Developed at MIT • Criticisms of X • Handles fonts poorly • Security issues • Overly complex • Recent improvements to XFree86 CIS 191 - Lesson 7 Understanding X Overview User's System Remote X clients Network X server X clients are programs with a graphical user interface: • xeyes • xlogo • firefox • gimp • etc. Local X clients CIS 191 - Lesson 7 Understanding X The Components of X • Server Component • most important component • controls input devices • controls video hardware • VGA and hardware specific servers • Client Component • clients are what the user sees • window manager provides access to individual clients and windows e.g. metacity, mwm, twm, sawfish, enlightenment ... • file manager - client that acts as a graphical shell allowing access to the file system • desktop manager - provides login sessions, authentication, and taskbar support CIS 191 - Lesson 7 Understanding X Understanding the XF86config File • General Format of the File: 1. File Section 2. Keyboard Section 3. Pointer Section 4. Monitor Section 5. Graphics Device Section 6. Screen Section • Testing the Configuration CIS 191 - Lesson 7 Understanding X Starting an X Window Session • startx shell script – starts up your GUI desktop • x, xinit commands x (bare bones X server) xinit (bare bones X server and xterm) • xdm command • can be run only by root • usually used in startup scripts • shows graphical logon screen CIS 191 - Lesson 7 Understanding X Window Managers – widgets level (look and feel) • • • • • • • • AfterStep Enlightenment Fvwm95 IceWM Sawfish Window Maker mwm twm twm (Tom's Window Manager) CIS 191 - Lesson 7 Understanding X Window Managers – widgets level (look and feel) • • • • • • • • AfterStep Enlightenment Fvwm95 IceWM Sawfish Window Maker mwm twm mwm (Motif Window Manager) CIS 191 - Lesson 7 Understanding X Desktop Environments Debian with Gnome Mandriva with KDE CIS 191 - Lesson 7 Understanding X GUI File Managers • File Manager Features • Accomplish same tasks as shell without lengthy commands • Have drag and drop support • Midnight Commander • Nautilus • Easy to use visual file manager • Use mouse to eliminate excessive key strokes • File Managers on KDE • KFM • Konqueror CIS 191 - Lesson 7 Understanding X Observe how many hidden files there are now for a fresh account that has never run the gnome desktop yet. CIS 191 - Lesson 7 Understanding X Type X (a capital X) to run the X server CIS 191 - Lesson 7 Understanding X To end, type Ctrl-Alt-BS keys at the same time CIS 191 - Lesson 7 Understanding X After exiting X you will see all the messages written to tty1. CIS 191 - Lesson 7 Understanding X Type xinit to run the X server and an xterm terminal CIS 191 - Lesson 7 Understanding X To end, type exit CIS 191 - Lesson 7 Understanding X After exiting X you will see all the messages written to tty1. CIS 191 - Lesson 7 Understanding X To start the full desktop, type startx CIS 191 - Lesson 7 Understanding X Look familiar? CIS 191 - Lesson 7 Understanding X ps –u cis191 shows that thee are a lot more processes used now that with the earlier xinit example Log out to end CIS 191 - Lesson 7 Understanding X After exiting X you will see all the messages written to tty1. CIS 191 - Lesson 7 Understanding X There are quite a few new hidden files and hidden directories now CIS 191 - Lesson 7 Understanding X Copy the system xinitrc file to the home directory. cp /etc/X11/xinit/xinitrc .xinitrc Make it a hidden file. CIS 191 - Lesson 7 Understanding X Enter the xinit command again CIS 191 - Lesson 7 Understanding X Look familiar? CIS 191 - Lesson 7 Understanding X Create a file named .Xclients and add: xclock -geometry 100x100-5+5 & exec xterm -geometry 80x24+50+150 Give the file execute permissions then enter xinit CIS 191 - Lesson 7 Understanding X You have just started to create your own personal desktop CIS 191 - Lesson 7 Understanding X CIS 191 - Lesson 7 Understanding X Edit .Xclients to be: xclock -geometry 100x100-5+5 & xterm -geometry 80x24+50+150 & exec twm Note &'s to run xclock and xterm in the background. Also note there is only one exec command and that is at the end CIS 191 - Lesson 7 Understanding X TWM is Tom's Window Manager (Tom LaStrange) CIS 191 - Lesson 7 Understanding X Now run firefox CIS 191 - Lesson 7 Understanding X Position the frame for the Firefox window CIS 191 - Lesson 7 Understanding X Enter the xinit command again CIS 191 - Lesson 7 One last X example [cis191@star ~]$ cat .Xclients xclock -geometry 100x100-5+5 & xterm -geometry 80x24+50+150 & xkbwatch -geometry 100x100+50+5 & xlogo -geometry 80x80+600+480 & xsetroot -solid "azure2" exec twm [cis191@star ~]$ CIS 191 - Lesson 7 One last X example To close windows or exit using Tom's Window Manager, left click and hold on the background to get a pop-up menu, then select choice. CIS 191 - Lesson 7 X over Network CIS 191 - Lesson 7 X over the Network Client – Server model (just reversed) Normally we refer to the remote computer running an application as the "server". It is the reverse with X. remote local Star Duke The xclient runs here The xclient graphical output is displayed here using the local X server We will use Duke's X server to serve up a graphical display from a program running on Star. CIS 191 - Lesson 7 ssh remote login with –X option Note: Using the –X option on ssh command to log into Star Note: the processes running on Star before and after the remote ssh login CIS 191 - Lesson 7 Using X to run xeyes client program remotely Note: xeyes graphical output is displayed on Duke Note: xeyes process running on Star CIS 191 - Lesson 7 Using X to run firefox client program remotely Note: firefox graphical output is displayed on Duke Note: xfirefox processes running on Star CIS 191 - Lesson 7 X over the Network Client – Server model (just reversed) Normally we refer to the remote computer running an application as the "server". It is the reverse with X. remote local Star Windows Vista PC The xclient runs here The xclient graphical output is displayed here using the local X server (cygwin) We will use Duke's X server to serve up a graphical display from a program running on a Windows PC CIS 191 - Lesson 7 Using X with Microsoft Windows PC 1) Run Cygwin Bash Shell and enter: startx 2) Connect to Star (CentOS) with: ssh –X root@192.168.0.25 then run xeyes and xclock CIS 191 - Lesson 7 New X commands: redhat-config-xfree86 startx X xinit xhost xwd, xwud - configures X server on RedHat runs the graphics desktop starts X server starts X server and xterm terminal grants remote X-client access to server create and view window dumps New X Files and Directories: /etc/X11/XF86Config /etc/X11/xinit/xinitrc and $HOME/.xinitrc /etc/X11/xinit/Xclients $HOME/.xauthority New network commands dhclient hostname ifconfig ping ssh scp ftp, telnet, rsh wall, write, talk - New network related files /etc/sysconfig/network /etc/resolv.conf /etc/hosts - hostname - DNS servers - manual host and IP mappings request DHCP address Show and set name of the system show current TCP/IP configuration Test connectivity to other hosts runs secure login shell on remote system remote secure copy Unsecure remote access commands local communication CIS 191 – Lesson 7 Next Class Assignment: Check Calendar Page on web site to see what is due next week. http://simms-teach.com/cis191ABcalendar.php CIS 191 – Lesson 7 Backup CIS 191 - Lesson 7 Understanding X Configuring X • Vital part of any Linux Installation • XF86Setup • xf86config • redhat-config-xfree86 (RedHat) • Gathering Hardware Information • Monitor • Video card • Mouse • Keyboard