You are on page 1of 112

Joomla on Raspberry Pi using Nginx

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

'* +ntrodu tion 8 Raspberry Pi

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

'* Raspberry Pi 8 -ardware

!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

<rid GsuperH omputer

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

'* Raspberry Pi 8 Aenefits

small

7irt $eap: J (3 K (6 0uro "ow power ?(*3 Watt@ No mo"ing parts K Sile!t G7e fa toH standard ?% types@

Mu $ additional $ardware Many software Mu $ do umentation

'* Raspberry Pi 8 Aenefits

Community

Dse !oftware -ardware Case

.ego Raspberry Pi 0n losure by Ai> ?age '%@ from DL

.0MP !ta 1

./MP .0MP !ta 1


. 8 .inux K Raspbian ?7ebian for RPi@ 0 8 /pa $e K Nginx MGengine xHN M 8 My!4. P 8 P-P

%* Raspbian

%* Raspbian
a@+nstallation b@Conne t to Networ1 @Configuration d@+nternet / ess

%a* Raspbian 8 +nstallation !7 Card


'*7ownload Raspbian +mage: $ttp:EEwww*raspberrypi*orgEdownloads %*Write to !7 Card:

!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:

sudo dd bs;'M if;RErpiE%&'(=&#=%3=w$ee>y=raspbian*img of;Ede"Emm bl1&

Ma )!S: Windows:

sudo dd bs;'M if;RErpiE%&'(=&#=%3=w$ee>y=raspbian*img of;Ede"Edis1's'

dd bs;'M if; :TtempT%&'(=&#=%3=w$ee>y=raspbian*img od;e

%b* Raspbian 8 Conne t your RPi

7addy, Can + wat $*** I!esame !treetF

%b* Raspbian 8 Conne t "ia !!

RPi $as !!- !er"er 7etermine +P address


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

{configuration menu} pi@raspberrypi ~ $ sudo raspi-config

% * Raspbian 8 Configure your RPi


C$ange Dser Password /d"an ed )ptions

-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

%d* +nternet / ess to RPi

+nternet

petermartin*nl: 7N! referen e to +P address router

Router: Portforwarding to +P address RPi

RPi: ,ixed +P addressF

(* !!- 8 !e ure !$ell


Wake up Neo... The Matrix has you... Follow the white rabbit. Knock, knock, Neo.

(*,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

Nginx Mengine exN

-ig$ performan e:

7ynami pages ; ,/!9 !tati ; "ery ,/!9Q

.ow memory usage ?useful on RpiQ@ 0asy onfiguration P automati onfiguration test

Nginx Popularity ?net raft* om No" %&'(@:

Nginx on ''& million sites ?'2W all sites, /pa $e 22W, ++! %2W@ 9op million busiest websites:

'* /pa $e 35 W %* Nginx '3 W (* Mi rosoft '% W

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***

Arowse to DR.: $ttp:EE'#%*'56*&*'%E Welco#e to !gi!$%

2* Nginx 8 Birtual domains


,or e"ery "irtual domain:
a@Create folder P index file
E"arEwwwEdomainE P index*$tml file

b@Create onfiguration file @0nable site "ia symboli lin1 d@Reload Nginx onfig file?s@

2* Nginx 8 a@Birtual domain


pi@rpi ~ $ sudo mkdir /var/www/petermartin.nl pi@rpi ~ $ sudo nano /var/www/petermartin.nl/index.php <html> <head> <title>Joomla on Raspberry Pi at JWC</title> </head> <body bgcolor="white" text="black"> <h1>Welcome to Joomla World Conference 2013!</h1> </body> </html>

2* Nginx 8 b@ onfiguration file


pi@rpi ~ $ sudo nano /etc/nginx/sitesavailable/petermartin.nl
server { listen 80; server_name www.petermartin.nl; root /var/www/petermartin.nl; access_log /var/log/nginx/petermartin.nl.access_log; error_log /var/log/nginx/petermartin.nl.error_log info; location / { index index.php index.html index.htm; } }

2* Nginx 8 @ symlin1 P d@ reload


{create symbolic link} pi@rpi ~ $ sudo ln -s /etc/nginx/sites-available/petermartin.nl /etc/nginx/sites-enabled/petermartin.nl

{reload Nginx configuration} pi@rpi ~ $ sudo /etc/init.d/nginx reload Reloading nginx configuration: nginx.

2* Nginx 8 9esting***

Arowse to DR.: $ttp:EE'#%*'56*&*'%E Welco#e to &oo#la World Co!'ere!ce ()13%

Error*
+)+ ,ot -ou!d nginxE'*%*' K C$e 1 error log file: J at E"arElogEnginxEpetermartin*nl*errorOlog

3* My!4. 7atabase !er"er

3* My!4.

+nstall My!4.
J sudo apt=get install mysXl=ser"er

!e ure My!4.
J sudo mysXlOse ureOinstallation

Create database for Joomla site

3* My!4. 8 Create database


pi@rpi ~ $ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 48 Server version: 5.5.31-0+wheezy1 (Debian) mysql> create database petermartin; Query OK, 1 row affected (0.00 sec) mysql> \q Bye pi@rpi ~ $

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@

%*Configure Nginx "irtual domain (*Reload Nginx

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 onfiguration petermartin*nl


pi@rpi ~ $ sudo nano /etc/nginx/sitesavailable/petermartin.nl add: location ~ \.php$ { fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; }

pi@rpi ~ $ sudo /etc/init.d/nginx reload

5* P-P 8 9esting***

Arowse to DR.: $ttp:EE'#%*'56*&*'%E

7* p$pMy/dmin

7* p$pMy/dmin

7atabase <D+ $ttp:EE'#%*'56*&*'%Ep$pmyadminE +nstallation Configuration

!e ure:

/dd to one "irtual domain only limit to ' +P address

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

.atest Joomla (*' from Yoomla*org using wget


sudo wget

$ttp:EEYoomla ode*orgEgfEdownloadEfrsreleaseE'65%%E6(267EJoomlaO(*'*3 =!table=,ullOPa 1age*>ip

.atest testing from git$ub* om using git


sudo git lone git:EEgit$ub* omEYoomlaEYoomla= ms*git

+nstall "ia Joomla:s webinstaller

6* Joomla 8 7ownload ?wget@


pi@rpi ~ $ cd /var/www/petermartin.nl
pi@rpi ~ $ sudo wget http://joomlacode.org/gf/download/frsrelease/18622/83487/Joomla_3.1.5-StableFull_Package.zip
--2013-10-30 00:55:28-http://joomlacode.org/gf/download/frsrelease/18622/83487/Joomla_3.1.5-StableFull_Package.zip Resolving joomlacode.org (joomlacode.org)... 206.123.111.164 Connecting to joomlacode.org (joomlacode.org)|206.123.111.164|:80... connected. HTTP request sent, awaiting response... 302 Found Location: http://downloads.joomlacode.org/frsrelease/8/3/4/83487/Joomla_3.1.5-StableFull_Package.zip [following] --2013-10-30 00:55:28-http://downloads.joomlacode.org/frsrelease/8/3/4/83487/Joomla_3.1.5-StableFull_Package.zip Resolving downloads.joomlacode.org (downloads.joomlacode.org)... 206.123.111.167 Connecting to downloads.joomlacode.org (downloads.joomlacode.org)|206.123.111.167|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 8601365 (8.2M) [application/zip] Saving to: `Joomla_3.1.5-Stable-Full_Package.zip' 100% [======================================================================================= ======================================================================================== ====================>] 8,601,365 1.77M/s in 8.9s 2013-10-30 00:55:38 (944 KB/s) - `Joomla_3.1.5-Stable-Full_Package.zip' saved [8601365/8601365]

pi@rpi ~ $ sudo unzip Joomla_3.1.5-Stable-Full_Package.zip

6* Joomla 8 7ownload ?git@


pi@rpi ~ $ sudo git clone git://github.com/joomla/joomla-cms.git
Cloning into 'joomla-cms'... remote: Counting objects: 383183, done. remote: Compressing objects: 100% (129858/129858), done. remote: Total 383183 (delta 273694), reused 357567 (delta 249953) Receiving objects: 100% (383183/383183), 95.88 MiB | 1.87 MiB/s, done. Resolving deltas: 100% (273694/273694), done. Checking out files: 100% (6344/6344), done.

6* Joomla 8 C$ange owners$ip


pi@rpi ~ $ sudo chown -R www-data:www-data /var/www/petermartin.nl/

6* Joomla 8 !0, .in1s

/pa $e

modOrewrite K *$ta ess 0"ery fileEfolder $e 1ed for *$ta ess

Nginx

*$ta ess K "irtual domain onfiguration: lo ation E Z


index index*p$p index*$tml index*$tm[ tr./'ile0 1uri 1uri2 2i!de$3p p*451re4ue0t/uri6

#* Performan e

#* Performan e 8 9esting, ',%,(

G9$e need for speedH K Bisitors P <oogle indexing

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

Arowser plugins, e*g* Uslow

7'

#* Performan e

9est: Refres$ ?(x@ new setting V Refres$ ?(x@ C ompare

7%

#* Performan e 8 W$at wor1edF

Nginx P P-P=,PM

!o 1et "s PortF


fast giOpass unix:E"arErunEp$p3=fpm*so 1[ fast giOpass '%7*&*&*':#&&&[ Gso 1et onne tions are around '&='3W faster t$an 9CPE+P onne tions be ause it sa"es t$e passing t$e data o"er t$e different layers of 9CPE+P sta 1H

Joomla a $e

!ystem V <lobal Configuration V M!ystemN K Ca $e Conser"ati"e E Progressi"e E Ca $e Plugin

/lternati"e P-P Ca $e ?/PC@

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

1866.4 1313.8 1308.4 1327.4

4.25 3.54 3.54 3.53

112.2 38.2 41.4 36.1

72

#* Performan e 8 /lternati"e P-P Ca $e


{Install APC + pear} pi@rpi ~ $ sudo apt-get install php-apc php-pear php5-dev libpcre3-dev {Put settings in PHP.ini} pi@rpi ~ $ sudo pear config-set php_ini /etc/php5/fpm/php_ini pi@rpi ~ $ sudo pecl config-set php_ini /etc/php5/fpm/php_ini
73

#* Performan e 8 /lternati"e P-P Ca $e


{Download/compile/install APC} pi@rpi ~ $ sudo pecl install apc {Choose all default options} {add "extension=apc.so" to /etc/php5/fpm/php.ini} {After install APC restart nginx} pi@rpi ~ $ sudo /etc/init.d/nginx restart {AND restart php-fpm!!!} pi@rpi ~ $ sudo /etc/init.d/php5-fpm reload
75

#* 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

1231.5 485.2 445.7 443.3

2.71 1.40 1.40 1.40

91.6 34.9 34.0 38.1

77

#* Performan e 8 7id not wor1***


Joomla g>ip Nginx a $e )ptimi>ation Plugins ?JC- )ptimi>e E Ybetolo@ Mem a $ed )"er lo 1ing Rpi Cryogeni s

76

#* Performan e 8 )"er lo 1ing


J sudo raspi= onfig
Be aware that overclocking may reduce the lifetime of your Raspberry Pi. If overclocking at a certain level causes system instability, try a more modest overclock. Hold down shift during boot to temporarily disable overclock. See http://elinux.org/RPi_Overclocking for more information.

7#

#* Performan e 8 )"er lo 1ing


700Mhz (cache+APC) Time (ms) Memory (MB) DB Queries (ms) 1st 1231.5 2.71 91.6 2nd 485.2 1.40 34.9 445.7 1.40 34.0 3rd 4th 443.3 1.40 38.1 1000Mhz (cache+APC) 1st 2nd 3rd 4th

1917.1 461.6 454.2 358.3

4.19 1.41 1.40 1.41

53.4 44.2 33.3 24.2

6&

#* Performan e 8 Cryogeni s

!uper ondu ting omputers

Superconductivity in certain materials when cooled below a characteristic critical temperature

Cool down Raspberry Pi FQF

,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

Not ool enoug$*** ^ '%( L ? ; _'3& `C, _%(6 `,@

.iXuid nitrogen or liXuid $eliumF

Couldn:t de ide w$i $*** performan e gain w$en ooling down: NE/

6(

'&* !e urity

62

'&* !e urity 8 ss$ logfiles

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

'&* !e urity 8 ,irewall


-irewallA B<:@aCle0D Create file wit$ firewall rules


7rop traffi on ertain ports /llow traffi on ertain ports

.oad rule set into +P9ables /dd new rules to +P9ables

Alo 1 +P addresses

Reboot RPiF K +P9ables empty

Create ss$ s ript to load firewall rules on start

65

'&* !e urity 8 Webser"er logfiles


E"arElogEnginxEpetermartin*nl*a essOlog
'#6*7*37*72 = = M(&EMarE%&'(:'5:27:2# P&'&&N a<09 E w))tw))t*at*bla 1$ats*anti=se :@ -99PE'*'a 2&2 '353 a=a abm0ua '#6*7*37*72 = = M(&EMarE%&'(:'5:27:3% P&'&&N a<09 2p p#.ad#i!20cript020etup3p p -99PE'*'a 2&( '(3 a=a abm0ua '#6*7*37*72 = = M(&EMarE%&'(:'5:27:3% P&'&&N a<09 EpmaEs riptsEsetup*p$p -99PE'*'a 2&2 27 a=a abm0ua '#6*7*37*72 = = M(&EMarE%&'(:'5:27:3% P&'&&N a<09 EmyadminEs riptsEsetup*p$p -99PE'*'a 2&2 27 a=a abm0ua '#6*7*37*72 = = M(&EMarE%&'(:'5:27:3( P&'&&N a<09 EMy/dminEs riptsEsetup*p$p -99PE'*'a 2&2 27 a=a abm0ua '#6*7*37*72 = = M(&EMarE%&'(:'5:27:3( P&'&&N a<09 Es riptsEsetup*p$p -99PE'*'a 2&2 27 a=a abm0ua '#6*7*37*72 = = M(&EMarE%&'(:'5:27:32 P&'&&N a<09 2t.po32p p#.ad#i!20cript020etup3p p -99PE'*'a 2&2 27 a=a abm0ua '#6*7*37*72 = = M(&EMarE%&'(:'5:27:33 P&'&&N a<09 Ep$padminEs riptsEsetup*p$p -99PE'*'a 2&2 27 a=a abm0ua '#6*7*37*72 = = M(&EMarE%&'(:'5:27:33 P&'&&N a<09 Ep$pMy/dminEs riptsEsetup*p$p -99PE'*'a 2&2 27 a=a abm0ua '#6*7*37*72 = = M(&EMarE%&'(:'5:27:33 P&'&&N a<09 Ep$pmyadminEs riptsEsetup*p$p -99PE'*'a 2&( '(3 a=a abm0ua '#6*7*37*72 = = M(&EMarE%&'(:'5:27:33 P&'&&N a<09 Ep$pmyadmin'Es riptsEsetup*p$p -99PE'*'a 2&2 27 a=a abm0ua '#6*7*37*72 = = M(&EMarE%&'(:'5:27:33 P&'&&N a<09 Ep$pmyadmin%Es riptsEsetup*p$p -99PE'*'a 2&2 27 a=a abm0ua '#6*7*37*72 = = M(&EMarE%&'(:'5:27:35 P&'&&N a<09 EpmaEs riptsEsetup*p$p -99PE'*'a 2&2 27 a=a abm0ua '#6*7*37*72 = = M(&EMarE%&'(:'5:27:35 P&'&&N a<09 EwebEp$pMy/dminEs riptsEsetup*p$p -99PE'*'a 2&2 27 a=a abm0ua '#6*7*37*72 = = M(&EMarE%&'(:'5:27:35 P&'&&N a<09 2$a#pp2p p#.ad#i!20cript020etup3p p -99PE'*'a 2&2 27 a=a abm0ua '#6*7*37*72 = = M(&EMarE%&'(:'5:27:35 P&'&&N a<09 EwebEs riptsEsetup*p$p -99PE'*'a 2&2 27 a=a abm0ua '#6*7*37*72 = = M(&EMarE%&'(:'5:27:35 P&'&&N a<09 Ep$p=my=adminEs riptsEsetup*p$p -99PE'*'a 2&2 27 a=a abm0ua '#6*7*37*72 = = M(&EMarE%&'(:'5:27:35 P&'&&N a<09 EwebsXlEs riptsEsetup*p$p -99PE'*'a 2&2 27 a=a abm0ua '#6*7*37*72 = = M(&EMarE%&'(:'5:26:%( P&'&&N a<09 EsXlmanagerEs riptsEsetup*p$p -99PE'*'a 2&2 27 a=a abm0ua '#6*7*37*72 = = M(&EMarE%&'(:'5:26:%( P&'&&N a<09 EmysXlmanagerEs riptsEsetup*p$p -99PE'*'a 2&2 27 a=a abm0ua '#6*7*37*72 = = M(&EMarE%&'(:'5:26:%2 P&'&&N a<09 Ep$pmanagerEs riptsEsetup*p$p -99PE'*'a 2&2 27 a=a abm0ua '#6*7*37*72 = = M(&EMarE%&'(:'5:26:%2 P&'&&N a<09 Ep$p=myadminEs riptsEsetup*p$p -99PE'*'a 2&2 27 a=a abm0ua '#6*7*37*72 = = M(&EMarE%&'(:'5:26:%2 P&'&&N a<09 EsXlwebEs riptsEsetup*p$p -99PE'*'a 2&2 27 a=a abm0ua '#6*7*37*72 = = M(&EMarE%&'(:'5:26:%2 P&'&&N a<09 EwebdbEs riptsEsetup*p$p -99PE'*'a 2&2 27 a=a abm0ua '#6*7*37*72 = = M(&EMarE%&'(:'5:26:%2 P&'&&N a<09 EwebsXlEs riptsEsetup*p$p -99PE'*'a 2&2 27 a=a abm0ua 67

'&* !e urity 8 ,ail%Aan

Auto#ated ClocEi!gA B-ail(Ba!D

! 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 8 ,ail%Aan ,ilter


{No w00tw00t for you ;-)} pi@rpi ~$ sudo nano /etc/fail2ban/filter.d/nginx-w00tw00t.conf # Fail2Ban configuration file # Author: Peter Martin [Definition] # Option: failregex failregex = ^<HOST> -.*GET.*(w00tw00t| \setup.php|\wp-login.php)
#&

'&* !e urity 8 ,ail%Aan onfiguration


{activate nginx-w00tw00t filter} pi@rpi ~$ sudo nano /etc/fail2ban/jail.local [nginx-w00tw00t] enabled = true port = http,https filter = nginx-w00tw00t logpath = /var/log/nginx/*access_log maxretry = 0 bantime = 600 {restart Fail2Ban} pi@rpi ~$ sudo /etc/init.d/fail2ban restart
#'

'&* !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

USB Wi'i do!gle F u0e USB power% Compatible: $ttp:EEelinux*orgERPiOD!AO Wi=,iO/dapters

''* Wifi

0t$ernet K onne t RPi to internet Wifi K onne t wifi de"i es to RPi

$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

ProblemsF !ear $ for & 23:5%f'

'%* 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

'(* .i"e and .07 die

<P+)

<eneral=purpose inputEoutput ?<P+)@


; Control input or output "ia software

.07s P some time

P more time

P a lot more time

e"en more time P Pyt$on <P+)

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

sudo pyt$on greenOon*py

'&3

Joomla C <P+)F

Joomla Component for my Pi to manage .07: co#/piled

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

'2* Joomla .07 logo P am from s1y

'2* Joomla .07 logo P am from s1y

Joomla P Raspberry Pi ; $ours of fun t$e end***

4uestionsF

Presentation a"ailable "ia www*db6*nl

Peter Martin 0mail: info at db6*nl Website: www*db6*nl 9witter: @pe7er


''&

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

Professor 9iger = <abriel 7oyle $ttp:EEwww*sx *$uEp$otoE3%572#

''%

You might also like