1.开启ssh连接
首先在tf卡中保存一个ssh的空文
件,为了打开ssh功能。
2.设置无线网连接
设置上网,在tf卡也就是当前的boot盘新建一个wpa_supplicant.conf
的文件,写入上网配置命令:
country=CN
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="WiFi名称"
psk="WiFi密码"
key_mgmt=WPA-PSK
priority=1
}
说明:key_mgmt=WPA-PSK为WiFi安全机制,priority为优先级别
wap的常用操作
wpa_supplicant是一个连接、配置WIFI的工具,它主要包含wpa_supplicant与wpa_cli两个程序. 可以通过wpa_cli来进行WIFI的配置与连接,前提要保证wpa_supplicant正常启动
启动wpa_supplicant应用
wpa_supplicant -D nl80211 -i wlan0 -c /etc/wpa_supplicant.conf -B
-D 驱动程序名称(可以是多个驱动程序:nl80211,wext)
-i 接口名称
-c 配置文件
-B 在后台运行守护进程
启动wpa_cli
wpa_cli -i wlan0 scan //搜索附件wifi热点
wpa_cli -i wlan0 scan_result //显示搜索wifi热点
wpa_cli -i wlan0 status //当前WPA/EAPOL/EAP通讯状态
wpa_cli -i wlan0 ping //pings wpa_supplicant
添加新的连接
wpa_cli -i wlan0 add_network //添加一个网络连接,会返回<network id>
wpa_cli set_network <network id> ssid '"name"' //ssid名称
wpa_cli set_network <network id> psk '“psk”' //密码
wpa_cli set_network <network id> scan_ssid 1
wpa_cli set_network <network id> priority 1 //优先级
保存连接
wpa_cli -i wlan0 save_config //信息保存到默认的配置文件中
断开连接
wpa_cli -i wlan0 disable_network <network id>
连接已有连接
wpa_cli -i wlan0 list_network //列举保存过得连接
wpa_cli -i wlan0 select_network <network id> //连接指定的ssid
wpa_cli -i wlan0 enable_network <network id> //使能制定的ssid
3.显示设置
在boot目录下,找到config.txt
文件,里面许多选项被注释掉了,我们需要在选择以下命令:
# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details
# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1 #类似windows电脑安全模式,分辨率非常小,所有的改动都无法生效
# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
disable_overscan=1 #可以去掉开机屏幕周围的黑色边框
# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16
# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720
# uncomment if hdmi display is not detected and composite is being output
hdmi_force_hotplug=1 #HDMI热拔插(即插即用)
# uncomment to force a specific HDMI mode (this will force VGA)
hdmi_group=2 #DMT模式
hdmi_mode=58 #分辨率为适应屏幕分辨率的选择
# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2 #音频从HDMI接口
# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4 如果有干扰或显示不正常,可以添加信号量,增加范围从1(用于短电缆)到7(用于长电缆)。
# uncomment for composite PAL
#sdtv_mode=2
#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800
# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on
# Uncomment this to enable infrared communication.
#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18
# Additional overlays and parameters are documented /boot/overlays/README
# Enable audio (loads snd_bcm2835)
dtparam=audio=on
[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
dtoverlay=vc4-fkms-v3d
max_framebuffers=2
[all]
#dtoverlay=vc4-fkms-v3d
红字为一些重要配置
4.更换镜像源
将 /etc/apt/sources.list
文件中默认的源地址 http://raspbian.raspberrypi.org/
替换为 http://mirrors.ustc.edu.cn/raspbian/
即可。
说明:http://mirrors.ustc.edu.cn/raspbian/
为中科大镜像源,推荐,比较快而且软件比较新
raspbian 2018-04-19 之后的镜像默认源已经更改,用如下命令替换:
sudo sed -i 's|raspbian.raspberrypi.org|mirrors.ustc.edu.cn/raspbian|g' /etc/apt/sources.list
编辑文件后,请使用 sudo apt-get update
命令,更新软件索引。
5.远程桌面连接
1)使用xrdp
安装:sudo apt-get install xrdp
然后运行Windows远程桌面(mstsc),输入ip进行连接
2)使用VNC
安装:sudo apt-get install tightvncserver
打开:sudo tightvncserver
在Windows上安装VNC Veiwer,在Sever中输入IP:1之后输入密码
查看端口命令监听:netstat -tnl
3350 3389(windows默认远程端口) 22 (ssh)
LISTEN为监听状态