operating_systems:raspbian:easydoor_configuration
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| operating_systems:raspbian:easydoor_configuration [2019/07/16 12:25] – [Lighttpd setup] maferreira | operating_systems:raspbian:easydoor_configuration [2019/07/22 09:26] (current) – removed maferreira | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== easyDoor configuration ====== | ||
| - | ===== Intercom ===== | ||
| - | ==== config.txt ==== | ||
| - | Add this to your / | ||
| - | # Reference: https:// | ||
| - | # This option should be specified when using the camera module | ||
| - | start_x=1 | ||
| - | # The rainbow splash screen will not be shown on boot | ||
| - | disable_splash=1 | ||
| - | | ||
| - | # | ||
| - | | ||
| - | # | ||
| - | | ||
| - | # Rotates the display 90 degrees clockwise on the screen (default=0) or flips the display | ||
| - | display_rotate=1 | ||
| - | | ||
| - | # Comment the following line to enable Bluetooth | ||
| - | dtoverlay=pi3-disable-bt | ||
| - | | ||
| - | # Removes the warning overlay | ||
| - | avoid_warnings=1 | ||
| - | ==== Remove boot log messages ==== | ||
| - | # vi / | ||
| - | logo.nologo splash vt.global_cursor_default=0 loglevel=3 | ||
| - | |||
| - | |||
| - | ==== xorg setup ==== | ||
| - | # apt install --no-install-recommends xorg | ||
| - | # apt install --no-install-recommends xinput unclutter iceweasel matchbox-window-manager | ||
| - | <note warning> | ||
| - | |||
| - | If you start **XORG** it **WON' | ||
| - | # mkdir / | ||
| - | # touch / | ||
| - | # ln -s / | ||
| - | # chmod 600 / | ||
| - | |||
| - | <note warning> | ||
| - | |||
| - | === rc.local === | ||
| - | Add this to your / | ||
| - | iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE | ||
| - | export HOME=/root | ||
| - | # Sets .xauthority location file | ||
| - | export XAUTHORITY=/ | ||
| - | / | ||
| - | |||
| - | sudo modprobe bcm2835-v4l2 | ||
| - | |||
| - | === .xinitrc === | ||
| - | Your / | ||
| - | #!/bin/sh | ||
| - | # | ||
| - | # ~/.xinitrc | ||
| - | # | ||
| - | # Executed by startx (run your window manager from here) | ||
| - | /bin/echo -ne " | ||
| - | /bin/date >> / | ||
| - | | ||
| - | export DISPLAY=:0 | ||
| - | | ||
| - | if [ -d / | ||
| - | for f in / | ||
| - | [ -x " | ||
| - | done | ||
| - | unset f | ||
| - | fi | ||
| - | | ||
| - | #/bin/echo -ne " | ||
| - | #/bin/date >> / | ||
| - | | ||
| - | #/ | ||
| - | #/ | ||
| - | #/ | ||
| - | | ||
| - | /bin/echo -ne " | ||
| - | /bin/date >> / | ||
| - | | ||
| - | # Fix inverted mouse/ | ||
| - | / | ||
| - | / | ||
| - | | ||
| - | /bin/echo -ne " | ||
| - | /bin/date >> / | ||
| - | | ||
| - | /bin/sleep 5 | ||
| - | | ||
| - | /bin/echo -ne " | ||
| - | /bin/date >> / | ||
| - | #/bin/rm -r ~/.mozilla | ||
| - | #/bin/cp -a ~/mozilla ~/.mozilla | ||
| - | | ||
| - | /bin/rm -r / | ||
| - | /bin/cp -a ~/mozilla / | ||
| - | | ||
| - | # Display sleep after 65s | ||
| - | / | ||
| - | | ||
| - | #Hide the mouse | ||
| - | / | ||
| - | | ||
| - | matchbox-window-manager & | ||
| - | | ||
| - | #If I start iceweasel from cmd line instead of here it will use the full screen available. | ||
| - | / | ||
| - | #/ | ||
| - | #/ | ||
| - | #/ | ||
| - | | ||
| - | /bin/sleep 365d | ||
| - | | ||
| - | exit 0 | ||
| - | |||
| - | If you reboot your raspberry pi you may see that it displays the following errors: | ||
| - | <note warning> | ||
| - | **' | ||
| - | This happens because raspbian Stretch uses libinput as it's mouse drivers instead of the evdev. To solve this, uninstall linunput and replace it by evdev drivers. | ||
| - | |||
| - | # apt install --no-install-recommends xserver-xorg-input-evdev | ||
| - | # apt remove xserver-xorg-input-libinput | ||
| - | |||
| - | Reference: https:// | ||
| - | ==== Firefox setup ==== | ||
| - | # cp -pr ~/.mozilla / | ||
| - | # mv / | ||
| - | # ln -s / | ||
| - | |||
| - | Make sure you have the following intructions in your **.xinitrc**. | ||
| - | # vi ~/.xinitrc | ||
| - | /bin/rm -r / | ||
| - | /bin/cp -a ~/mozilla / | ||
| - | |||
| - | # mv / | ||
| - | # ln -s / | ||
| - | ==== Crontab ==== | ||
| - | === acdsn === | ||
| - | # m h dom mon dow | ||
| - | | ||
| - | */6 * * * * acdsn /bin/bash / | ||
| - | */5 * * * * acdsn /bin/bash / | ||
| - | */4 * * * * acdsn /bin/bash / | ||
| - | */3 * * * * acdsn /bin/bash / | ||
| - | | ||
| - | #* * * * * acdsn /bin/bash / | ||
| - | #* * * * * acdsn /bin/bash / | ||
| - | |||
| - | # mkdir /etc/acdsn | ||
| - | # mkdir -p/ | ||
| - | # ln -s / | ||
| - | # chown -R acdsn:acdsn / | ||
| - | $ mkdir -p / | ||
| - | |||
| - | # curl -C - -R -o / | ||
| - | # curl -C - -R -o / | ||
| - | <note important> | ||
| - | |||
| - | # apt install --no-install-recommends jq | ||
| - | |||
| - | === root === | ||
| - | # m h dom mon dow | ||
| - | #*/5 * * * * /bin/bash / | ||
| - | #*/3 * * * * /bin/bash / | ||
| - | */10 * * * * root /bin/bash / | ||
| - | @hourly root /bin/bash / | ||
| - | #* * * * * / | ||
| - | #00 06,18 * * * /bin/bash / | ||
| - | |||
| - | ==== Lighttpd setup ==== | ||
| - | # apt install --no-install-recommends lighttpd | ||
| - | |||
| - | Once you have installed the web server, start it and test if there is any error. | ||
| - | # systemctl start lighttpd.service | ||
| - | |||
| - | Get the raspberry pi ip address and access the web server from a different machine (it could be macOS, windows, linux, etc...). | ||
| - | |||
| - | ~ ifconfig eth0 | ||
| - | eth0: flags=4163< | ||
| - | inet 172.28.12.18 | ||
| - | inet6 fe80:: | ||
| - | ether b8: | ||
| - | RX packets 435 bytes 100953 (98.5 KiB) | ||
| - | RX errors 0 dropped 0 overruns 0 frame 0 | ||
| - | TX packets 500 bytes 66954 (65.3 KiB) | ||
| - | TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 | ||
| - | |||
| - | === PHP installation === | ||
| - | First, you need to install PHP-FPM, which is a process manager for PHP. | ||
| - | # apt install --no-install-recommends php7.0-fpm php7.0-mbstring | ||
| - | |||
| - | <note warning> | ||
| - | php7.0-mbstring is required because we use gettext to translate our website. If it is not installed, you will get a php fatal error. | ||
| - | </ | ||
| - | |||
| - | Then, enable it the typing the following: | ||
| - | # lighttpd-enable-mod fastcgi | ||
| - | # lighttpd-enable-mod fastcgi-php | ||
| - | |||
| - | <note tip> | ||
| - | We could edit the **php.ini** and **lighttpd.conf** files but it's cleaner using **lighttpd-enable-mod** We could edit the php.ini and lighttpd.conf files but it's cleaner using lighttpd-enable-mod command since it only enables the 2 config files that load fastgi, hence not modifying the webserver config file. | ||
| - | </ | ||
| - | |||
| - | Now before we can go reloading Lighttpd, we will have to make changes to its configuration. By default, it is configured to work with PHP-CGI and not PHP-FPM, luckily it is easy to make these changes. | ||
| - | |||
| - | Change the content of fastcgi config file to this: | ||
| - | |||
| - | # vi / | ||
| - | |||
| - | # -*- depends: fastcgi -*- | ||
| - | # / | ||
| - | # http:// | ||
| - | | ||
| - | ## Start an FastCGI server for php (needs the php5-cgi package) | ||
| - | fastcgi.server += ( " | ||
| - | (( | ||
| - | " | ||
| - | " | ||
| - | )) | ||
| - | ) | ||
| - | |||
| - | Restart lighttpd to apply the modifications. | ||
| - | # systemctl restart httpd.service | ||
| - | |||
| - | To test the PHP installation, | ||
| - | # vi / | ||
| - | |||
| - | <?php | ||
| - | phpinfo(); | ||
| - | ?> | ||
| - | |||
| - | And again, test it from a local machine. | ||
| - | |||
| - | Now that PHP is setup, it's time to create a virtual host. In lighttpd, all you need to do is to create a file in / | ||
| - | # vi / | ||
| - | |||
| - | $HTTP[" | ||
| - | server.document-root = "/ | ||
| - | } | ||
| - | |||
| - | <note important> | ||
| - | server.errorlog is not set here because lighttpd only supports one error log file for the server | ||
| - | (it does not support a error log file for each virtual host) | ||
| - | </ | ||
| - | |||
| - | Enable the virtual host you have just created by creatign a symlink to / | ||
| - | # ln -s / | ||
| - | |||
| - | Don't forget to add easydoor to your hosts file. | ||
| - | # vi /etc/hosts | ||
| - | |||
| - | 127.0.0.1 easydoor | ||
| - | |||
| - | <note tip> | ||
| - | If you want to have access logs, you need to enable the accesslog mod. To do that, use the same command we used to enable the fastgci modules. | ||
| - | </ | ||
| - | |||
| - | # lighttpd-enable-mod accesslog | ||
| - | |||
| - | Now, set the access log file location in your **/ | ||
| - | $HTTP[" | ||
| - | server.document-root | ||
| - | accesslog.filename | ||
| - | } | ||
| - | |||
| - | Restart **lighttpd** and see if there are any errors. | ||
| - | |||
| - | <note warning> | ||
| - | Since /var/log is mounted in tmpfs and lighttpd stores its log in / | ||
| - | </ | ||
| - | |||
| - | # vi / | ||
| - | d / | ||
| - | |||
| - | === References === | ||
| - | Install lighttp and enable PHP - [[https:// | ||
| - | Enable PHP on lighttpd - [[https:// | ||
| - | Setup virtual hosts - [[https:// | ||
| - | Virtual host log file warning - [[https:// | ||
| - | Accesslog module activation - [[https:// | ||
| - | Lighttpd fails to create log files - [[https:// | ||
| - | |||
| - | ===== Strike ===== | ||
| - | ==== Crontab ==== | ||
| - | === acdsn === | ||
| - | # m h dom mon dow | ||
| - | @reboot acdsn /bin/bash / | ||
| - | | ||
| - | * * * * * acdsn /bin/bash / | ||
| - | * * * * * acdsn /bin/bash / | ||
| - | |||
| - | ===== Fix backlight missing directory ===== | ||
| - | # mkdir / | ||
| - | | ||
| - | # vi / | ||
| - | d / | ||
operating_systems/raspbian/easydoor_configuration.1563279948.txt.gz · Last modified: 2019/07/16 12:25 by maferreira