Cov txheej txheem:

Ua Koj Tus Pi (Hauv Zos) Huab Server!: 19 Cov Kauj Ruam (nrog Duab)
Ua Koj Tus Pi (Hauv Zos) Huab Server!: 19 Cov Kauj Ruam (nrog Duab)

Video: Ua Koj Tus Pi (Hauv Zos) Huab Server!: 19 Cov Kauj Ruam (nrog Duab)

Video: Ua Koj Tus Pi (Hauv Zos) Huab Server!: 19 Cov Kauj Ruam (nrog Duab)
Video: " Mam yog koj tus phib laj " { pob tsuas xyooj } thaij tiav lawm nawb ( 2020 ) 2024, Hlis ntuj nqeg
Anonim
Ua rau koj Pi ib (Local) Cloud Server!
Ua rau koj Pi ib (Local) Cloud Server!

Txuag thiab nkag mus docs thiab duab thiab nkauj ntawm koj tus kheej Pi Cloud server! Qhov zoo tshaj plaws: koj tuaj yeem siv nws yog, lossis thaum twg, Is Taws Nem poob qis (lossis yog tias koj nyob hauv qhov chaw deb & xav tau nkag mus rau Wikipedia). Huag hav, thiab yog tias koj tus phooj ywg tau txais ib qho thiab lawv nyob ze (*ahem*80ft*ahem*), koj tuaj yeem faib cov khoom nrog lawv thiab ua koj tus kheej txoj kab sib tham!

Qhov ntawd ua rau kuv xav.. yog tias cov neeg txaus tsim Pi Cloud servers, peb tuaj yeem ua neeg coob coob hauv Is Taws Nem! Qhov ntawd yuav yog 11/10 ntawm qhov ntsuas ntawm qhov zoo. Nrog cov qauv tshiab ntawm Raspberry Pi lub khoos phis tawj, nws ua tau thiab tsis kim li! (Dab tsi! Qhia kuv ntxiv!)

Phau ntawv qhia no yuav qhia koj yuav teeb tsa luv-ntau (~ 80 ft) WiFi Access Point thiab tus kheej lub vev xaib ('coj nws rov mus rau HTML bbies). Koj tuaj yeem teeb tsa qhov no ua (kaw) lub network hauv zos nkaus xwb (piv txwv li koj tus kheej "huab" cov cuab yeej thaub qab), lossis tshaj tawm nws mus rau lwm lub ntiaj teb! (.. yog tias koj ua qhov no nco ntsoov tias koj paub kev ruaj ntseg network.)

Qhov ntawd tau hais tias, piv txwv tias koj muaj kev paub yooj yim ntawm Pi, ntawm no yog qhov tawg:

Lub Sijhawm Nyeem Ntawv: ~ 40 feeb

Tsim Sijhawm: ~ 60 feeb (tsawg dua yog tias koj tau ntsib nrog w/ Linux)

Nqi: ~ $ 35 (rau Pi 3)

Yog tias koj xav pab txhawm rau pib ua rau tib neeg siv Internet, faib nws nrog koj cov phooj ywg & tsev neeg & txhua tus neeg koj paub (lossis tsim nws rau lawv!). Yog tias koj tsim txoj haujlwm no thov cim tias koj tau tsim nws lawm peb tuaj yeem nkag siab tias muaj pes tsawg tus neeg muaj cov txheej txheem tsim kho peb xav tau tiag tiag los ua kom muaj neeg puv Internet. Thaum kawg, ua raws kuv kom hloov kho tshiab (Kuv tab tom ncav tes rau qee tus neeg kom sim ua qhov no los ua qhov tseeb, thov koj xav tiv tauj kuv yog tias koj tuaj yeem pab thiab/lossis ua qhov no, nws yog qhib qhov chaw!).

Kauj ruam 1: Tshiab rau Linux & Terminal Programming?

Tshiab rau Linux & Terminal Programming?
Tshiab rau Linux & Terminal Programming?

Peb yuav tsum muaj peev xwm nkag mus rau peb Pi nyob deb (piv txwv li ntawm SSH). Yog tias koj zoo li "wtf yog qhov ntawd", txheeb xyuas qhov kev qhia no qhia kom ntxaws ntxaws txog yuav teeb tsa Raspberry Pi 3 thiab qee qhov nrawm Linux davhlau ya nyob twg.

Txoj hauv kev no mus rau Pi Access Point* thiab web server ** siv Jessie Lite OS. Yog tias koj ua raws cov ntawv qhia no ib-kab-kab, koj yuav xav tau qhov tshwj xeeb ntawm Linux

Thaum kawg, qhov kev qhia no tau tsim tawm ntawm Adafruit Digital Free Library qhia, yog li tshawb xyuas qhov kev qhia no yog tias koj ua rau muaj teeb meem (lossis tawm lus tawm tswv yim thiab kuv tus kheej lossis lwm tus neeg muaj txiaj ntsig zoo yuav sim teb koj cov lus nug:))

