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

sudo su -

passwd pi

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


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=
static domain_name_servers=

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

shutdown -r now

#Connect vi MobaXterm..

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

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
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
#uname -snrvm

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

systemctl restart sshd

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

smbpasswd -a pi 

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

#::1 localhost ip6-localhost ip6-loopback
#ff02::1 ip6-allnodes
#ff02::2 ip6-allrouters
# 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

vi /etc/default/keyboard

vi /boot/config.txt


vi /etc/sysctl.conf

vi /etc/avahi/avahi-daemon.conf

chmod 750 /home/*

Enlarge swap to 1024 MB
vi /etc/dphys-swapfile

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"

shutdown -r now

  If you like my website, feel free to donate via the Paypal button. Thank you!