USTC Debian Install Party 2004 - pudn.comread.pudn.com/downloads10/doc/38439/dip2004.pdf · GNU:...

42
Welcome to the USTC GNU/Linux Party

Transcript of USTC Debian Install Party 2004 - pudn.comread.pudn.com/downloads10/doc/38439/dip2004.pdf · GNU:...

Welcome to

the USTC GNU/Linux Party

A Pratical Guide to Debian GNU/Linux

�w<µ Ç ¸ 1mailto:[email protected]

November 3, 2004

'u��wo é�

• é GNU/Linux a,�§¿Wu�Á�ÓÆ

• ØI�Ä:§k9��@ýÒv

o SN

• 'u Debian GNU/Linux

• GNU/Linux �Ä��Ý!VgÚ�{

• Debian GNU/Linux �SC9��ü«

o 8I• �ÏÐÆö±��t��ªªL Linux �\�J'

GNU: �¤�Ìêºo the GNU Project• GNU’s Not Unix• The FREE Software Foundation• Created by Richard Stallman

o Free Software• “Free” refers the “freedom”, a part of human rights

freedom to run, copy, distribute, study, change and improve

• NOT related with price, as “free” in “free of charge”

o Copyleft• General method of keeping software free• the GNU GPL License

Debian GNU/Linuxis the world’s leading non-commercial totally

free Linux distribution. Over 1000 volunteers work to-

gether to provide a stable, reliable and free operating

system across 11 major platforms.

o stable (now is woody)o testing (now is sarge)• will become ‘stable’ soon• recommended for server/desktop installation

o unstable (always called sid)• where active development of Debian occurs• for developers and those who like to live on the edge

Why Debian GNU/Linux ?o It is maintained by its users

o Easy installation,upgrade and maintenance

o Extensive repository,with 12800+ packages

o Large user base,with unparalleled community support

o The best packaging system in the world

o Stable and reliable

Sarge Installation Overviewo Pre-install (10 min * 3 hour)• ?1êâ�°§O�M�©«• e1N�©�§O�SC0�

o Install (10*30 min)• Select Language, Region and Keyboard Layout• Network/Hardware Configuration• Partitioning• Unpacking the Debian Base System• GRUB/LILO Installation

o Post-install (15 min * 1 hour)• Set Time Zone, root Password and Create User• �aM�9^���

Preinstall Plano �'ë�©�• Debian-Installer Homepage

http://www.debian.org/devel/debian-installer/

• Ways to install Debianhttp://www.linuxmafia.com/faq/Debian/installers.html

o ;.SC�ª• Sarge install-CD

ftp://debian.ustc.edu.cn/debian-cd/d-i/pre-rc2/sarge-i386-netinst.iso

• Knoppix live-CDftp://debian.ustc.edu.cn/debian-cd/knoppix/KNOPPIX V3.4-2004-05-17-EN.iso

• USB memory stick• Hard disk

vfloppy+GRUB SC sargeo e1SC sarge ¤I©�� C:\ (FAT32�ª)

ftp://debian.ustc.edu.cn/debian-cd/d-i/pre-rc2/sarge-i386-netinst.iso

ftp://debian.ustc.edu.cn/debian/dists/sarge/main/installer-i386/

current/images/hd-media/

o SC GRUB ��J[^�ftp://202.38.73.198/linux/vfloppy.tgz

ftp://202.38.73.198/linux/RIP-3.1-1440.bin

o ^ GRUB Ú�kernel (hd0,0)/hd−media/2.6/vmlinuz root=/dev/ram0 \

ramdisk size=17000 devfs=mount,dallinitrd (hd0,0)/hd−media/2.6/initrd.gzboot

M�©«o �k3£ÄM�½ÑÖìþ�°êâ�o O�M�©«• ïÆ Windows ^r��CÑ��y¤�©«C linux• Ø�¦^ DOS §S fdisk• >&¦^ pqmagic

o ©«�Y

mount point size filesystem/ ≥5GB ext3 / reiserfs

/home (optional) ≥1GB ext3

swap (you decide) 256MB swap

©«�a.9·¶

o Ì©«��o�§hda1*hda4

o

o

hda1hda2hda3hda4

©«�a.9·¶

o Ì©«��o�§hda1*hda4

o *Щ«��AÏ�Ì©«§

Ù¥Ø���©�XÚ§

´��½õ�Ü6©«

o Ü6©«*Щ«¥�©«§

�êØÉ��§

hda5, hda6, hda7, . . .

hda1hda2hda3hda4

hda5

hda6

hda7

�ÐÆö�ïÆ

o ­3L§§>�>Æ

l¥N¬ Linux ��Ä�VgÚö��{

o P4ù�O�·-

UPõ�§Ò�õ�¶3k<�Ò´éÐ�m©

o c[�ÖJ«&E

ÃI?ÛÄ:§linux ��± DIY :^)

o gCÄç<���O�´�ï�������

Welcome to Debian Installer

linux26

��

o Hostname• 3ùp�\�ÌÅ�½��¶i§

5¿O^ debian, linux, www ���®k��¶cM

• 8�XJ�O§S�)Ûù�¶i¿�}§�±ù�)ûµ echo YOUR.IP HOSTNAME >>/etc/hosts