(Tsis tas li, qhov no yuav zoo li ntev me ntsis, yog li kuv tau suav nrog ntau yam duab menyuam dev ntxim hlub thoob plaws kom ua rau koj mob siab: D)

*Qhov Chaw Nkag Nkag yog cov cuab yeej khoos phis tawj uas tso cai rau WiFi lub cuab yeej (piv txwv li lub xov tooj smartphone) txuas rau lub network txuas (piv txwv li router).

** Lub web server yog lub khoos phis tawj uas muab lub vev xaib. Thaum koj mus rau koj lub vev xaib uas koj nyiam, koj ntaus hauv "www.wikipedia.org" uas coj koj mus rau tus IP chaw nyob rau lub vev xaib thiab qhia cov ntaub ntawv rau pej xeem.

Lus ceeb toom: nws raug pom zoo kom khiav koj Pi raws li lub network hauv ib cheeb tsam nkaus xwb (piv txwv li tsis txuas tus Pi mus rau Lub Ntiaj Teb Thoob Ntiaj Teb) raws li nws WPA2 tus password txheej txheem yuav tsis muaj kev nyab xeeb.

Kauj ruam 2: Cov ntaub ntawv

Khoom siv
Khoom siv

Khoos phis tawj nrog Ethernet chaw nres nkoj & SD Card qhov

Raspberry Pi 3

- SD Card (8GB lossis loj dua, tshwj xeeb yog koj xav siv nws rau kev khaws cia)

MicroUSB rau USB fais fab qaum

Ethernet Cable

- Pom zoo: Raspberry Pi Case

Kauj Ruam 3: Cov Txheej Txheem Software

Cov Kev Pabcuam Software
Cov Kev Pabcuam Software

1. PuTTY tso cai rau peb nkag mus rau hauv Raspberry Pi nyob deb siv lub Pi tus IP chaw nyob, lub npe siv, thiab tus password.

Rub tawm ntawm no:

2. Etcher tawm tswv yim thiab sau Raspbian (lossis lwm yam) Operating System (“OS”) rau SD daim npav.

Rub tawm ntawm no:

3. WinSCP tso cai rau xa cov ntaub ntawv yooj yim ntawm koj lub khoos phis tawj thiab Raspberry Pi.

Rub tawm ntawm no (nyem rau pob teeb tsa):

4. Lub khoos phis tawj Windows yuav xav tau Bonjour luam cov kev pabcuam rau Windows (los ntawm Apple) siv "raspberrypi.local" IP chaw nyob.

Rub tawm ntawm no:

Kauj ruam 4: Quickstart

Quickstart
Quickstart

Yog tias koj tau ua haujlwm nrog Pi ua ntej thiab xis nyob nrog w/ Linux davhlau ya nyob twg thiab zoo li no, ntawm no yog qhov txheej txheem sai ntawm cov txheej txheem no:

1. Rub Jessie Lite mus rau daim npav SD (8GB lossis ntau dua) thiab ntxig rau hauv Pi.

Rub tawm Jessie Lite OS ntawm no.

2. Nkag mus nyob deb (piv txwv li SSH) thiab sau cov ntaub ntawv pov thawj.

3. Nov yog Github chaw cia khoom nrog txhua cov lus txib kom tig koj Pi mus rau hauv lub vev xaib: D

Mus los ntawm teeb tsa cov ntawv thiab nkag mus rau cov lus txib (hauv kev txiav txim). Cov txheej txheem no yuav teeb tsa HostAPD (kev txheeb xyuas qhov tseeb), DHCP (IP tswj), iptables (firewall), thiab Apache (web server software).

4. Tsim ib nplooj ntawv web pej xeem lossis khaws koj cov ntaub ntawv/cov ntaub ntawv ntiag tug/w/phooj ywg & tsev neeg

Ib qho piv txwv HTML web nplooj ntawv hloov pauv los ntawm Adafruit Digital Free Library tutorial tau suav nrog hauv Github chaw cia khoom (ServerWebsiteHTML-Raw). Koj tseem tuaj yeem siv cov ntawv zip loj los tsim tawm ntawm:)

Lus ceeb toom: nws raug pom zoo kom khiav koj Pi raws li lub network hauv ib cheeb tsam nkaus xwb (piv txwv li tsis txuas tus Pi mus rau Lub Ntiaj Teb Thoob Ntiaj Teb) raws li WPA2 tus password txheej txheem yuav tsis muaj kev nyab xeeb.

