Raspberry pie configuration startup & VNC & Samba

Time:2021-9-20

1. Startup

After burning, the root directory of SD boot partition will appear in the folder of the computer.

1.1 create a new SSH document and enable SSH

Create a new blank TXT file in this directory, and then change the file name to “SSH”. Note that the suffix of the file should be removed to get a blank file of “SSH”. This file is used to turn on the SSH Remote Login Function of raspberry pie (not turned on by default). Because I don’t have a display screen, I need to operate raspberry pie through remote login.

1.2 new WPA_ Supplicant.conf WiFi connection:

Create a new TXT document and copy the following code into the document:


country=CN ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="DLXY" psk="123456789" }

Exit after saving and rename the file “wpa_supplicant. Conf”. I directly use my mobile phone to open the hotspot, which is convenient to view the IP address of raspberry pie on my mobile phone. After these two files are ready, you can insert the SD card into the raspberry pie, power on and turn it on. Not surprisingly, raspberry pie will automatically connect to your mobile hotspot. At this time, open the network hotspot in mobile phone settings to view the device information connected to the mobile hotspot. Then find the IP address of the raspberry pie.

1.3 putty login terminal

file

1.4 modification source:

1.4.1 modify the configuration file:

sudo nano /etc/apt/sources.list

Amend to read:

deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main contrib non-free rpi


deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main contrib non-free rpi

1.4.2 modify the configuration file:

sudo nano /etc/apt/sources.list.d/raspi.list

Amend to read:

deb http://mirror.tuna.tsinghua.edu.cn/raspberrypi/ buster main ui


deb-src http://mirror.tuna.tsinghua.edu.cn/raspberrypi/ buster main ui

1.4.3 update configuration file:

sudo apt-get update

sudo apt-get upgrade

2. Install VNC

2.1 first install VNC on your raspberry Pie:

sudo apt-get install tightvncserver

2.2 after successful installation, open vncserver for raspberry Pie:

sudo tightvncserver

Enter the password as prompted

Completion effect:

file

2.3 install a VNC veiwer on your computer:

https://www.realvnc.com/en/connect/download/viewer/

Enter IP: 1 in sever and then enter the password to open the interface of raspberry pie.

2.4 set VNC startup:

Enter root mode:

sudo su

Open the file / etc / init.d/tightvncserver and edit:

sudo nano /etc/init.d/tightvncserver

Amend to read:

#!/bin/sh
### BEGIN INIT INFO
# Provides: tightvncserver
# Required-Start: $syslog $remote_fs $network
# Required-Stop: $syslog $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts VNC Server on system start.
# Description: Starts tight VNC Server. Script written by James Swineson.
### END INIT INFO
# /etc/init.d/tightvncserver
VNCUSER='pi'
case "$1" in
        start)
                su $VNCUSER -c '/usr/bin/tightvncserver :1'
                echo "Starting TightVNC Server for $VNCUSER"
        ;;
        stop)
                pkill Xtightvnc
                echo "TightVNC Server stopped"
        ;;
        *)
                echo "Usage: /etc/init.d/tightvncserver {start|stop}"
                exit 1
        ;;
esac
exit 0

When finished, press Ctrl + O, then enter to confirm, and then press chrl + X to exit

Then modify the file permissions and enter the following two commands in sequence:

sudo chmod 755 /etc/init.d/tightvncserver


sudo update-rc.d tightvncserver defaults

file

If you need to cancel startup and start VNC automatically, enter the following command:

sudo update-rc.d -f tightvncserver remove

3. Install Samba service

3.1 installing samba and Samba common bin:

sudo apt-get update


sudo apt-get install samba samba-common-bin

3.2 configure the / etc / Samba / smb.conf file:

sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.back


sudo nano /etc/samba/smb.conf

Find the [homes] section of the share definitions section: change the line read only = yes to read only = no, and add the following statement in the last line:

[MyRaspberryPi]

file

3.3 test whether there are errors in the configuration file and modify it accordingly according to the prompts

testparm

3.4 add login account and create password, which must be an existing user of Linux

sudo smbpasswd -a pi

file

3.5 restart Samba service

sudo /etc/init.d/smbd restart

Enter the IP address of raspberry pie in the windows file bar to view the shared folder

Reference link:

https://blog.csdn.net/qq_26035845/article/details/84451511

https://blog.csdn.net/xuzhexing/article/details/90451826

https://blog.csdn.net/naibozhuan3744/article/details/84966149

https://www.cnblogs.com/shellstudio/p/10756419.html

This article is composed of blog one article multi posting platformOpenWriterelease!