o Domain name• ��^r�¦^%@� ustc.edu.cn

• ù�����§� debian ù��{ü�¶Ò¬�gÄ*Ð� debian.ustc.edu.cn

• �'��©�µ/etc/resolv.conf

���

o dotfiles# run as rootcd /etc;wget ftp://202.38.73.198/linux/dotfiles.tgzcd /etc/skel/; tar zxf ../dotfiles.tgzcd; tar zxf /etc/dotfiles.tgz

o ATPcd /etc/apt/wget −r −nH −−cut−dirs=1 ftp://debian/sources.listcp sources.list.testing sources.listecho deb ftp://debian/debian−uo sid \

marillat rareware ustc java misc >> sources.listaptitude update && aptitude upgrade

locales ��

o ÀJ)¤Xe localescat>/etc/locale.gen<<EOFen US ISO−8859−1en US.UTF−8 UTF−8zh CN.GBK GBKzh CN.UTF−8 UTF−8zh HK BIG5−HKSCSzh HK.UTF−8 UTF−8zh TW BIG5zh TW.UTF−8 UTF−8EOFlocale−gen

o ÀJ%@ locale � “Ô:>/etc/environment

exim4-config ��echo localhost > /etc/mailnamecat>/etc/exim4/update−exim4.conf.conf<<EOFdc eximconfig configtype=’smarthost’dc other hostnames=’’dc local interfaces=’127.0.0.1’dc readhost=’mail.ustc.edu.cn’dc relay domains=’’dc minimaldns=’false’dc relay nets=’’dc smarthost=’ns.ustc.edu.cn’CFILEMODE=’644’dc use split config=’false’dc hide mailname=’true’EOFupdate−exim4.conf

SC�^��

o Ä�óä

aptitude install gpm vim less lftp ssh

o M�|±^�

aptitude install hotplug discover mdetect read−edidaptitude install udev alsa−base alsa−utils hdparm

# restart the udev daemon/etc/init.d/udev restart

Jp�Ç�_%�é£

o ��^àI copy-paste• ^àIVÂ!n½öÄ¢y select and copy• 3,�¶ curses §S¥I�Ó�Ue <Shift> �• üÂàI¥�½m�¢y paste

o ·-1?6

man bash and type literally /^READLINE

o ·-O¶alias e=’vim’alias l=’less’alias ..=’cd ..’alias ai=’aptitude install’alias # to list all command aliases

Jp�Ç�'Å�Ú

o the magic <TAB>

• <TAB> to complete virtually ANYTHING

• <TAB> twice to show possible-completions

• <Ctrl-J> to menu-complete