Kauj Ruam 5: Teeb Raspberry Pi

Teem Raspberry Pi
Teem Raspberry Pi
Teem Raspberry Pi
Teem Raspberry Pi
Teem Raspberry Pi
Teem Raspberry Pi
Teem Raspberry Pi
Teem Raspberry Pi

1. Nyem daim npav SD nrog Jessie Lite (rub Jessie Lite ntawm no). Pab kom SSHby ntxiv cov ntaub ntawv hu ua "SSH" hauv SD daim ntawv cov ntsiab lus (tsis muaj txuas ntxiv - tshem tawm. Txt yog tias muaj ntxiv ntxiv). Ntxig rau hauv Pi.

2. Txuas lub Ethernet cable ntawm koj lub computer thiab Pi, tom qab ntawd ntsaws lub Pi fais fab cable

3. Tsim tus choj sib txuas ntawm koj lub computer thiab Pi

Mus rau Chaw -> Network & Internet -> Hloov Chaw Teeb. Xaiv Ethernet kev sib txuas (yuav tsum qhia pom kev sib txuas tsis paub lossis qee yam zoo sib xws). Tuav tus yuam sij "CTRL", thiab tom qab ntawd xaiv WiFi txuas. Right -click thiab xaiv "Bridge Connections."

3. Qhib PuTTY, ntaus "raspberrypi.local" rau lub hostname, thiab nkag mus rau hauv koj Pi, woo

Yog tias koj nkag mus thawj zaug, siv lub npe siv tsis raug: pi thiab password: raspberry. Hloov koj tus password siv qhov hais kom ua passwd

4. Txheeb xyuas tias Pi tau txuas nrog Is Taws Nem thiab hloov kho nws

Khiav qhov lus txib no txhawm rau txheeb xyuas yog tias Pi tuaj yeem txuas rau Google (nws yuav luam 5 kab hais nws yog tias tau txais cov ntaub ntawv los ntawm google.com):

ping -c 5 google.com

