Raspbian-Debian

Installing Raspbian/Debian on a Raspberry Pi.

 

Debian 10
=========
# Rasbian Image Lite
# Textmode install
# After initial boot do a reboot
shutdown -r now

#System: Password user pi; Hostname; Boot_To_CLI; Disable auto-login
#Rasbian default password: pi:raspberry
#
#OpenElec: root:openelec (xxx:nsfw)
#username: pi
#password: 

sudo su -

passwd 
passwd pi

raspi-config
Network options -> Hostname
Boot options -> Desktop/CLI -> CLI
Boot options -> Wait for network at boot -> No
Localisation options - Change timezone: Europe/Amsterdam
Interfacing options: SSH enable; SPI enabled; I2C enabled; 1-wire enabled; Remote GPIO disable; Serial shell & Port disable

Localisation options - Change Locale to: LANG=en_US.UTF-8
Default locale for all users : en_US.UTF-8

Reboot

#Network
vi /etc/dhcpcd.conf
# Example static IP configuration:
interface eth0
static ip_address=192.168.178.###/24
#static ip6_address=fd51:42f8:caae:d92e::ff/64
static routers=192.168.178.1
static domain_name_servers=208.67.222.222 208.67.220.220


#ethtool -s eth0 speed 100 duplex full autoneg off
#ethtool -s eth0 autoneg off

shutdown -r now

#Connect vi MobaXterm..


ssh-keygen
cd .ssh
vi authorized_keys
chmod 400 authorized_keys
(Connect via ssh from remote system)
cat unix4life:/root/.ssh/id_rsa.pub > tuinhuis:/root/.ssh/authorized_keys
cat unix4life:/root/.ssh/id_rsa.pub > sandbox:/root/.ssh/authorized_keys


apt-get -y update
apt-get -y upgrade
apt-get -y dist-upgrade

# rpi-update => DO NOT use 'rpi-update' as part of a regular update process.
/opt/vc/bin/vcgencmd version
# https://github.com/raspberrypi/firmware

shutdown -r now

# Search package: apt-cache search <keyword>

apt-get install autoconf libmcrypt-dev libssl-dev wget git-core dstat lsof telnet dnsutils ethtool nmap arp-scan traceroute zip unzip python-dev bc mcrypt sysstat nmon speedtest-cli msmtp msmtp-mta mailutils mutt wiringpi iperf screen expect libmcrypt*


apt-get -y install mariadb-server mariadb-client

mysql_secure_installation
Enter current password for root (enter for none):
Set root password? [Y/n] Y
New password: 
Re-enter new password:
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y

apt-get -y install apache2 apache2-doc apache2-utils

#apt-cache search php7

apt-get -y install php7.3 libapache2-mod-php7.3

apt-get -y install php7.3-mysql php7.3-gd php7.3-zip php7.3-opcache php-pear php-apcu


service apache2 restart

apt-get install autoconf gcc libc6 libmcrypt-dev make libssl-dev wget autogen automake pkg-config git-core samba samba-common-bin dstat lsof telnet dnsutils ethtool nmap arp-scan mysql-utilities lynx ntfs-3g openvpn traceroute minidlna build-essential libgd-dev cu gsm-utils minicom zip unzip python-dev bc mcrypt sysstat nmon rpi-update davfs2 speedtest-cli msmtp msmtp-mta mailutils mutt wiringpi python-serial iperf screen expect snmpd libsnmp-dev snmp snmp-mibs-downloader snmptrapd netstat-nat libmcrypt*

Questions: WINS enabled => No
dav2fs "non-root access" => No

mkdir /var/log/sysstat


apt-get -y install msmtp msmtp-mta mailutils

touch /etc/msmtprc
chmod 640 /etc/msmtprc

vi /etc/msmtprc
# Gmail specifics
# Accounts will inherit settings from this section
defaults
auth on
tls on
tls_certcheck off
# tls_trust_file /etc/ssl/certs/ca-certificates.crt
logfile /var/log/msmtp.log
aliases /etc/aliases
# Gmail specifics
account gmail
host smtp.gmail.com
port 587
from <info@FQDN>
user <Username>@gmail.com
password <Password>
# Default
account default : gmail

 


> /etc/motd

vi /etc/update-motd.d/10-uname
#!/bin/sh
#uname -snrvm


vi /etc/ssh/sshd_config
PermitRootLogin prohibit-password
ChallengeResponseAuthentication no
UsePAM no
VersionAddendum none
Banner none


systemctl restart sshd

WiringPi
--------
#cd /
#git clone git://git.drogon.net/wiringPi
#cd wiringPi
#git pull origin
#./build
apt-get -y install wiringpi


smbpasswd -a pi 


vi /etc/hosts (disable all ip6 lines)
127.0.0.1 localhost
..........

........
#::1 localhost ip6-localhost ip6-loopback
#ff02::1 ip6-allnodes
#ff02::2 ip6-allrouters
#127.0.1.1 raspberrypi


cat /boot/cmdline.txt
dwc_otg.lpm_enable=0 console=tty1 root=PARTUUID=2dad1732-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait

vi /etc/default/bluetooth
#BLUETOOTH_ENABLED=1
BLUETOOTH_ENABLED=0

vi /etc/default/keyboard
XKBMODEL="pc105"
XKBLAYOUT="us"
XKBVARIANT="euro"
XKBOPTIONS=""
BACKSPACE="guess"


vi /boot/config.txt
dtparam=i2c_arm=on
#dtparam=i2s=on
dtparam=spi=on
dtoverlay=w1-gpio,gpiopin=4
#

 


vi /etc/sysctl.conf
vm.swappiness=1
vm.min_free_kbytes=16384


vi /etc/avahi/avahi-daemon.conf
#use-ipv6=yes
use-ipv6=no

chmod 750 /home/*


Enlarge swap to 1024 MB
vi /etc/dphys-swapfile
#CONF_SWAPSIZE=100
CONF_SWAPSIZE=1024
#CONF_MAXSWAP=2048
CONF_MAXSWAP=1024

dphys-swapfile setup
dphys-swapfile swapon

rm /etc/cron.d/gsm-utils

systemctl disable bluetooth
systemctl disable triggerhappy
systemctl disable hciuart.service
systemctl disable avahi-daemon
systemctl disable This email address is being protected from spambots. You need JavaScript enabled to view it.
systemctl disable This email address is being protected from spambots. You need JavaScript enabled to view it.
systemctl disable wpa_supplicant.service
systemctl disable alsa-state.service


echo 'blacklist ipv6' >> /etc/modprobe.d/raspi-blacklist.conf
echo 'blacklist brcmfmac' >> /etc/modprobe.d/raspi-blacklist.conf
echo 'blacklist brcmutil' >> /etc/modprobe.d/raspi-blacklist.conf

 


systemctl disable minidlna
#systemctl disable minidlnad
#systemctl disable samba
systemctl disable smbd
systemctl disable nmbd

 

vi /etc/rc.local
# By default this script does nothing.
touch /forcefsck
echo 100 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo "0" > /sys/bus/w1/devices/w1_bus_master1/w1_master_search
# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi


shutdown -r now

  Donate now via the Paypal button on the top in US Dollar and on the bottom in Euro