o ·-1{¤• ^ <Up>, <Down> èA·-1{¤

• ^ <Shift-PgUp>, <Shift-PgDn> þe�¶

• ^ <Ctrl-R> _�|¢·-1{¤

• ^ !!, !* �� history expansion

SC Nvidia (�°Ä# install a nvidia module that matches your kernelaptitude install nvidia−kernel−$(uname −r)aptitude install nvidia−glx nvidia−settings

# now read /usr/share/doc/nvidia−glx/README.Debian# follow it when configuring xserver−xfree86

# only load desired module on bootecho nvidia >> /etc/modulesecho agpgart >> /etc/hotplug/blacklist.d/nvidiaecho nvidia−agp >> /etc/hotplug/blacklist.d/nvidia

�§�����± . . .o é� /boot/grub/menu.lst ¥�Xe�1µ# altoptions=(recovery mode) single

o O��e�1��µ# altoptions=(1280x1024,16M) vga=795

# altoptions=(1024x768,16M) vga=792

# altoptions=(1024x768,64k) vga=791

# altoptions=(800x600,16M) vga=789

o $1 update-grub§,� reboot

o ÁÁ^ fbi w㡧^ mplayer -vo fbdev wK¡ ^_^

Install XWindowo SCØ% X Server Ú X Client

aptitude install x−window−system−coreaptitude install gnome−core

o �� xserver-xfree86

• ��À�^%@�=�

• ¦+4§gÄuÿM�

• "method for selecting your monitor characteristics"

�À Medium

• àI���À /dev/input/mice

ïᥩ�¸o iN©�

lftp −c ’mirror ftp://202.38.73.198/linux/fonts/ \/usr/share/fonts/truetype’

o X11 iN# add to /etc/X11/XF86Config−4 Section "Files"FontPath "/usr/share/fonts/truetype/chinese"FontPath "/usr/share/fonts/truetype/english"

o Xft/Fontconfig iN# install a new fontconfig package to fix a buglftp −c ’mirror ftp://202.38.73.198/linux/fontconfig’dpkg −i fontconfig/∗.deb

o Ñ\{ ai scim scim-chinese scim-tables-zh

KÑnê�

o alsamixer – ÑþN!

• ïÆ� PCM ��½�§�§SÚ�^ Master N!Ñþ• k�(kI�r PCM �� < 80 §ÄK¬kD(• 3 nForce2 þ¦^{Ù§�� Mic As Center/LFE � Off

• ek¯K§�ÁÁ?U½£Ø ~/.asoundrc

o xmms – MP3 Â�ìai xmms xmms−mac xmms−wmaadduser USER audio # and relogin

o mplayer – xNÂ�ìai w32codecs mplayer−k7 # for AMD CPUai w32codecs mplayer−686 # for Intel CPU

X

$ startx

Welcome to Linux

Think Differento troubleshooting• NEVER reboot-and-reinstall

works for Windows, worst for Linux

• be comfortable and familiar with massive textsdo not overlook them, one just cannot live without them

• if it ain’t broke, don’t fix it

o developing• have fun scripting• self motivated programming

to make our linux life easier

• The Art of Unix Programminghttp://www.faqs.org/docs/artu/

Think ShellLinux provides great power and flexibility through the

console.

o Why the Command Line Is Cool• Each tool do ONE job and do it superbly

• Tools can be pipelined to get new job done

• Tasks can be scripted and automated

o the Bash shell IS easy to use• line editing

• tab completion

• command history

Documentationo Google is your friend

take some important bit of information about your prob-

lem as keywords, feed them to http://www.google.com/linux

o Local documentation• apropos; man; pinfo

• /usr/share/doc/<Package Name>

• /usr/share/doc/HOWTO/

o Source codethe ultimate reference

r? Debian �ûo Debian ë�Ãþ

http://www.debian.org/doc/manuals/

debian-reference/reference.zh-cn.html

o Debian �+nóä

• dpkgö� .deb ^��©��Ì�óä

• APT (the Advanced Packaging Tool)dpkg �·-1cà§�) apt-get, apt-cache, apt-config �§S

• dselectdpkg � curses c৷^uÄgSCÚ�¡È,?

• aptitudeapt � curses cà§�)�ék^�*ÐõU

Debian ~�?Ö#SCdpkg −i kernel−image−2.6.8 10.00.Custom i386.debaptitude update && aptitude upgradeaptitude install vim−gtk screen tcpdump nmapaptitude remove xdm#|¢

dpkg −l xmms∗dpkg −L findutilsapt−file update && apt−file list coreutilsapt−file search bin/ipapt−cache search image viewerapt−cache show feh#��dpkg−reconfigure xserver−xfree86update−rc.d xdm removeupdate−alternatives −−config x−window−manager

Debian ~^^��catelog packages

editor vim-gtk exuberant-ctags; emacs21utils rar unzip tree strace pinfonettools ssh rsync lftp wget ntpdate nfs-common smbfsapttools apt-file apt-src debian-goodies

mail procmail fetchmail muttscripting bash perl python rubydoc debian-reference-zh-cn doc-linux-textdev-doc gcc-doc glibc-doc manpages-devterminal screen mlterm mlterm-tools / rxvt-unicodegraphics gimp imagemagick feh/gqviewlife gaim stardict*reader gv xpdf xpdf-chinese-simplified acroreadbrowser mozilla-browser mozilla-tabextensions; . . .

Configure Console Environmento bashvi ~/.bash_profile ~/.bashrc

o libreadlinevi ~/.inputrc

o vimvi ~/.vimrc ~/.gvimrc

o lftpvi ~/.lftp/rc

o mutt / fetchmail / procmailvi ~/.muttrc ~/.fetchmailrc ~/.procmailrc

Configure X Session Scriptcat>˜/.xsession<<EOFexport LANG=zh CN.GBKexport XIM=’SCIM’export XMODIFIERS=’@im=SCIM’

scim−panel−gtk −d −c simplescim −s pinyin −c simple −dxmms &gaim &mozilla &mlterm &

exec ‘type −p gnome−session‘exec ‘type −p startkde‘exec ‘type −p x−window−manager‘EOF

Configure GTKo GTK 1.x

cat>˜/.gtkrc.zh CN<<EOFstyle "gtk−default−zh−cn" {

fontset = "fixed,−∗−simsun−medium−r−\normal−−16−∗−∗−∗−∗−∗−iso10646−1,∗−r−∗"}class "GtkWidget" style "gtk−default−zh−cn"EOF

o GTK 2.xcat>˜/.gtkrc−2.0<<EOFgtk−font−name = "Courier 10 Pitch,SimSun 12"gtk−key−theme−name = "Emacs"EOF

General Tipso �?U^r��©�(dotfiles)

to avoid root previlige, and to upgrade/migrate smoothly

o ^ÊÏ^ráÒó�

to su directly: adduser USER root; vi /etc/pam.d/su

o think twice before rm -fr *

NO WAY to get them back!

o <Ctrl-S> £½ªà§U<Ctrl-Q> )£

o mkdir ~/doc; echo /usr/share/doc ~/doc\

none bind 0 0 >>/etc/fstab

XWindow Tips• <Ctrl-Alt-Fn> to swith to console n(n = 1, 2, . . . , 6)

• <Alt-Mouse Drag> to drag a window

• vi ~/.Xresources; xrdb -merge ~/.Xresources

to custumize many xapps

• less ~/.xsession-errors /var/log/XFree86.0.log

to check for errors

K\ Linux �«to be a good and proud community member . . .

o learn how to ask questionsand do your homeworkhttp://www.linuxmafia.com/faq/Essays/smart-questions.html

o be helpfullinux is not perfect

o no flame warhttp://www.advogato.org/article/534.html

o feedbackcomments, bug reports, small patches

Have FUN learning ;-)