Professional Documents
Culture Documents
Peter Martin, twitter: @pe7er Joomla World Conferen e, !at No" #t$ %&'(
)"er"iew Presentation
'*+ntrodu tion %*,un wit$ !!./MP .0MP !ta 1: (*Raspbian 2*Nginx 3*My!4. 5*P-P 7*p$pMy/dmin 6*Joomla #*Performan e '&*!e urity ''*W+,+ '%*C/M '(*.i"e and .07 die '2*!1y
9oday:s engineers: $ome omputers in '#6&s 9oday:s yout$: omputer lasses ; operate software, li 1 menus and swipe yourself to deat$*** <oal RPi: edu ation on inexpensi"e de"i e
!ingle=board omputer, 7&& M$> R/M 3'% Mbyte ?'st "er*%35 Mbyte@ <rap$i s: Aroad om BideoCore +B Conne tions:
SD Card Micro USB powerplug (5v 1A 3,5 Watt) Et er!et -7M+ C RC/ Bideo /udio %x D!A <eneral=purpose inputEoutput ?<P+)@
/ Raspberry w$atF W$y do you want to buy t$atF 7on:t you $a"e enoug$ omputers alreadyF
!mallest Ma
C52
Weat$er !tation
Pi in t$e s1y
ArewPi
Joomla
7idn:t you tell me re ently*** ***t$at you ould install Joomla*** I on e"ery omputerF
small
7irt $eap: J (3 K (6 0uro "ow power ?(*3 Watt@ No mo"ing parts K Sile!t G7e fa toH standard ?% types@
Community
.0MP !ta 1
%* Raspbian
%* Raspbian
a@+nstallation b@Conne t to Networ1 @Configuration d@+nternet / ess
!7 Card: $ttp:EEelinux*orgERPiO0asyO!7OCardO!etup .o ation !7 Card: GdmesgH Write, GddH ?Gdump dis1H, P= 3 minutes@ C/R0,D.: Gdata destroyerH Q
.inux:
Ma )!S: Windows:
Raspberry Pi P monitor: sudo if onfig !mart P$one: )"erloo1 ,ing PC: nmap =sP '#%*'56*&E%2 Router: $e 1 onne ted de"i es .inux: Command .ine Ma )!S: 9erminal Windows: GPu99UH
Conne t "ia !!
%b* Raspbian 8 Conne t "ia !!{connect from PC via SSH to RPi} peter@db8HQ:~ $ ssh pi@192.168.0.12
-ostname
raspberrypi =V rpi 0xpand %<A image to full 6<A apa ity ,ree R/M from memory for <D+ ?52MA K '5MA@
0xpandOrootfs
MemoryOsplit
+nternet
(*,un wit$ !!apple:~ peter$ ssh pi@192.168.0.12 pi@192.168.0.12's password: **** Linux rpi 3.6.11+ #538 PREEMPT Fri Aug 30 20:42:08 BST 2013 armv6l The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Tue Oct 29 21:04:31 2013 from 192.168.0.15 pi@raspberrypi ~ $
(*,un wit$ !!pi@raspberrypi ~ $ ssh peter@192.168.0.15 peter@192.168.0.15's password: **** Linux db8HQ 2.6.32-5-686 #1 SMP Mon Sep 23 23:00:18 UTC 2013 i686 The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. You have new mail. Last login: Wed Oct 30 17:35:55 2013 from 192.168.0.12 peter@db8HQ:~$
(*,un wit$ !!peter@db8HQ:~$ ssh peter@192.168.0.17 peter@192.168.0.17's password: **** Linux thinkpad 3.2.0-4-686-pae #1 SMP Debian 3.2.461+deb7u1 i686 The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Wed Oct 30 17:41:15 2013 from db8hq.local peter@thinkpad:~$
UesF !o w$atFFF
2* Nginx webser"er
2* Nginx
-ig$ performan e:
.ow memory usage ?useful on RpiQ@ 0asy onfiguration P automati onfiguration test
Nginx on ''& million sites ?'2W all sites, /pa $e 22W, ++! %2W@ 9op million busiest websites:
2* Nginx 8 Popularity
2* Nginx 8 +nstallation
pi@rpi ~ $ sudo apt-get install nginx [..] Setting up nginx (1.2.1-2.2+wheezy1) ... pi@rpi ~ $
2* Nginx 8 Configuration
pi@rpi ~ $ sudo nano /etc/nginx/nginx.conf user www-data; worker_processes 1; # same as number of CPU pid /var/run/nginx.pid; pi@rpi ~ $ sudo /etc/init.d/nginx start
2* Nginx 8 9esting***
b@Create onfiguration file @0nable site "ia symboli lin1 d@Reload Nginx onfig file?s@
{reload Nginx configuration} pi@rpi ~ $ sudo /etc/init.d/nginx reload Reloading nginx configuration: nginx.
2* Nginx 8 9esting***
Error*
+)+ ,ot -ou!d nginxE'*%*' K C$e 1 error log file: J at E"arElogEnginxEpetermartin*nl*errorOlog
3* My!4.
+nstall My!4.
J sudo apt=get install mysXl=ser"er
!e ure My!4.
J sudo mysXlOse ureOinstallation
5* P-P
5* P-P 8 +nstallation
'*+nstall ?ne essary@:
p$p3=fpm ?,astC<+ Pro ess Manager@ p$p3=mysXl ?Conne t to My!4.@ p$p3= li ? ommand=line interpreter@ p$p3= url ?download from ,9P C -99P ser"er@
5* P-P 8 +nstallation
pi@rpi ~ $ sudo apt-get install php5-fpm php5-mysql Setting up php5 (5.4.4-14+deb7u5) ... Processing triggers for php5-fpm ... [ ok ] Restarting PHP5 FastCGI Process Manager: php5-fpm. pi@rpi ~ $
5* P-P 8 9esting***
7* p$pMy/dmin
7* p$pMy/dmin
!e ure:
7* p$pMy/dmin 8 +nstallation
pi@rpi ~ $ sudo apt-get install phpmyadmin
Web server to reconfigure automatically: none Configure database for phpmyadmin with dbconfig-common? N
pi@rpi ~ $
7* p$pMy/dmin 8 Configuration
pi@rpi ~ $ sudo nano /etc/nginx/sitesavailable/petermartin.nl
location /phpmyadmin { root /usr/share/; index index.php index.html index.htm; location ~ ^/phpmyadmin/(.+\.php)$ { try_files $uri =404; root /usr/share/; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; } location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif| css|png|js|ico|html|xml|txt))$ { root /usr/share/; } }
6* Joomla
6* Joomla 8 7ownload
7ownload
/pa $e
Nginx
#* Performan e
7ifferent onfigurations ?!er"er settings, Joomla settings, Joomla 0xtensions ?9emplates P Plugins@ 7ebug Mode:
!ystem V <lobal Configuration V !ystem V 7ebug !ystem: U0! JoomlaQ 7ebug Console V Profile +nformation
7'
#* Performan e
7%
Nginx P P-P=,PM
Joomla a $e
7(
#* Performan e 8 Joomla a $e
Cache OFF 1st 2nd 3rd 4th Cache ON 1st 2nd 3rd 4th Time (ms) 2891.0 2141.8 1772.3 1808.5 Memory (MB) DB Queries (ms) 4.24 332.5 4.24 106.0 4.24 89.1 4.24 91.0
72
#* Performan e 8 /PC
Cache,no APC 1st 2nd 3rd 4th Cache ON + APC 1st 2nd 3rd 4th Time (ms) Memory (MB) DB Queries (ms) 1866.4 4.25 112.2 1313.8 3.54 38.2 1308.4 3.54 41.4 1327.4 3.53 36.1
77
Joomla g>ip Nginx a $e )ptimi>ation Plugins ?JC- )ptimi>e E Ybetolo@ Mem a $ed )"er lo 1ing Rpi Cryogeni s
76
7#
6&
#* Performan e 8 Cryogeni s
,ridge
6'
PeterQQQQ
W$y are all t$ese wires*** ***sti 1ing out of t$e fridgeFQF @]QJW@QF
#* Performan e 8 Cryogeni s
,ridge
Couldn:t de ide w$i $*** performan e gain w$en ooling down: NE/
6(
'&* !e urity
62
E"arElogEaut$*log
/pr 6 %%:2#:&' rpi ss$dM'&6'%N: re"erse mapping $e 1ing getaddrinfo for #3*'26*'73*3#*broad*w$*$b*dynami *'5(data* M57318531+9375N failed = :;SS<B"E B=EA>?<, A@@EM:@% /pr 6 %%:2#:&' rpi ss$dM'&6'%N: pamOunix?ss$d:aut$@: aut$enti ation failure[ logname; uid;& euid;& tty;ss$ ruser; r$ost;3#*'73*'26*#3 user;root /pr 6 %%:2#:&2 rpi ss$dM'&6'%N: -ailed pa00word 'or root from 3#*'73*'26*#3 port 2(&55 ss$% /pr 6 %%:2#:&2 rpi ss$dM'&6'%N: Re ei"ed dis onne t from 3#*'73*'26*#3: '': Aye Aye Mpreaut$N /pr 6 %%:2#:&7 rpi ss$dM'&6'5N: re"erse mapping $e 1ing getaddrinfo for #3*'26*'73*3#*broad*w$*$b*dynami *'5(data* M3#*'73*'26*#3N failed = P)!!+A.0 AR0/L=+N /990MP9Q /pr 6 %%:2#:&7 rpi ss$dM'&6'5N: pamOunix?ss$d:aut$@: aut$enti ation failure[ logname; uid;& euid;& tty;ss$ ruser; r$ost;3#*'73*'26*#3 user;root /pr 6 %%:2#:&# rpi ss$dM'&6'5N: -ailed pa00word 'or root from 3#*'73*'26*#3 port 225(5 ss$% /pr 6 %%:2#:'& rpi ss$dM'&6'5N: Re ei"ed dis onne t from 3#*'73*'26*#3: '': Aye Aye Mpreaut$N /pr 6 %%:2#:'( rpi ss$dM'&6%&N: re"erse mapping $e 1ing getaddrinfo for #3*'26*'73*3#*broad*w$*$b*dynami *'5(data* M3#*'73*'26*#3N failed = P)!!+A.0 AR0/L=+N /990MP9Q /pr 6 %%:2#:'( rpi ss$dM'&6%&N: pamOunix?ss$d:aut$@: aut$enti ation failure[ logname; uid;& euid;& tty;ss$ ruser; r$ost;3#*'73*'26*#3 user;root /pr 6 %%:2#:'3 rpi ss$dM'&6%&N: -ailed pa00word 'or root from 3#*'73*'26*#3 port 25&3' ss$% /pr 6 %%:2#:'5 rpi ss$dM'&6%&N: Re ei"ed dis onne t from 3#*'73*'26*#3: '': Aye Aye Mpreaut$N /pr 6 %%:2#:'# rpi ss$dM'&6%2N: re"erse mapping $e 1ing getaddrinfo for #3*'26*'73*3#*broad*w$*$b*dynami *'5(data* M3#*'73*'26*#3N failed = P)!!+A.0 AR0/L=+N /990MP9Q /pr 6 %%:2#:'# rpi ss$dM'&6%2N: pamOunix?ss$d:aut$@: aut$enti ation failure[ logname; uid;& euid;& tty;ss$ ruser; r$ost;3#*'73*'26*#3 user;root om* n
om* n
om* n
om* n
63
Alo 1 +P addresses
65
! an logfiles C ta1e a tion automati ally if in entry in logfile mat $es GfilterH GnH times put +P on blo 1list for GxH minutes Eet Efail%banEfilter*dE Regex GR))9 .)<+N R0,D!07H, GP)!!+A.0 AR0/L=+N /990MP9QH, G,ailed passwordH et ***
GJailH onfiguration
,ilters
66
#* !e urity 8 ,ail%Aan
{install Fail2Ban} pi@rpi ~$ sudo apt-get install fail2ban
6#
'&* !e urity
Aa 1up QQQ C$ange default username GpiH C password Alo 1 root login /naly>e logfiles 8 .ogwat $ ,irewall 8 G+P9ablesH /utomati blo 1ing 8 ,ail%Aan
#%
''* Wifi
''* Wifi
+nternet
''* Wifi
$ostapd
user spa e daemon for wireless a ess point and aut$enti ation ser"ers 7-CP daemon
ud$ pd
7ynami -ost Configuration Proto ol ; +P networ1ing proto ol t$at dynami ally onfigures +P addresses
+nstallation: $ttp:EEelinux*orgERP+=Wireless=-otspot
'%* Web am
'%* Web am
=a0pCerr. :i Ca#era Board ?3MP, '&6&p@ <AP %&,= USB WeCca# ompatible: $ttp:EEelinux*orgERPiOBe rifiedPerip$erals]D!AO Web ams
'%* Web am
Conne t web am to D!A dmesg:
M(7*5%72'3N usb '='*(: new $ig$=speed D!A de"i e number 3 using dw Ootg M(7*77'%'%N usb '='*(: New D!A de"i e found, idBendor;)c+5, idProdu t;G('1 M(7*77'%22N usb '='*(: New D!A de"i e strings: Mfr;%, Produ t;', !erialNumber;& M(7*77'%5'N usb '='*(: Produ t: D!A %*& Camera M(7*77'%7#N usb '='*(: Manufa turer: !onix 9e $nology Co*, .td* M(7*#'3&55N .inux media interfa e: "&*'& M(7*#5&375N .inux "ideo apture interfa e: "%*&& M(6*&&(#%7N u" "ideo: ,ound DBC '*&& de"i e D!A %*& Camera ?& 23:5%f'@ M(6*&'3'#%N input: D!A %*& Camera as Ede"i esEplatformEb m%7&6OusbEusb'E'='E'= '*(E'='*(:'*&EinputEinput& M(6*&'5'''N usb ore: registered new interfa e dri"er u" "ideo M(6*&'5'(%N D!A Bideo Class dri"er ?'*'*'@ M(6*'62&3&N 3:(:': annot get freX at ep &x62 M(6*'66&&2N usb ore: registered new interfa e dri"er snd=usb=audio
'%* Web am
Web am in Joomla
Motion
software motion dete tor* ^pV^iframe style;aborder: &px ],,,,,, none[a name;a ama sr ;a$ttp:EE'#%*'56*&*'%:6&6'Ea frameborder;a'a marginwidt$;a&pxa margin$eig$t;a&pxa s rolling;anoa widt$;a7&&pxa $eig$t;a3%3pxaV^EiframeV^EpV
+frame
<P+)
P more time
G-ello WorldH
gree!/o!3p. import RPi*<P+) as <P+) <P+)*setwarnings?,alse@ <P+)*setmode?<P+)*A)/R7@ <P+)*setup?'', <P+)*)D9@ <P+)*output?'',@rue@ gree!/o''3p. M**N <P+)*output?'',-al0e@ =u! 0criptA
Ne essary:
pyt$on=de" pyt$on=rpi*gpio
'&3
Joomla C <P+)F
Run pyt$on s ript from P-P: ^Fp$p exe ?:sudo pyt$on ledsEgreenOon*py:@[FV
/dd user Gwww=dataH to gpio group <i"e user Gwww=dataH a ess to pyt$on ]in ludedir Eet Esudoers*d www=data /..;?/..@ N)P/!!W7: EusrEbinEpyt$on
'&5
4uestionsF
Dsed P$otos
Raspberry Pi 8 !wit $ed )n 9e $ 7esign $ttp:EEwww*sote $design* om*auEraspberry=pi=$as=arri"edE AAC Mi ro = !tuart Arady $ttp:EEen*wi1ipedia*orgEwi1iE,ile:AACOMi roO,rontORestored*Ypg bS !pe trum = Aill Aertram $ttp:EEen*wi1ipedia*orgEwi1iE,ile:bS!pe trum261*Ypg Commodore 52 = 0"an=/mos $ttp:EEen*wi1ipedia*orgEwi1iE,ile:Commodore=52= Computer*png Raspberry Pi +deas 8 $ttp:EE$a 1aday* omE Bintage Power !upply 8 Peter Martin Joomla P !troopwafels 8 Paul )rwig Ari 1s = !$arlene Ja 1son $ttp:EEwww*sx *$uEp$otoE73##6' -otrod 7as$ = Peter Ma>ure1 $ttp:EEwww*sx *$uEp$otoE'(2'#%( <reased .ig$tnin: = 7onald Coo1 $ttp:EEwww*sx *$uEp$otoE5#&%'2 ,ile )"erload = Aob !mit$ $ttp:EEwww*sx *$uEp$otoE(57#63 Rusted <ears = /ngelo Rosa $ttp:EEwww*sx *$uEp$otoE'(535#5 Man Made = a sremedya $ttp:EEwww*sx *$uEp$otoE'%57'&6 digital world = il1er $ttp:EEwww*sx *$uEp$otoE'%&57''
'''
Dsed P$otos
Cra>y Man in !$ower = s ott adams $ttp:EEwww*sx *$uEp$otoE75&753 laptop % = emre na igil $ttp:EEwww*sx *$uEp$otoE6'&72' !peedometer 8 /bdul$amid /l,ad$ly $ttp:EEwww*sx *$uEp$otoE'(#&'6# fridge = 7a"id Readman $ttp:EEwww*sx *$uEp$otoE(3%(6( .iXuid nitrogen = Cory 7o torow $ttp:EEen*wi1ipedia*orgEwi1iECryogeni s !e ure = ,ran1 Lc$ne $ttp:EEwww*sx *$uEp$otoE#5%((2 +CD = C$ris C$idsey $ttp:EEwww*sx *$uEp$otoE'(6232# Wireless = !tep$an -empelmann $ttp:EEwww*sx *$uEp$otoE2(7&(' .07 = alinusb2a $ttp:EEwww*sx *$uEp$otoE66(#6( .07, 3mm, green ?unlabelled@ = +ndu ti"eload $ttp:EE ommons*wi1imedia*orgEwi1iE,ile:.07,O3mm,OgreenO?unlabelled@*s"g Playing wit$ .07s 8 Peter Martin plasti ro 1et = agerard7#a $ttp:EEwww*sx *$uEp$otoE'&5'&(3 NAC 3 News = Le"in Co1ely
$ttp:EEwww*nb dfw* omEnewsElo alE7,W=/irport=Poli e=9argeted=9!/=in=!ting=)peration=%%%5'67('*$tml
''%