Khiav qhov lus txib no kom hloov kho Pi (thawj qhov rub tawm pob, thib ob teeb tsa 'em):

sudo apt-tau hloov tshiab

sudo apt-tau hloov tshiab

Kauj ruam 6: Nruab Apache

Nruab Apache!
Nruab Apache!
Nruab Apache!
Nruab Apache!

Apache yog peb lub web server software! (Nws tso cai rau peb kom yooj yim tuav cov ntaub ntawv thiab cov ntaub ntawv siv tau los ntawm lub vev xaib zoo li Chrome, Firefox, Explorer, thiab lwm yam)

Cia peb nruab Apache software thiab tom qab ntawd hloov kev tso cai los kho HTML ntawv. Ntaus thiab sau cov lus txib hauv qab no (hauv kev txiav txim):

sudo apt -tau nruab apache2 -y

cd /ua /www

sudo chown pi: pi/var/www/html

ua cd

Kauj ruam 7: Nruab Server Software

Nruab Server Software!
Nruab Server Software!

1. Install HostAPDand DHCP software.

HostAPD yog siv los txheeb xyuas cov ntaub ntawv xa thiab tau txais los ntawm cov khoom siv sib txuas, thiab DHCP yog cov txheej txheem siv los muab kev nrawm, tsis siv neeg, thiab kev tswj hwm hauv nruab nrab rau kev faib IP chaw nyob hauv ib lub network.

Txhawm rau nruab ob qho tib si ib zaug, ntaus cov lus txib hauv qab no thiab tom qab ntawd nias "y" txuas ntxiv mus:

sudo apt-tau nruab hostapd isc-dhcp-server

2. Nruab iptables rau firewall. (yayy rau kev ruaj ntseg!)

Khiav qhov lus txib no thiab ntaus "y" (yog) rau ob qho tib si ntawm cov ntxaij vab tshaus teeb tsa uas tshwm tuaj:

sudo apt-tau nruab iptables-persistent

Kauj Ruam 8: Hloov kho DHCP Configuration File

Kho qhov DHCP Configuration File
Kho qhov DHCP Configuration File
Kho qhov DHCP Configuration File
Kho qhov DHCP Configuration File

Cia peb teeb tsa DHCP cov txheej txheem kev sib txuas lus yog li peb tuaj yeem xa thiab tau txais cov ntaub ntawv (tseem ceeb heev yog tias koj xav tsim lub network txuas nrog)! Mus rau DHCP cov ntaub ntawv teeb tsa los ntawm kev ntaus cov hauv qab no:

sudo nano /etc/dhcp/dhcpd.conf

1. Ntxiv cov lus pom ("#") ua ntej ntawm kab hauv qab no (yog li nws zoo li cov ntawv hauv Duab 1):

xaiv sau npe-npe “example.org”;

xaiv sau npe-npe-servers ns1.example.org, ns2.example.org;

2. Tshem tawm cov lus pom ("#" ') los ntawm kab "muaj ntawv pov thawj" (Daim duab 1 kuj tseem pab tau ntawm no):

#Yog tias DHCP server no yog lub DHCP server rau lub network hauv zej zog, cov lus pom zoo tso cai yuav tsum tsis suav nrog.

#tso cai;

3. Ntxiv cov cai no mus rau qhov kawg ntawm cov ntawv (saib daim duab 2):

subnet 192.168.42.0 netmask 255.255.255.0 {

range 192.168.42.10 192.168.42.50 xaiv kev tshaj tawm-chaw nyob 192.168.42.255; xaiv routers 192.168.42.1; default-xauj-sijhawm 600; xaum xaum xaum 7200; xaiv sau npe-npe “hauv zos”; xaiv sau npe-npe-servers 8.8.8.8, 8.8.4.4; }

Qhov no ua dab tsi?! Txhawm rau (piav qhia luv luv), nws teeb tsa ntau qhov IP chaw nyob los muab rau cov khoom siv sib txuas (los ntawm 192.168.42.10 txog 192.168.42.50), ib yam li koj lub tsev router! Nws tseem qhia Pi li cas sib txuas lus rau lwm yam khoom siv (nws qhov chaw nyob tshaj tawm, 192.168.42.255, thiab nws tus kheej tus IP chaw nyob, 192.168.42.1). Nws muab sijhawm ntau (hauv vib nas this) los qhia qhov kev sib txuas no (lub sijhawm xauj), thiab teeb tsa cov npe servers (zoo li saib tus lej xov tooj hauv cov npe).

4. Txuag thiab tawm los ntawm nias "Ctrl - X" thiab tom qab ntawd "y" (thiab tom qab ntawv nkag mus)

Kauj ruam 9: Kho qhov Default DHCP Server File

Kho qhov Default DHCP Server File
Kho qhov Default DHCP Server File
Kho qhov Default DHCP Server File
Kho qhov Default DHCP Server File

Cia peb hloov kho DHCP server cov ntaub ntawv kom peb tuaj yeem muab nws tshaj tawm ntawm WiFi! Mus rau DHCP default server file los ntawm kev ntaus cov hauv qab no:

sudo nano/etc/default/isc-dhcp-neeg rau zaub mov

1. Nqes mus rau kab uas hais tias INTERFACES =”” thiab hloov nws mus tshaj tawm ntawm wlan0 (uas yog xoom, tsis yog O):

INTERFACES = "wlan0"

2. Txuag thiab tawm los ntawm nias "Ctrl - X" thiab tom qab ntawd "y" (tej zaum koj yuav xav tias qhov no tawm qhov tseem ceeb ua ke los ntawm tam sim no yog li kuv mam li tsis hais txog nws:)).

Kauj Ruam 10: Teeb IP Static IP Address

Teem Ib Qhov Chaw Nyob IP
Teem Ib Qhov Chaw Nyob IP
Teem Ib Qhov Chaw Nyob IP
Teem Ib Qhov Chaw Nyob IP

1. Cia peb muab Pi li qub (tsis hloov pauv) IP chaw nyob kom peb ib txwm tuaj yeem pom nws, yog! Ib ntus ua haujlwm tsis txuas lub wireless interface network:

sudo ifdown wlan0

2. Siv nano phau ntawv kho qhov program txhawm rau kho cov ntaub ntawv cuam tshuam rau lub network (uas koj yuav pom los ntawm kev nyeem cov lus txib (:)

sudo nano/etc/network/interfaces

3. Kho cov ntawv kom nws zoo nkaus li cov hauv qab no, tom qab ntawd tawm & txuag (tseem txheeb xyuas Daim Duab 1):

auto hlo

iface lo inet loopback iface eth0 inet dhcp

pub-hotplug wlan0

iface wlan0 inet zoo li qub

chaw nyob 192.168.42.1 netmask 255.255.255.0

#iface wlan0 inet phau ntawv qhia

#wpa-roam /etc/wpa-supplicant/wpa_supplicant.conf #iface default inet dhcp

4. Muab tus IP zoo li qub:

sudo ifconfig wlan0 192.168.42.1

Kauj Ruam 11: Txhim Kho Cov Lus Qhia Taw Qhia

Kho qhov Access Point Details
Kho qhov Access Point Details
Kho qhov Access Point Details
Kho qhov Access Point Details
Kho qhov Access Point Details
Kho qhov Access Point Details

1. Tsim cov ntaub ntawv teeb tsa tshiab hu ua "hostapd":

sudo nano /etc/hostapd/hostapd.conf

2. Sau cov hauv qab no (raws nraim li yog) hauv daim ntawv teeb tsa tshiab no (tom qab tawm & txuag) (Duab 1):

interface = wlan0

ssid = HelloWorld #Name ntawm koj li RPi WiFi kev sib txuas country_code = US #Unless koj nyob lwm qhov! hw_mode = g channel = 6 macaddr_acl = 0 auth_algs = 1 ignore_broadcast_ssid = 0 wpa = 2 #This yog tus password lo lus zais wpa_passphrase = raspberry #Hloov tus password! wpa_key_mgmt = WPA-PSK wpa_pairwise = CCMP wpa_group_rekey = 86400 ieee80211n = 1 wme_enabled = 1

3. Qhia rau HostAPD raws tu qauv qhov twg thiaj nrhiav tau cov ntaub ntawv tshiab no

Kho kom raug Default HostAPD cov ntaub ntawv:

sudo nano/etc/default/hostapd

Nrhiav kab uas hais tias #DAEMON_CONF = "". Tshem tawm cov lus pom thiab kho kom nws zoo li qhov no (Duab 2):

DAEMON_CONF =”/etc/hostapd/hostapd.conf”

Kho kom raug HostAPD initialization file:

sudo nano /etc/init.d/hostapd

Nrhiav kab uas hais tias DAEMON_CONF =. Kho kom raug nws kom nws taw tes rau koj cov ntaub ntawv teeb tsa tshiab! Zoo li no (Duab 3):

DAEMON_CONF =/etc/hostapd/hostapd.conf

Kauj Ruam 12: Kho Kho Network Chaw Txhais Lus ("NAT")

Kho Network Qhov Chaw Txhais Lus Txhais
Kho Network Qhov Chaw Txhais Lus Txhais
Kho Network Qhov Chaw Txhais Lus Txhais
Kho Network Qhov Chaw Txhais Lus Txhais

Cov kauj ruam no tso cai rau ntau tus neeg siv khoom (zoo li txhua tus phooj ywg!) Txuas rau Pi's WiFi ib zaug (ua si txhua qhov kev ua si !!). Nws yog qhov txuj ci me ntsis, yog li kuv yuav ua kom ci ntsa iab dua (tseem tsis paub zoo heev nrog ntu no), tab sis nws yuav ua rau koj hla cov txheej txheem.

1. Ua ntej, peb yuav tsum pib IP xa mus txhua lub sijhawm Pi qhib. Nkag mus rau cov lus txib hauv qab no txhawm rau kho cov sysctl* cov ntawv teeb tsa:

sudo nano /etc/sysctl.conf

- Scroll rau hauv qab thiab ntaus cov cai no ntawm kab tshiab, tom qab ntawd tawm & txuag:

net.ipv4.ip_forward = 1

*btw uas yog L hauv sysctl, tsis yog 1, uas kuv tau messed li ntau zaus -.-

2. Qhib IP xa mus los ntawm kev ntaus ntawv:

sudo sh -c "ncha 1>/proc/sys/net/ipv4/ip_forward"

3. Tsim kev txhais lus sib txuas ntawm Ethernet chaw nres nkoj eth0 thiab WiFI chaw nres nkoj wlan0 los ntawm kev ntaus cov lus txib hauv qab no (w/ - cov cim thiab lub kaus mom thiab lwm yam):

sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

sudo iptables -A FORWARD -i eth0 -o wlan0 -m xeev -xeev RELATED, ESTABLISHED -j ACCEPT

sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT

4. Kom ntseeg tau tias kev txhais lus network tshwm sim thaum peb rov pib Pi, khiav qhov no:

sudo sh -c "iptables -save> /etc/iptables/rules.v4"

Kauj Ruam 13: Xeem Qhov Nkag Nkag Nkag

Xeem Qhov Nkag Nkag Nkag!
Xeem Qhov Nkag Nkag Nkag!
Xeem Qhov Nkag Nkag Nkag!
Xeem Qhov Nkag Nkag Nkag!

1. Khiav hostapd nrog peb cov ntaub ntawv teeb tsa tus kheej nrog cov lus txib no:

sudo/usr/sbin/hostapd /etc/hostapd/hostapd.conf

2. Txheeb xyuas cov npe WiFi ntawm koj lub khoos phis tawj lossis lub xov tooj ntawm tes thiab nrhiav koj qhov chaw nkag tshiab SSID! Yog tias koj tsis hloov dab tsi, nws yuav raug hu ua "HelloWorld" nrog tus password "Raspberry".

Yog tias koj txuas tau zoo, koj yuav tau txais qee cov ntawv ntawm Raspberry Pi screen. Peb yuav tsis pom ntau ntau, tab sis peb nyob ze heev!

3. Tshem qhov kev sim los ntawm kev ntaus "Ctrl+C" hauv Raspberry Pi console

Koj tuaj yeem tshawb xyuas qhov xwm txheej ntawm tus tswv AP server thiab DHCP server nrog cov lus txib hauv qab no:

sudo kev pabcuam hostapd xwm txheej

sudo kev pabcuam isc-dhcp-server xwm txheej

Kauj Ruam 14: Teeb Daemon

Teeb tsa Daemon
Teeb tsa Daemon

Dab daemon yog qhov haujlwm uas pib ua haujlwm txhua lub sijhawm Pi tau qhib thiab ua haujlwm tom qab (tsis zoo ib yam li "Nws Cov Khoom Siv Tsaus Ntuj" series..).

1. Pib hostapd thiab dhcp cov haujlwm:

sudo kev pabcuam hostapd pib

sudo kev pabcuam isc-dhcp-server pib

2. Khiav cov lus txib tom ntej no los pab hostapd thiab dhcp kom pib txiav thaum Pi qhib:

sudo hloov tshiab-rc.d hostapd pab

sudo hloov tshiab-rc.d isc-dhcp-server qhib

Kauj ruam 15: Yuav luag muaj! Tsim Web Server HTML File

Yuav luag muaj! Tsim Web Server HTML File!
Yuav luag muaj! Tsim Web Server HTML File!
Yuav luag muaj! Tsim Web Server HTML File!
Yuav luag muaj! Tsim Web Server HTML File!
Yuav luag muaj! Tsim Web Server HTML File!
Yuav luag muaj! Tsim Web Server HTML File!

1. Sau ib nplooj ntawv HTML los tuav ntawm koj lub web server! Los yog rub tawm ib qho kuv yoog los ntawm Adafruit Digital Free Library:)

Rub tawm thiab khaws cov ntawv zip, tom qab ntawd rho tawm cov ntsiab lus. (Nov yog tag nrho GitHub nplooj ntawv)

2. Qhib WinSCP thiab nkag mus rau hostname: raspberrypi.local

3. Nkag mus rau Pi (ntaus tus username thiab password)

4. Ntawm Pi sab ntawm lub vijtsam (sab xis), mus rau phau ntawv qhia tsev

Nyem rau daim nplaub tshev nrog cov xub xub tshwm ntawm nws ob zaug.

5. Mus rau/var/www/html cov ntaub ntawv

Nyem ob npaug rau ntawm daim nplaub tshev uas sau tias "var", tom qab ntawv "www" folder ", thiab thaum kawg" html "folder.

6. Rho tawm cov ntawv index.html uas twb muaj lawm (lossis yog koj xav sau koj tus kheej koj tsuas tuaj yeem qhib thiab kho nws).

7. Luam cov ntaub ntawv web server rau hauv Pi html nplaub tshev

Ntawm sab laug ntawm lub vijtsam (koj lub khoos phis tawj), mus rau daim nplaub tshev uas koj khaws cov ntaub ntawv. Ua kom pom tseeb thiab rub cov ntsiab lus (ob daim nplaub tshev thiab cov ntaub ntawv npe "index.html") rau hauv Pi html nplaub tshev. Qhov ntawd yog nws!

8. Qhib qhov browser thiab ntaus "raspberrypi.local" hauv qhov bar qhia rau saum. Yog tias nws ua haujlwm, koj yuav pom lub vev xaib nplooj ntawv nplooj ntawv, dab tsi!

Kauj Ruam 16: Kho qhov HTML File Pt. 1

Kho qhov HTML Cov Ntaub Ntawv Pt. 1!
Kho qhov HTML Cov Ntaub Ntawv Pt. 1!

Tej zaum koj xav ua koj tus kheej lub vev xaib, yog li ntxiv koj tus kheej cov ntaub ntawv/duab/txawm li cas los thiab hloov cov ntawv HTML kom taw tes rau koj cov ntaub ntawv!

1. Qhib cov ntawv index.html ntawm Pi

2. Kho cov ntawv thiab cov lus piav qhia hauv cov ntawv index.html

- Hloov lub npe ntawm koj lub web server los ntawm kev kho cov ntawv ntawm cov npe ntu:

jenfoxbot's Local Web Server!

- Hloov nqe lus ntawm lub vev xaib los ntawm kev kho cov ntawv ntawm h2 thiab ntu ntu (kab 51):

jenfoxbot's Local Web Server

- Yeem tau: Hloov qhov kev piav qhia ntawm lub vev xaib (kab 55):

Nyob ntawm txoj haujlwm ntawm lub hli & hnub qub*, qhov hotspot no tuaj yeem lossis tsis muab kev sib txuas hauv Is Taws Nem.

Yog tias muaj IS txuas Internet, tshawb xyuas jenfoxbot lub vev xaib

thiab kawm paub txog lwm yam khoom txias uas nws ua!

*Thiab los ntawm txoj haujlwm ntawm lub hli & hnub qub peb txhais tau tias qhov kev xav tsis zoo tam sim no ntawm tus tsim, jenfoxbot:)

