Exercise 2 Part a Build X window Computer
Exercise 2, Part (a) – Build X window
Computer Center, CS, NCTU Outline q X Window System • • Introduction Architecture X 11 implementation The Window Manager q Steps of Exercise • • Install X 11 Configuring X 11 Install Afterstep Configuring Afterstep q Appendix • • 2 Classic S Apps X Startup Remote X client X 11 Forwarding
Computer Center, CS, NCTU 3 X Window System (1) q Introduction • What is X Window System? Ø The X Windows System, also referred to as ‘X’ or “X 11”, is the standard graphical engine for Unix and Linux. Ø It is largely OS and hardware independent, it is network-transparent, and it supports many different desktops. • History Ø 1984: The X Window system was developed as part of Project Athena at MIT. Ø 1987: X Version 11 is released. X is now controlled and maintained by the Open Group. Ø 1993: X 11 R 6 Ø 2005/12: X 11 R 7
Computer Center, CS, NCTU X Window System (2) • Naming Ø X Window System Ø X Version 11 Ø X Window System, Version 11 Ø X 11 • Version Ø X 11 R 6 – X Window System Version 11 Release 6 Ø X 11 R 7 – X Window System Version 11 Release 7 • Latest version Ø From X. Org – X 11 R 6. 9. 0 – X 11 R 7. 1 4 Dec. 21 2005 May. 22 2006
Computer Center, CS, NCTU 5 X Window System (3) q Architecture: • A client-server architecture Ø The X client request display service Ø The X server provide display service Ø Communicate with X Protocol
Computer Center, CS, NCTU 6 X Window System (4) • Client-Server Design Ø Client – An application written using X libraries (e. g. Xlib) – Request service (like create window) – Receive events from X server (like mouse input) Ø Server – Runs locally and accepts multiple X clients – Manage the keyboard, mouse and display device – Create, draw and destroy graphic objects on screen
Computer Center, CS, NCTU 7 X Window System (5) • X Protocol Ø The X Protocol is also divided into device dependent and device independent layers. Ø Advantages of X protocol – The X server is highly portable (various OS, Language) – The X Clients also have high portability – X support most oriented network protocol – Local and network based computing look and feel the same
Computer Center, CS, NCTU X 11 implementation q Open-source implementations of X Window System • XFree 86 project Ø Free. BSD 4. 10 -Release, 5. 2. 1 -Release Ø Latest Version: 4. 6. 0 Mar. 10, 2006 • Xorg foundation Ø X 11 official flavor Ø Latest Version: 6. 9. 0 Dec. 21, 2005 Ø Latest Version of R 7: 7. 1 May. 22, 2006 From 1992 From 2004 8
Computer Center, CS, NCTU 9 The Window Manager (1) q Window Manager • A special kind of “X Client” provides certain look-and-feel window in front of you. Ø Background, desktop, theme Ø Virtual desktop Ø Window attributes and operations – Size: resize, minimize, maximize – Position: Overlap, move
Computer Center, CS, NCTU 10 The Window Manager (2) q Examples: Ø After. Step Ø Enlightenment Ø Window Maker Ø Gnome Ø KDE Ø…
Computer Center, CS, NCTU 11 Steps of this exercise 1. 2. 3. 4. Install X 11 Configuring X 11 Install Afterstep Configuring Afterstep
Computer Center, CS, NCTU Installing X 11 (1) q Use cvsup to update your ports • /usr/bin/csup –L 1 /usr/local/etc/cvsup-ports q Pre-steps: • We use Xorg as our X Server • Add the following line in /etc/make. conf – X_WINDOW_SYSTEM=xorg • Do this line – pkg_delete -f /var/db/pkg/imake-4* /var/db/pkg/XFree 86 -* • Your “PATH” environment variable – Edit /etc/csh. cshrc – set path = (/bin /sbin /usr/sbin /usr/local/bin /usr/X 11 R 6/bin ) 12
Computer Center, CS, NCTU 13 Installing X 11 (2) q We use Xorg as our X Server • To build and install Xorg from the ports Ø % login as root Ø % cd /usr/ports/x 11/xorg Ø % make install clean q If you want to install XFree 86 Ø % login as root Ø % cd /usr/ports/x 11/XFree 86 -4 Ø % make install clean It will run about 40 minutes Athlon 64 3500+ 1 GB Ram 100 MB NIC Install Xorg needs 4 G free space
Computer Center, CS, NCTU Configuring X 11 (1) q Pre-step – know your hardware • Monitor specifications Ø Horizon Synchronization frequency – Ex: 31 ~ 81 KHz Ø Vertical Synchronization frequency – Ex: 56 ~ 76 KHz • Video adaptor chipset – Ex: ATi Radeon 9200 SE – Ex: n. VIDIA Ge. Fource FX 5200 – Ex: ATI Mobility RADEON 7500 (16 M) (IBMT 30) • Video Adapter Memory – Ex: 128 MB 14
Computer Center, CS, NCTU 15 Configuring X 11 (2) q Steps of X 11 configuration 1. Generate an X 11 configuration skeleton file Ø % Xorg –configure (Xorg) – The file will be put in /root/xorg. conf. new Ø % XFree 86 –configure (XFree 86) – The file will be put in /root/XF 86 Config. new
Computer Center, CS, NCTU 16 Configuring X 11 (3) 2. Test the existing configuration • • % Xorg –config /root/xorg. conf. new (Xorg) % XFree 86 –xf 86 config /root/XF 86 Config. new (XFree 86) Ø If a black and grey grid an X mouse cursor appear, the configuration was successful Ø Press “Ctrl+Alt+Backspace” to leave the test
Computer Center, CS, NCTU 17 Configuring X 11 (4) 3. Tune Configuration file Ø Edit /root/xorg. conf. new Ø Edit /root/XF 86 Config. new – Section Monitor – Section Screen – Section Input. Device Section "Screen" Identifier "Screen 0" Device "Card 0" Monitor "Monitor 0“ Default. Depth 24 Sub. Section "Display" Viewport 0 0 Depth 24 Modes "1280 x 1024" "1024 x 768" End. Sub. Section End. Section (Xorg) (XFree 86) Section "Input. Device" Identifier "Mouse 0" Driver "mouse" Option "Protocol" "auto" Option "Device" "/dev/sysmouse" Option "ZAxis. Mapping" "4 5" End. Section "Monitor" Identifier "Monitor 0" Vendor. Name "Monitor Vendor" Model. Name "Monitor Model“ Horiz. Sync 31. 0 - 81. 0 Vert. Refresh 56. 0 - 76. 0 End. Section
Computer Center, CS, NCTU Configuring X 11 (5) 4. Copy configuration file to real place Ø Ø 5. % cp /root/xorg. conf. new /etc/X 11/xorg. conf % cp /root/XF 86 Config. new /etc/X 11/XF 86 Config (XFree 86) Startup X window Ø % startx [Comment] Ø Switch to Virtual Console – Ø Press “Ctrl+Alt+F 1~F 8” View xinitrc – /usr/X 11 R 6/lib/X 11/xinitrc # start some nice programs twm & xclock -geometry 50 x 50 -1+1 & xterm -geometry 80 x 50+494+51 & xterm -geometry 80 x 20+494 -0 & exec xterm -geometry 80 x 66+0+0 -name login 18 (Xorg)
Computer Center, CS, NCTU 19 Install Afterstep (1) q Here we use afterstep as our WM • http: //www. afterstep. org/ q Installation • % cd /usr/ports/x 11 -wm/afterstep-stable • % make –DWITH_DIFFERENT_LOOKNFEELS –DWITH_SAVEWINDOWS install clean
Computer Center, CS, NCTU Install Afterstep (2) q Configuring X 11 to use afterstep • Edit “xinitrc” Ø File Location: – System Default: – Personal: /usr/X 11 R 6/lib/X 11/xinitrc ~/. xinitrc Ø Format: just like a shell script! System Default To execute afterstep # start some nice programs exec afterstep twm & xclock -geometry 50 x 50 -1+1 & xterm -geometry 80 x 50+494+51 & xterm -geometry 80 x 20+494 -0 & exec xterm -geometry 80 x 66+0+0 -name login 20
Computer Center, CS, NCTU 21 Install Afterstep (3) q Run Your X-Window • % startx q Usage • • • Ctrl + Alt + Backspace force to quit X Left button: copy Right button: paste
Computer Center, CS, NCTU After. Step Configuration (1) q Location of configuration file • Global configuration file directory Ø /usr/X 11 R 6/share/afterstep/ • Personal configuration file directory Ø ~/. afterstep/ q When After. Step starts • Personal configuration first Ø It first tries to read personal configuration files, and then read global configuration files for those not found. Ø Follow “. include” configuration • Global configuration if missing personal configuration q To make personal configuration • Copy what you want to change from global to personal and modify it. And • Add “. include” to include other global you need. 22
Computer Center, CS, NCTU After. Step Configuration (2) Pager module Win. List Wharf module Win. Tab 23 Start menu Animation feel look Minitor. Wharf
Computer Center, CS, NCTU 24 After. Step Configuration (3) q. Under /usr/X 11 R 6/share/afterstep/ Name Purpose base Afterstep configuration file autoexec Define what is run when After. Step starts and restarts animate Animate Module configuration file pager Pager module configuration file wharf Wharf/Monitor. Wharf module configuration file winlist Win. List module configuration file start/ Start menu when you click left button feels/ Define how After. Step feels looks/ Define how After. Step looks
Computer Center, CS, NCTU After. Step Configuration (4) q Steps to add something to start menu • • install your favorite applications first Add entry under directory Edit the entry file Update menu % ls 0_Applications 1_Desktop 2_Modules 3_Screen_savers 6_nop 4_Windows 7_About_After. Step 5_Quit f_firefox 25 Exec “Firefox" exec firefox & Mini. Pixmap "mini-app. xpm"
Computer Center, CS, NCTU After. Step Configuration (5) q Add something to wharf module • Edit wharf configuration file (ex. add Term Folder) … *Wharf Terms large/Monitor 1, dots/3_dots Folder *Wharf aterm Exec "-" aterm -tr -tint blue *Wharf rxvt Exec "-" rxvt -tr -fg yellow *Wharf eterm Exec "-" Eterm -O --tint blue *Wharf xterm Exec "-" xterm -fg yellow -bg *Wharf ~Folder … 26 -fg yellow -bg black & blue &
Computer Center, CS, NCTU Appendix A: classic x apps (1) q xterm q xclock 27
Computer Center, CS, NCTU Appendix A: classic x apps (2) q xeyes q xbiff q xman Not this 28
Computer Center, CS, NCTU Appendix B: X Startup (1) q xinit - X Window System initializer xinit [ [ client ] options ] [ -- [ server ] [ display ] options ] • Files Ø Default client script: – ~/. xinitrc – /usr/X 11 R 6/lib/X 11/xinitrc (run xterm if. xinitrc does not exist) Ø Default server script: – ~/. xserverrc – / usr/X 11 R 6/lib/X 11/xinit/xserverrc (run X if. xserverrc does not exist) Ø startx: – script to initiate an X session 29
Computer Center, CS, NCTU Appendix B: X Startup (2) q xdm - X Display Manager • Xdm provides services similar to those provided byinit, getty and login on character terminals • Files: Ø /etc/ttys ttyv 8 "/usr/X 11 R 6/bin/xdm -nodaemon" Ø Default script – ~/. xsession 30 xterm on secure
Computer Center, CS, NCTU Appendix C: remote x-client q To launch an X client from a remote host for display on the local X server, you need to do following steps: • Start X Server with tcp connection support Ø %startx -listen_tcp • Permit for the remote host to display X clients on the local machine. Ø %xhost +remotehost • set DISPLAY for remote X clients Ø %setenv DISPLAY=server: display [hostname]: displaynumber[. screennumber] not needed if localhost 31 “ 0” in most cases defaults to “ 0”
Computer Center, CS, NCTU Appendix D: X 11 forwarding q To forward X 11 connection • Connection to X 11 DISPLAY can be forward by ssh, any X 11 programs started will go through the encrypted channel. • Server: Ø Enables X 11 forwarding: Ø Enables trusted X 11 forwarding: ssh -X ssh –Y (may be dangerous) • Client: Ø Execute any X clients you want ※Note: X 11 forwarding can represent a security hazard. X 11 forwarding should be enabled with caution. Users with the ability to bypass file permissions on the remote host (for the user's X authorization database) can access the local X 11 display through the forwarded connection. An attacker may then be able to perform activities such as keystroke monitoring. 32
- Slides: 32