There is a great tutorial at Arduino LCD playground: KS0108 Graphics LCD library

I got one with the Layout B and here is the table reorganized:

KS0107 Pin
Function
Arduino
1
GND
GND
2
VCC
VCC
3
Contrast in (wiper of 10k contrast pot)
external
4
D_I (Data/Instruction a.k.a. RS)
analog 3 (digital 17)
5
R_W (Read/Write)
analog 2 (digital 16)
6
EN (Enable)
analog 4 (digital 18)
7
D0
digital 8
8
D1
digital 9
9
D2
digital 10
10
D3
digital 11
11
D4
digital 4
12
D5
digital 5
13
D6
digital 6
14
D7
digital 7
15
CSEL1 (chip 1 select)
analog 0 (digital 14)
16
CSEL2 (chip 2 select)
analog 1 (digital 15)
17
RESET (leave open or connect to VCC)
external
18
Contrast out (10k contrast pot)
external
19
Backlight VCC (100-330 Ω resistor to VCC)
external
20
Backlight GND
GND