3. Yeem tau: Rho tawm cov ntaub ntawv, duab, thiab yeeb yaj kiab uas twb muaj lawm thiab ntxiv koj tus kheej

Muaj ob txheej rau nplooj ntawv nplooj ntawv no: nplooj ntawv ua ntej, uas yog tsim los ntawm "index.html" cov ntaub ntawv, thiab "sab hauv", uas muaj ob nplooj ntawv: "helpfulinfo.html" thiab "books.html". Yog tias koj xav ntxiv/hloov cov ntsiab lus ntawm nplooj ntawv tom ntej, hloov cov ntawv "index.html" thiab ntxiv cov duab rau "cov duab" nplaub tshev tib yam ncaj qha (koj kuj tuaj yeem ntxiv ntau cov ntawv khaws cia sib txawv lossis ntau cov ntsiab lus).

Yog tias koj xav hloov kho cov ntsiab lus ntawm nplooj ntawv sab hauv, kho cov ntaub ntawv "helpfulinfo.html" thiab "books.html", ntxiv cov duab rau "duab" nplaub tshev thiab PDFs (lossis lwm yam ntawv) rau "teeb meem" nplaub tshev (dua, koj tuaj yeem ntxiv ntau daim nplaub tshev hauv no).

Kauj Ruam 17: Hloov Kho Cov Ntaub Ntawv HTML Pt. 2

