Old Linux Admin 2008 -->
Home Debian Install + WIFI WIFI Install cont'd Debian Install Done! Cisco Soho97 Config LinuxCmds Firewalls AntiVirusInfo.html Shorewall Firewall Old Linux Admin Series Java RMI Asterisk_PBX_Info Databases - A Research Paper VPN PPTPD Info Aloha Packet Radio Transmission Apache2_Info.html BasicSecurityConcepts.html C_and_Java_Info.html CV.html Fetchmail_SSL_Info.html Hard_Drive_Info.html LVM2_Volume_Info.html MYSQL_Info.html Networking_Info.html Packet_Inspection_Info.html Security_Info_Wireshark_WIFI.html Snort_Info.html Subnet_Mask_Info.html Useful_One_Liners.html New DebianAdmin Site

OK, we left the pc with a wifi card installed, and got it on the web using iwconfig, iwlist, dhclient etc. We want to automate that instead of typing it in each time and learn about shell scripts, attributes, the other 5 terminals and the VIM text editor. If you can't be arsed to learn a cmd line editor, then you may as well stick with Windows and a mouse and not learn much about anything! All the commands we used to get the wifi card up can be put in the script file - similar thing to a Win batch file. Look at one already on the system to see its format, using the newer "vim" command text editor, as I find the default Vi editor weird and cant get it to do what I want so:

apt-get install vim

from the CD, (and note that it is now called still using the

vi usage

and have a play using the built in teacher prog

vimtutor

When you are an expert in editing in 5 mins (hahaha..) then choose a command file to view but DONT change its contents!! We look only then exit from VIM using Shift Q then at the command prompt bottom left we type another small q to quit.

:q Enter

If you get in a mess try Ctrl C or Ctrl Q to force end the prog. Lets find a .sh type file suitable to look at:

find / -name *.sh

I chose /etc/acpi/powerbtn.sh cause its small to view.. We only want to copy its format for our own file. The #s are ignored by the system shell, like a REM remark line in a Win batch file, and the rest is a conditionbased prog code in Linux using other commands to do the work - thats scripting! Keep this file open for ref in terminal 1 (Alt-F1) and switch to another of the remaining 5 terminal screens we have in Debian - F2 to F6, where F7 will be the Xwindows terminal when we install the necessary rest of OS files - later.. We create an empty file after logging on as root in term2 [Alt-F2] using vim, called /wifiup.sh

vi /wifiup.sh

Switch to insert text mode with the i key now that your are now an expert in VIM after using vimtutor (hahah..again) Put the first line in as in our example:

!/bin/sh

Maybe a name: #my wifiup.sh script etc. Then put in all the command lines we used to get the wifi card running earlier:

modprobe ndiswrapper

This loads ndiswrapper in kernel using modprobe

iwconfig wlan0 essid "Yournetname"

your networks name with/out quotes

iwconfig wlan0 key xyzxyzxyzZ

your WEP password

iwconfig wlan0 commit

depends on the card if function accepted

dhclient wlan0

requests DHCP address

ping -c 3 google.co.uk

checks net access and name resolution is working

Save and exit file edit using Shift Q and

:wq to write and quit

Now you have a text file /wifiup.sh Look at its attributes: ls -al /wifiup.sh

-rw-r--r-- 1 root root 193 date time

It only readable and writeable by owner root so we change so normal users can use it too:

chown stevee:users /wifiup.sh

To make it work we change is attributes to executable for user and groups

chmod ug+x /wifiup.sh

Now look at it with:

ls -al

-rwxr-xr--1 root root 193 date time

This means it is readable/writable/executable by the owner stevee, readable and executable by the users group, and only readable by "others"

Look at other files/dirs and try to work out who can use them and how, given the first character defines filetype eg d is a directory and l is a link to another file or dir.

OK - colour time!

Open the config file ".bashrc" a hidden file in each users home dir:

vi .bashrc

Put the cursor under the # on the various lines suggested for colorising your listings command and deletes it using the delete and arrow up/down keys. Save with :wq as before then logout and back in again using

logout

Now use

ls -a /

and see what happened to your /wifiup.sh file ??? OOOh! Bright green! An exe file! Check if the exe works..

sh /wifiup.sh

I find I sometimes need to kick off the chat between AP and card if it doesn't get anywhere and keeps trying DHCPDISCOVER channel blah.. by using:

iwlist wlan0 scanning

just to get them aware of each other then run the script. I think my AP goes asleep when quiet...

If all is working we can put this exe in the binaries dir and change its name so it acts like any other Linux command from the command line:

cp -v /wifiup.sh /bin/wifiup

Now you should only have to type:

wi[TAB]

and it will autonamecomplete as its the only command in /bin/ starting with a wi - look..

ls -a /bin

the only other w file is "which" (what does that do??)

Get your ping reply from google? What's your IP address today?

ifconfig

Ah, 10.0.0.2 same as yesterday...

Ok, now your on the web again, install some stuff to get graphics happening:

apt-get install xserver-xorg-video-vesa

The vesa driver is generic and should work with most all graphics cards. If you want other card options check in:

modconf

and see if your card make is listed with a framebuffer driver..not interested personally as not into games etc...only Google Earth now out for Linux..go research..

Asked for cd again? Lets fix that as were on the web and dont need that hassle..

vi /etc/apt/sources.list

Put a # in front of the deb CD line and go to a new line to add a mirror for getting the newest packages off the web so type the web address:

deb ftp://ftp.fr.debian.org/debian etch main contrib

As I am in France, I also put in a line for a server in Germany In case the French one is down etc..

If you learned your basic Vim commands you can use Yank to copy the .fr line and just change .fr to de for germany

Now update the apt database with the new info

apt-get update

and try the install again (up arrow through cmd history)

Install all the new dependencies too as normal. Follow any onscreen instructions. Now we need an X Windows manager:

apt-get install xdm

We will needs fonts on a desktop, and a server for them:

apt-get install xfs xfonts-base

Now for interest see if thats sufficient for an X session..

startx

What should happen is you get a screen that tells you why an Xsession will not work, but your mouse should move to click the OKAY box.
Im just trying to get an idea what the bare minimum requirements are to get toward a desktop environment rather than just:

apt-get kde*

etc, so that we've LEARNED something...Go do that if you need to read your mail in a hurry..

We can also use wildcards in apt if we dont know a package name exactly - kernel-headers, kernel versions etc eg

apt-get kernel-image*

Lists all types of kernels you could install to suit your hardware etc.

Anyway, an xterm was missing:

apt-get install xterm

startx

Now we have a mini version of terminals F1-F6... force quit the xterm with Ctrl-Alt-BackSpace

apt-get install kdesktop

Still as before...no x window manager eh..?

apt-get install x-window*

Aaah, a big list of window mgrs - choose 1 eh? Like the sound of evilwm..

apt-get install evilwm

startx

No go, need the whole x system I reckon

apt-get install x-window-system

No - bits still missing..

apt-get kde*

The whole kde list, lets just install:

apt-get install kde-core

We Have Desktop...!! Right it's all yours to discover...Tchau!

I hope this install method has been informative and fun, rather than just getting a system installed straight to a desktop, so you can appreciate what is built on what etc.

We have covered a lot of ground along the way, and you should have a better understanding of what's involved with certain processes and tools and can see how powerful, interesting and flexible this OS is, because nothing is hidden or secretive.

It's all on the web to study if you put in the effort.

Good luck!

Steve

date

Friday July 11 00:27:40 BST 2008

Steve 2008-2022