Raspberry Pi: Difference between revisions
mNo edit summary |
mNo edit summary |
||
| Line 3: | Line 3: | ||
[[Category:20171222]] | [[Category:20171222]] | ||
= LAMP stack | = LAMP stack = | ||
Note: requires xml and mbstring packages | Linux - Apache - MySQL - PHP | ||
Note: Mediawiki requires xml and mbstring packages | |||
<syntaxhighlight lang=bash> | <syntaxhighlight lang=bash> | ||
| Line 13: | Line 15: | ||
= SSH Remote control = | = SSH Remote control = | ||
You can use remote shell to control your Raspberry Pi without directly connected mouse, keyboard and screen. | |||
<syntaxhighlight lang=bash> | <syntaxhighlight lang=bash> | ||
| Line 19: | Line 21: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== Ssh copy local file to remote == | == Ssh copy local file to remote machine == | ||
<syntaxhighlight lang=bash> | <syntaxhighlight lang=bash> | ||
| Line 25: | Line 27: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Nautilus ssh access, in the | And back: | ||
<syntaxhighlight lang=bash> | |||
scp pi@192.168.1.2:/home/pi/Downloads/file.zip /path/to/local/file.zip | |||
</syntaxhighlight> | |||
Nautilus ssh access, in the addressbar type: | |||
<blockquote> | |||
<nowiki> | <nowiki> | ||
ssh://pi@192.168.1.2 | ssh://pi@192.168.1.2 | ||
</nowiki> | </nowiki> | ||
</blockquote> | |||
Ssh root access is not allowed by default but could be convenient for use with Nautilus | Ssh root access is not allowed by default but could be convenient for use with Nautilus | ||
| Line 44: | Line 54: | ||
</blockquote> | </blockquote> | ||
You can now access the machine as root with Nautilus, in the | You can now access the machine as root with Nautilus, in the addressbar type: | ||
<blockquote> | |||
<nowiki> | <nowiki> | ||
ssh://root@192.168.1.2/ | ssh://root@192.168.1.2/ | ||
</nowiki> | </nowiki> | ||
</blockquote> | |||
== Allow ssh scripting without a password request, based on keys == | == Allow ssh scripting without a password request, based on keys == | ||
| Line 100: | Line 112: | ||
= Performance tuning = | = Performance tuning = | ||
== Memory == | == Memory == | ||
| Line 111: | Line 119: | ||
Raspberry Pi lowered GPU memory from 64 to 32 MB | Raspberry Pi lowered GPU memory from 64 to 32 MB | ||
== | == CPU, Diskspace == | ||
Slim down Raspberry Pi by removing some packages == | Slim down Raspberry Pi by removing some packages == | ||
Revision as of 17:47, 22 December 2017
LAMP stack
Linux - Apache - MySQL - PHP
Note: Mediawiki requires xml and mbstring packages
sudo apt-get install apache2 mysql-server php php-mysql php-xml php-mbstring
SSH Remote control
You can use remote shell to control your Raspberry Pi without directly connected mouse, keyboard and screen.
ssh pi@192.168.1.2
Ssh copy local file to remote machine
scp /path/to/local/file.zip pi@192.168.1.2:/home/pi/Downloads/file.zip
And back:
scp pi@192.168.1.2:/home/pi/Downloads/file.zip /path/to/local/file.zip
Nautilus ssh access, in the addressbar type:
ssh://pi@192.168.1.2
Ssh root access is not allowed by default but could be convenient for use with Nautilus Note: better set this back to 'no' when you are done
sudo nano /etc/ssh/sshd_config
PermitRootLogin yes
You can now access the machine as root with Nautilus, in the addressbar type:
ssh://root@192.168.1.2/
Allow ssh scripting without a password request, based on keys
You want the script to execute without it stopping to ask for a password.
Root session:
sudo -i
Generate keys, accept defaults:
ssh-keygen -t rsa
Create dir on remote:
ssh pi@192.168.1.2 mkdir -p .ssh
Add pub key to pi@192.168.1.2 authorized_keys:
cat .ssh/id_rsa.pub | ssh pi@192.168.1.2 'cat >> .ssh/authorized_keys'
Should work now without password:
ssh pi@192.168.1.2
Maybe needed, for some versions of ssh
cat .ssh/id_rsa.pub | ssh pi@192.168.1.2 'cat >> .ssh/authorized_keys2' ssh pi@192.168.1.2 chmod 700 .ssh ssh pi@192.168.1.2 chmod 640 .ssh/authorized_keys2
VNC
For mouse and screen people.
Performance tuning
Memory
Raspberry Pi lowered GPU memory from 64 to 32 MB
CPU, Diskspace
Slim down Raspberry Pi by removing some packages ==
- Edu-related packages
apt-get -y remove --purge idle apt-get -y remove --purge python3-pygame apt-get -y remove --purge python-pygame apt-get -y remove --purge python-tk apt-get -y remove --purge idle3 apt-get -y remove --purge python3-tk apt-get -y remove --purge python3-rpi.gpio apt-get -y remove --purge python-serial apt-get -y remove --purge python3-serial apt-get -y remove --purge python-picamera apt-get -y remove --purge python3-picamera apt-get -y remove --purge python3-pygame apt-get -y remove --purge python-pygame apt-get -y remove --purge python-tk apt-get -y remove --purge python3-tk apt-get -y remove --purge debian-reference-en apt-get -y remove --purge dillo apt-get -y remove --purge x2x apt-get -y remove --purge scratch apt-get -y remove --purge nuscratch apt-get -y remove --purge timidity apt-get -y remove --purge smartsim apt-get -y remove --purge penguinspuzzle apt-get -y remove --purge pistore apt-get -y remove --purge sonic-pi apt-get -y remove --purge python3-numpy apt-get -y remove --purge python3-pifacecommon apt-get -y remove --purge python3-pifacedigitalio apt-get -y remove --purge python3-pifacedigital-scratch-handler apt-get -y remove --purge python-pifacecommon apt-get -y remove --purge python-pifacedigitalio apt-get -y remove --purge oracle-java8-jdk apt-get -y remove --purge minecraft-pi apt-get -y remove --purge python-minecraftpi apt-get -y remove --purge wolfram-engine apt-get -y autoremove
Remove all packages marked 'rc'.
dpkg --list |grep "^rc" | cut -d " " -f 3 | xargs dpkg --purge