Kho qhov HTML Cov Ntaub Ntawv Pt. 2!
Kho qhov HTML Cov Ntaub Ntawv Pt. 2!
Kho qhov HTML Cov Ntaub Ntawv Pt. 2!
Kho qhov HTML Cov Ntaub Ntawv Pt. 2!
Kho qhov HTML Cov Ntaub Ntawv Pt. 2!
Kho qhov HTML Cov Ntaub Ntawv Pt. 2!

1. Ntxiv koj cov ntaub ntawv

- Txiav txim siab yam koj xav suav nrog ntawm koj lub server thiab rub tawm PDF ntawm cov ntawv ntawd. Kuj rub cov duab rau txhua daim ntawv yog li koj yuav muaj qee yam lom zem nyem rau: D

- Siv WinSCP, ntxiv koj cov ntaub ntawv rau cov ntawv tsim nyog (saib cov kauj ruam dhau los thiab daim duab 1).

- Kho qhov index.html lossis lwm yam ntaub ntawv html cuam tshuam (piv txwv li yog tias koj xav ntxiv lossis hloov phau ntawv hauv nplooj ntawv xov xwm pab tau, kho cov ntaub ntawv "helpfulinfo.html"). Zaub thiab saib cov duab thiab cov ntaub ntawv los ntawm kev hloov cov npe cov ntaub ntawv thiab txuas ntxiv thiab hloov kho cov lus piav qhia:

