FTP (``File Transfer Protocol'') - Protokol Peredachi Fajlov,
eto mnozhestvo programm, ispol'zuemyh dlya peredachi fajlov mezhdu
sistemami v Internet. Bol'shinstvo sistem UNIX, VMS i MS-DOS v
Internet imeyut programmu, nazyvaemuyu ftp, kotoraya ispol'zuetsya
dlya peredachi etih fajlov i, esli u vas est' vyhod v Internet,
luchshij sposob skachat' programmy dlya Linux, eto s pomoshch'yu ftp
. |to
prilozhenie rassmatrivaet osnovy ispol'zovaniya ftp
. Razumeetsya,
ftp
imeet znachitel'no bol'she funkcional'nyh vozmozhnostej, chem
rassmotreno zdes'.
V konce etogo prilozheniya dan spisok FTP-serverov, gde mozhno
najti programmy dlya Linux. Krome togo, esli u vas net pryamogo
vyhoda v Internet, no vy mozhete obmenivat'sya s Internet
elektronnoj pochtoj, to nizhe privoditsya i informaciya po
ispol'zovaniyu servisa ftpmail
.
Esli vy ispol'zuete sistemy MS-DOS, UNIX ili VMS dlya
skachivaniya fajlov iz Internet, to dlya vas ftp - eto programma,
upravlyaemaya komandami. V to vremya kak v drugih realizaciyah ftp,
takih kak versiya dlya Macintosh (nazyvaemaya Fetch), imeyutsya dlya
etogo chudesnye menyu, kotorye samoponyatny. Dazhe esli vy ne
ispol'zuete komandno-upravlyaemoe ftp
, informaciya, privodimaya
zdes', vse ravno mozhet byt' poleznoj.
ftp mozhno ispol'zovat' kak dlya posylki fajlov (upload), tak
i dlya ih polucheniya (download) s drugih uzlov (sites) Internet.
V bol'shinstve sluchaev vy vse-taki budete skachivat'
programmy. V Internet bol'shoe kolichestvo obshchedostupnyh arhivnyh
FTP-serverov, t.e. mashin, pozvolyayushchih lyubomu vojti na nih po ftp
i skachat' svobodnorasprostranyaemoe (free)
sunsite.unc.edu
, kotoryj sostoit iz mnozhestva
Sanov (Sun Microsystems), rabotaet kak (edinyj) odin iz samyh
moshchnyh serverov Linux. Krome togo, arhivnye FTP-servera
osushchestvlyayut "zerkal'noe" otobrazhenie drug na druga, to est',
razmeshchennoe na odnom servere, avtomaticheski kopiruetsya na ryad
drugih serverov. tak chto ne udivlyajtes', esli uvidite odin i tot
zhe fajl na mnogih razlichnyh arhivnyh serverah.
Obratite vnimanie na to, chto v "ekranah", privodimyh nizhe, ya lish' pokazyvayu naibolee sushchestvennuyu informaciyu, tak chto to, chto vy mozhete uvidet' na real'nom ekrane, mozhet otlichat'sya.
Dlya zapuska ftp
i ustanovleniya svyazi s serverom prosto
ispol'zujte komandu
ftp <hostname>
gde <hostname>
- imya servera, s kotorym vy svyazyvaetes'.
Naprimer, dlya svyazi s mificheskim serverom shoop.vpizza.com
mozhno
ispol'zovat' komandu
ftp shoop.vpizza.com
Kogda zapuskaetsya ftp
, my mozhem uvidet' chto-to vrode
Connected to shoop.vpizza.com.
220 Shoop.vpizza.com FTPD ready at 15 Dec 1992 08:20:42 EDT
Name (shoop.vpizza.com:mdw):
Zdes' ftp
prosit nas vvesti imya (Name) pol'zovatelya, pod
kotorym my hotim vojti na server shoop.vpizza.com
. Po umolchaniyu
zdes' "mdw
", chto sluzhit moim imenem pol'zovatelya dlya FTP-vhoda.
Poskol'ku u menya net account
shoop.vpizza.com
, ya ne mogu vojti pod svoim
imenem. Vmesto etogo, chtoby vojti na obshchedostupnyj FTP-server vy
vhodite kak anonymous
(anonim) i soobshchaete svoj adres e-mail
(esli on u vas est') v kachestve parolya. To est' nam sleduet
vvesti
Name (shoop.vpizza.com:mdw): anonymous
331-Guest login ok, send e-mail address as password.
Password: mdw@sunsite.unc.edu
230- Welcome to shoop.vpizza.com.
230- Virtual Pizza Delivery[tm]: Download pizza in 30 cycles
or less
230- or you get it FREE!
ftp>
Razumeetsya, vam sleduet soobshchat' svoj e-mail adres vmesto
moego, on ne budet otobrazhat'sya na ekrane pri vashem vvode
(poskol'ku on vvoditsya pod "vyveskoj" parolya). ftp
dolzhen
pozvolit' nam vojti i my budem imet' vozmozhnost' skachivat'
programmy.
O'kej, my voshli. ftp>
- eto nasha podskazka, teper' programma
ftp
zhdet vvoda komand.
Est' neskol'ko osnovnyh komand, kotorye vam nado znat'.
Prezhde vsego, komandy
ls <file>
i
dir <file>
obe dayut spisok fajlov (gde <file>
- neobyazatel'nyj
argument, ukazyvayushchij, kakoj spisok vyvesti). Raznica v tom, chto
ls
obychno vydaet korotkij spisok, a dir
- dlinnyj (to est' s
bol'shej informaciej otnositel'no razmera fajlov, daty modifikacii
i t.p.). Komanda
cd <directory>
peremestit "vas" v ukazannyj katalog (tochno takzhe, kak
komanda cd
v UNIX ili MS-DOS). Vy mozhete ispol'zovat' komandu
cdup
dlya perehoda v roditel'skij (nahodyashchijsya vyshe) katalog
Komanda
help <command>
dast vam podskazku po ukazannoj komande ftp
(takoj kak ls
ili cd
). Esli komanda ne ukazana, ftp
vydast spisok vseh
dostupnyh komand. Esli my vvedem teper' dir
, my uvidim
nachal'nyj katalog nashego mestonahozhdeniya.
ftp> dir
200 PORT command successful.
150 Opening ASCII mode data connection for /bin/ls.
total 1337
dr-xr-xr-x 2 root wheel 512 Aug 13 13:55 bin
drwxr-xr-x 2 root wheel 512 Aug 13 13:58 dev
drwxr-xr-x 2 root wheel 512 Jan 25 17:35 etc
drwxr-xr-x 19 root wheel 1024 Jan 27 21:39 pub
drwxrwx-wx 4 root ftp-admi 1024 Feb 6 22:10 uploads
drwxr-xr-x 3 root wheel 512 Mar 11 1992 usr
226 Transfer complete.
921 bytes received in 0.24 seconds (3.7 Kbytes/s)
ftp>
Kazhdaya iz etih strok predstavlyaet katalog, a ne otdel'nyj
fajl, kotoryj my mozhem skachat' (na eto ukazyvaet simvol "d
" v
pervoj pozicii spiska). Na bol'shinstve arhivnyh FTP-serverov
obshchedostupnye programmy nahodyatsya pod katalogom /pub
, tak
chto davajte tuda i pojdem.
ftp> cd pub
ftp> dir
200 PORT command successful.
150 ASCII data connection for /bin/ls (128.84.181.1,4525) (0
bytes).
total 846
-rw-r--r-- 1 root staff 1433 Jul 12 1988 README
-r--r--r-- 1 3807 staff 15586 May 13 1991 US-DOMAIN.TXT.2
-rw-r--r-- 1 539 staff 52664 Feb 20 1991 altenergy.avail
-r--r--r-- 1 65534 65534 56456 Dec 17 1990 ataxx.tar.Z
-rw-r--r-- 1 root other 2013041 Jul 3 1991 gesyps.tar.Z
-rw-r--r-- 1 432 staff 41831 Jan 30 1989 gnexe.arc
-rw-rw-rw- 1 615 staff 50315 Apr 16 1992 linpack.tar.Z
-r--r--r-- 1 root wheel 12168 Dec 25 1990 localtime.o
-rw-r--r-- 1 root staff 7035 Aug 27 1986 manualslist.tblms
drwxr-xr-x 2 2195 staff 512 Mar 10 00:48 mdw
-rw-r--r-- 1 root staff 5593 Jul 19 1988 t.out.h
226 ASCII Transfer complete.
2443 bytes received in 0.35 seconds (6.8 Kbytes/s)
ftp>
Zdes' my mozhem videt' ryad (interesnyh?) fajlov, odin iz
kotoryh nazyvaetsya README
, kotoryj nam sleduet skachat'
(bol'shinstvo FTP-serverov imeet fajl README
v kataloge /pub).
Pered skachivaniem fajlov sleduet obratit' vnimanie na
Vklyuchenie hesh-metok osushchestvlyaetsya komandoj
ftp> hash
Hash mark printing on (8192 bytes/hash mark).
ftp>
README
).
Pochemu tip fajla imeet znachenie? Tol'ko potomu, chto na nekotoryh sistemah (takih, kak MS-DOS), opredelennye simvoly tekstovogo fajla, vrode vozvrata karetki, dolzhny byt' preobrazovany tak, chtoby fajl byl chitaem. A pri peredache binarnyh fajlov nikakih preobrazovanij ne osushchestvlyaetsya - fajl prosto peredaetsya bajt za bajtom.
Komandy bin
i ascii
ispol'zuyutsya dlya perevoda sootvetstvenno
v binarnyj rezhim peredachi fajlov i tekstovyj sootvetstvenno.
Esli voznikayut somneniya - ispol'zujte binarnyj rezhim. Esli
vy popytaetes' peredat' binarnyj fajl v tekstovom rezhime,
fajl budet isporchen pri peredache do polnoj bespoleznosti.
(|to odna iz populyarnejshih oshibok na nachal'nyh etapah
ispol'zovaniya FTP). No razumeetsya, vy mozhete ispol'zovat'
tekstovyj rezhim dlya peredachi normal'nyh tekstovyh fajlov
(ch'i imena chasto zakanchivayutsya na .txt
).
Naprimer, my skachivaem fajl README kotoryj, skoree vsego, tekstovyj tak chto my ispol'zuem komandu
ftp> ascii
200 Type set to A.
ftp>
lcd
menyaet mestnyj (l-local)
katalog.
Naprimer, chtoby ustanovit' mestnyj katalog
/home/db/mdw/tmp
, ispol'zujte komandu
ftp> lcd /home/db/mdw/tmp
Local directory now /home/db/mdw/tmp
ftp>
Teper' vy dejstvitel'no gotovy skachivat' fajly. Komanda
get <remote-name> <local-name>
ispol'zuetsya imenno dlya etogo, gde <remote-name>
imya fajla
na udalennoj mashine, a <local-name>
- imya, kotoroe vy hotite dat'
fajlu na vashej mashine. <local-name>
- neobyazatel'nyj argument; po
umolchaniyu imya mestnogo fajla to zhe, chto i u skachivaemogo fajla.
No, esli naprimer vy skachivaete fajl README
, i u vas uzhe est'
fajl s imenem README
v etom kataloge, vam
sleduet dat' drugoe imya dlya <local-filename>
, chtoby ne zateret'
sushchestvuyushchij. Naprimer, dlya skachivaniya fajla README
my prosto
ispol'zuem
ftp> get README
200 PORT command successful.
150 ASCII data connection for README (128.84.181.1,4527) (1433
bytes).
#
226 ASCII Transfer complete.
local: README remote: README
1493 bytes received in 0.03 seconds (49 Kbytes/s)
ftp>
Dlya prekrashcheniya FTP-sessii prosto ispol'zujte komandu
quit
Komanda
close
mozhet ispol'zovat'sya dlya zakrytiya svyazi s dannym
FTP-serverom; komanda open
mozhet byt' posle etogo ispol'zovana
dlya nachala sessii s drugim serverom (bez vyhoda iz programmy
FTP).
ftp> close
221 Goodbye.
ftp> quit
ftpmail
- eto servis, kotoryj pozvolyaet poluchit' fajly iz
FTP-arhiva cherez elektronnuyu pochtu Internet. Esli u vas net
pryamogo vyhoda na Internet, no est' vozmozhnost' posylat' pis'ma v
Internet (naprimer, iz CompuServe), ftpmail - eto horoshij sposob
poluchit' fajly iz arhivov FTP-serverov. K sozhaleniyu, ftpmail
mozhet byt' medlennym, osobenno pri peresylke bol'shih ob'emov.
Pered popytkoj skachat' bol'shoe chislo programm s ispol'zovaniem
ftpmail
, ubedites', chto oblast' spullinga vashej mail budet
sposobna spravit'sya s takimi ob'emami vhodnogo trafika. Vo mnogih
sistemah est' ogranicheniya na ob'em prihodyashchej elektronnoj pochty
sunsite.unc.edu
- odin iz glavnyh arhivnyh Linux
FTP-serverov, imeet takzhe ftpmail
-server. Dlya togo, chtoby
vospol'zovat'sya etim servisom, poshlite pis'mo po adresu:
ftpmail@sunsite.unc.edu
A v pis'me tol'ko odno slovo
help
V rezul'tate vy poluchite v otvet spisok komand ftpmail
i
kratkuyu instrukciyu po pol'zovaniyu sistemoj.
Naprimer, dlya polucheniya spiska fajlov sunsite.unc.edu, poshlite pis'mo po vysheukazannomu adresu so sleduyushchim tekstom:
open sunsite.unc.edu
cd /pub/Linux
dir
quit
Vy mozhete ispol'zovat' ftpmail
dlya svyazi s arhivom
FTP-servera; i eto ne ogranichivaetsya lish' sunsite.unc.edu
. V
sleduyushchem razdele privoditsya spisok Linux FTP-arhivov.
Tablica C.1 - eto spisok naibolee izvestnyh arhivnyh FTP-serverov, kotorye hranyat pakety programm dlya Linux. Imejte v vidu, chto mnogie drugie servera imeyut zerkal'nye otobrazheniya mnogih iz etih arhivov, tak chto skoree vsego vy najdete nuzhnoe vam na serverah, otsutstvuyushchih v etom spiske.
tsx-11.mit.edu
, sunsite.unc.edu
i nic.funet.fi
- eto "dom
rodnoj" dlya Linux, gde vy mozhete najti bol'shinstvo novyh
programm. Bol'shinstvo drugih serverov iz spiska zerkal'no
otobrazhayut nekotoruyu kombinaciyu iz etih treh. Dlya umen'sheniya
setevogo trafika vybirajte server, kotoryj blizhe k vam
geograficheski.
Imya servera IP adres Katalog
tsx-11.mit.edu 18.172.1.2 /pub/linux
sunsite.unc.edu 152.2.22.81 /pub/Linux
nic.funet.fi 128.214.6.100 /pub/OS/Linux
ftp.mcc.ac.uk 130.88.200.7 /pub/linux
fgb1.fgb.mw.tu-muenchen.de 129.187.200.1 /pub/linux
ftp.informatik.tu-muenchen.de 131.159.0.110 /pub/Linux
ftp.dfv.rwth-aachen.de 137.226.4.105 /pub/linux
ftp.informatik.rwth-aachen.de 137.226.112.172 /pub/Linux
ftp.ibp.fr 132.227.60.2 /pub/linux
kirk.bu.oz.au 131.244.1.1 /pub/OS/Linux
ftp.uu.net 137.39.1.9 /systems/unix/linux
wuarchive.wustl.edu 128.252.135.4 /systems/linux
ftp.win.tue.nl 131.155.70.100 /pub/linux
ftp.ibr.cs.tu-bs.de 134.169.34.15 /pub/os/linux
ftp.denet.dk 129.142.6.74 /pub/OS/linux
Tablica C.1: FTP-servery Linux
Soderzhimoe etoj glavy, Glavnoe oglavlenie
Nachalo dokumenta, Nachalo etoj glavy