====== Raspberry Pi 2 ======
$ lscpu
Architecture: armv7l
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 1
Core(s) per socket: 4
Socket(s): 1
Model name: ARMv7 Processor rev 5 (v7l)
CPU max MHz: 900,0000
CPU min MHz: 600,0000
===== Installation =====
$ sudo dd bs=4M if=2015-09-24-raspbian-jessie.img of=/dev/sdX
===== Initial Configuration =====
- Edit /boot/config.txt.$ sudo nano /boot/config.txt
disable_overscan=1
hdmi_force_hotplug=1
hdmi_group=2
hdmi_mode=48
hdmi_drive=2
config_hdmi_boost=4
start_x=0
gpu_mem=8
dtparam=spi=off
dtparam=i2c_arm=off
max_usb_current=1 # maximum current for usb
- Run raspi-config.$ sudo raspi-configPlease select each option that you interested in to config.
* Expand Filesystem.
* Change User Password.
* Boot Options: B1 Console.
* Internationalisation Options: Change Locale and Change Timezone.
* Advanced Options: A2 Hostname, A3 Memory Split, A6 SPI, A7 I2C, A8 Serial.
===== Updating and Upgrading =====
- Update packages index from official repository. $ sudo apt-get update
- Upgrade installed packages. $ apt-get upgrade
===== Package Management =====
- List installed packages and save it to a file. $ dpkg-query --show -f '${Package}\n' > pkgs.list
- Edit the file and let the names of packages which you want to remove in it, i.e. graphical environment, applications and friends.
- Run 'apt-get autoremove' to remove unneeded packages. $ sudo apt-get autoremove
- Install some packages. $ sudo apt-get install screen vrms
===== Custom Configuration =====
- Disable triggerhappy. $ sudo systemctl disable triggerhappy
- Edit /etc/bash.bashrc $ sudo nano $HOME/.bashrc
PS1="\[\033[01;32m\]\u@\h\[\033[00m\]:\W \[\033[01;34m\]\A \[\033[00m\]\`if [ \$? == 0 ]; then echo \:\); else echo '\[\033[0;31m\]:('; fi\`\[\033[00m\] "
- Disable password authentication for SSH.
* Generate authentication key in the machine which you want to login from, and copy the result to the Raspberry. $ ssh-keygen
$ ssh-copy-id user@raspberry
* Edit sshd_config and restart sshd.$ sudo nano /etc/ssh/sshd_config
PasswordAuthentication no$ sudo systemctl restart ssh
===== Debmirror =====
* Install debmirror. $ sudo apt-get install debmirror
* Edit debmirror scripts. $ nano debmirror-debian
$ nano debmirror-raspbian
* Find the Debian and Raspbian archive keyrings on their official repositories respectively.
* Add Debian and Raspbian archive keyrings. $ gpg --keyring debian-archive-keyring.gpg --export|gpg --no-default-keyring --keyring trustedkeys.gpg --import
$ gpg --keyring raspbian.public.key --export|gpg --no-default-keyring --keyring trustedkeys.gpg --import
* List the added keys. $ gpg --list-keys --with-colons
* Test the scripts by running them.
* Add crontab. $ nano /etc/cron.d/debmirror or /etc/crontab
* Restart crontab service. $ sudo systemctl restart cron
===== Storage =====
* # mkfs.ext4 /dev/sda1
* # mkdir /media/dir
* # mount /dev/sda1 /media/dir/
* # nano /etc/fstab
===== Cron =====
$ sudo nano /etc/crontab
$ sudo service cron restart
===== Wireless =====
- # cd /etc/network
- # cp interfaces interfaces.orig
- # nano interfacesauto lo eth0
iface lo inet loopback
iface eth0 inet dhcp
#iface wlan0 inet static
# address 192.168.1.4
# netmask 255.255.255.0
# gateway 192.168.1.24
# dns-nameservers 208.67.222.222 208.67.220.220
# wpa-ssid SSID
# wpa-psk
- # wpa_passphrase SSID passphrase >> interfaces
- # nano interfaces
- # service networking restart
- wlanup.sh
===== Lighttpd =====
* apt-get install lighttpd php5-cgi
* $ sudo mv 10-dir-listing.conf ../conf-enabled/
* $ sudo service lighttpd restart
* # systemctl restart lighttpd.service
* $ sudo ln -s /media/dir /var/www/dir
*
* lighty-enable-mod dir-listing
* lighty-enable-mod fastcgi
* lighty-enable-mod fastcgi-php
* lighty-enable-mod mod-rewrite
* lighty-enable-mod accesslog
* server.modules = (
...
"mod_rewrite",
...
)
...
$HTTP["host"] == "stwn.duniasemu.org" {
server.document-root = "/home/user/public_html/"
}
===== Managed DNS =====
- Change nameservers in your domain panel
- Add hosts in your managed DNS panel, i.e. CNAME
- Add CNAME in Pagekite
===== MariaDB =====
* mysql -u root -p
* create database db
* grant all on db.* to 'db'@'localhost' identified by 'greatpassword';
===== PHP =====
* opcache/xcache
===== systemctl =====
* systemctl enable/disable [service]
* systemctl start/stop/restart/status [service].service
===== Applications =====
* aria2
* screen -S tes
* screen -r tes