Txhua qhov koj nyiam cov lus ntawm no

2. Rau cov tib neeg tshiab rau tus lej, koj tuaj yeem ntxiv cov ntaub ntawv ntau ntxiv los ntawm kev luam thiab muab tshuaj txhuam cov cai uas twb muaj lawm thiab hloov cov npe cov ntawv thiab txuas ntxiv mus (saib daim duab 2)!

Nov yog cov ntsiab lus pab tau ntawm HTML los ntawm Khan Academy!

Kauj Ruam 18: OMG Thaum kawg! Peb Ua Tau:)

OMG Thaum kawg! Peb Ua Tau:)
OMG Thaum kawg! Peb Ua Tau:)
OMG Thaum kawg! Peb Ua Tau:)
OMG Thaum kawg! Peb Ua Tau:)
OMG Thaum kawg! Peb Ua Tau:)
OMG Thaum kawg! Peb Ua Tau:)

Tshem lub Ethernet cable, txuas rau koj lub wireless nkag mus, thiab tom qab ntawd ntaus tus IP chaw nyob hauv qhov chaw nyob ntawm koj tus browser nyiam (192.168.42.1 yog tias koj ua raws cov lus qhia no).

Yog tias txhua yam ua haujlwm, koj yuav pom koj lub vev xaib (Kuv tau suav nrog cov duab ntawm kuv). Woohoo koj nyuam qhuav tsim lub wireless access point !! (Yog tias nws tsis ua haujlwm, khiav los ntawm kev teeb tsa dua thiab rov xyuas ob zaug tias txhua lub davhlau ya nyob twg tus lej raws nraim li qhia, suav nrog cov chaw thiab xws li).

Tshawb xyuas koj tus kheej lub vev xaib hauv zos thiab txiav txim siab seb koj xav siv nws li cas ntawm no!

Kauj Ruam 19: Dab Tsi Ntxiv?

Dab Tsi Ntxiv?
Dab Tsi Ntxiv?
Dab Tsi Ntxiv?
Dab Tsi Ntxiv?

Ib qho kev xaiv yog siv nws ua cov khoom siv wireless hauv zos. Txuas rau Pi, txuas rau WiFi nkag mus rau qhov chaw koj teeb tsa (qhov no yog lub npe "HelloWorld"), thiab khaws lossis rho tawm cov ntaub ntawv los ntawm nws. Koj tuaj yeem nkag tau cov ntaub ntawv no txawm tias koj raug txuas los ntawm Is Taws Nem. Yog li koj tuaj yeem txuag koj cov yeeb yaj kiab nyiam thiab tseem saib nws thaum lub zog tawm:) (er, piv txwv tias koj tau them lub laptop).

Ntxiv cov ntaub ntawv ntau ntxiv (piv txwv li koj tuaj yeem siv nws ua qhov chaw khaws cia), ua si ib puag ncig nrog tus lej HTML kom ua rau koj lub xaib zoo nkauj, thiab muaj kev lom zem!

Lwm qhov kev xaiv yog teeb tsa qhov no los ua nplooj ntawv pej xeem ntsib thiab muab nws lub npe sau cia kom lwm tus neeg tuaj yeem nkag mus saib cov ntaub ntawv. Qhov no muaj txiaj ntsig tshwj xeeb yog tias koj yuav mus qhov twg tsis muaj WiFi lossis cable Internet - koj tuaj yeem nqa Wikipedia nrog koj! (tab sis tej zaum pub dawb rau lawv yog tias koj ua qhov ntawd 'ua rau lawv txaus). Yog tias koj xis nyob nrog cov cai, koj tuaj yeem teeb tsa qhov no los ua tus neeg rau zaub mov thaub qab tsis siv neeg, lub server wireless game hauv zos rau koj thiab koj cov phooj ywg, thiab lwm yam.

Yog tias koj mus rau txoj kev no, nco ntsoov koj paub me ntsis txog kev ruaj ntseg network raws li WPA2 tus password txheej txheem tsis ntev los no tau cuam tshuam (saib hauv qab no).

Thaum kawg, raws li tau hais hauv cov lus qhia, koj tuaj yeem siv Cloud server no los pib ua rau tib neeg Internet! Muaj ib hnub tsim nrog koj cov phooj ywg los tsim pawg Cloud servers kom koj txhua tus tuaj yeem "tham" rau ib leeg! Txoj hauv kev no tsis tas yuav yog * zoo tshaj * (aka zoo tshaj/ua tau zoo) txoj hauv kev los tsim Internet rau pej xeem, tab sis nws yog qhov pib zoo. Ntxiv rau, peb nkag siab zoo li cas cov thev naus laus zis no ua haujlwm, zoo dua peb siv lawv los daws teeb meem loj thiab tawm tswv yim rau peb tus kheej thiab peb cov zej zog.:)

Xav paub ntau ntxiv txog WPA2 kev nyab xeeb kev pheej hmoo los ntawm cov neeg siv muaj txiaj ntsig BillDauterive:

"[T] nws tus neeg tawm tsam xav tau lub cuab yeej nyob hauv thaj tsam ntawm lub hom phiaj wifi network los ua kev hem thawj xws li qhib chaw nres nkoj rau lub vev xaib tsis cuam tshuam qhov ntawd. kev sib txuas ntawm Wifi network uas tsis tau encrypted ntawm TLS. Ntawm qhov cuam tshuam WLAN, tsis nkag siab VNC rau Pi yuav muaj kev pheej hmoo txawm tias nkag los ntawm WLAN."

Raspberry Pi Contest 2017
Raspberry Pi Contest 2017
Raspberry Pi Contest 2017
Raspberry Pi Contest 2017

Khiav Tawm Hauv Raspberry Pi Contest 2017

Pom zoo: