怎樣建立一個營銷的公司網(wǎng)站抖音seo搜索優(yōu)化
樹莓派基本配置
文章目錄
- 樹莓派基本配置
- 前言
- 硬件準(zhǔn)備
- 樹莓派刷機(jī)
- 串口方式登錄樹莓派
- 接入網(wǎng)絡(luò)
- ssh方式登錄樹莓派
- 更換國內(nèi)源
- xrdp界面登錄樹莓派
- 遠(yuǎn)程文件傳輸FileZilla
前言
樹莓派是一款功能強(qiáng)大且價(jià)格實(shí)惠的小型計(jì)算機(jī),非常適合作為學(xué)習(xí)編程、物聯(lián)網(wǎng)項(xiàng)目、家庭自動化等領(lǐng)域的開發(fā)平臺。本文將詳細(xì)介紹如何從零開始配置一臺樹莓派3B+,包括硬件準(zhǔn)備、刷機(jī)、串口登錄、網(wǎng)絡(luò)接入、更換國內(nèi)源、SSH登錄以及通過XRDP進(jìn)行圖形界面登錄。
硬件準(zhǔn)備
- 樹莓派3B+:具備四核CPU、1GB RAM和板載Wi-Fi及藍(lán)牙功能。
- SD卡:建議使用品牌如閃迪,容量至少8GB,用于存儲樹莓派的操作系統(tǒng)。
- 讀卡器:用于將SD卡連接到電腦進(jìn)行刷寫操作。
- CH340 USB轉(zhuǎn)串口模塊(可選):如果你的電腦沒有串口,或者想要更穩(wěn)定的串口通信,可以考慮使用CH340模塊。
- 電源適配器:為樹莓派提供穩(wěn)定的5V/2A電源。
- HDMI線(可選):用于連接顯示器進(jìn)行初始配置。
- USB鍵盤和鼠標(biāo)(可選):同樣用于初始配置。## 樹莓派刷機(jī)
樹莓派刷機(jī)
- 下載鏡像
下載鏡像可以選擇去官網(wǎng)下載:https://raspberrypi.com/software/operating-systems/
如果想帶界面就下載帶界面的, - 寫入鏡像
先使用SD format軟件,格式化你的sd卡。再使用樹莓派的燒錄軟件進(jìn)行燒錄。地址:https://www.raspberrypi.com/software/ - 配置
打開鏡像燒錄工具,選擇要安裝的鏡像,再配置WiFi信息(用來查看樹莓派的IP;可以是家里的WiFi,電腦熱點(diǎn)…)和用戶信息,如圖。
配置wifi:
開啟SSH服務(wù):
按道理這么配置沒什么問題,到時(shí)候開啟樹莓派就可以連接到網(wǎng)絡(luò)。
那么如果你照著做了,那么不出意外的話就要出意外了。
他并沒有按照你的想法,連接上了wifi,打開了ssh服務(wù),還是需要手動來開啟。
串口方式登錄樹莓派
由于樹莓派串口默認(rèn)的是藍(lán)牙連接的,所以我們需要斷開藍(lán)牙,打開串口連接。
將燒錄完的SD卡,插回電腦。修改以下文件
cmdline.txt文件的內(nèi)容修改為
dwc_otg.lpm_enable=0 console=tty1 console=serial0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
config.txt文件內(nèi)容修改為
# 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# 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# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4# 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 the lirc-rpi module
#dtoverlay=lirc-rpi# Additional overlays and parameters are documented /boot/overlays/README# Enable audio (loads snd_bcm2835)
dtparam=audio=ondtoverlay=pi3-disable-bt
start_x=1
gpu_mem=128
此后將SD卡取出插到樹莓派上,使用串口轉(zhuǎn)ttl就可以串口登錄。
連接電腦使用Moba進(jìn)行串口連接。
接入網(wǎng)絡(luò)
樹莓派連接網(wǎng)絡(luò),你可以通過用HDMI線連接顯示屏后,通過鼠標(biāo)鍵盤的方式對其進(jìn)行網(wǎng)絡(luò)配置??梢酝ㄟ^以下方法進(jìn)行。
sudo nano /etc/wpa_supplicant//wpa_supplicant.conf
輸入內(nèi)容:
保存
ssh方式登錄樹莓派
我們鍵入命令sudo raspi-config
,通過選擇interlacing Options.。打開SSH服務(wù)。
之后我們就可以使用Moba進(jìn)行SSH連接了。
如果沒有連上網(wǎng),說明沒有開啟射頻
rfkill list
需要打開網(wǎng)卡
rfkill unblock all
sudo ifconfig wlan0 up
系統(tǒng)已經(jīng)存在打開的多個wpa_supplicant實(shí)例,執(zhí)行killall wpa_supplicant殺死所有wpa_supplicant即可。
固定IP地址
可以修改/etc/rc.local
中的內(nèi)容達(dá)到效果
sudo nano /etc/rc.local
這個是操作系統(tǒng)初始話時(shí)會調(diào)用的shell腳本
至此配置完閉
更換國內(nèi)源
1, 默認(rèn)的源是國外的,apt-get 安裝的時(shí)候失敗,我們更新成國內(nèi)的源
2,使用命令
sudo nano /etc/apt/sources.list
把原本的用#注釋了加上中國的源
xrdp界面登錄樹莓派
進(jìn)行界面登錄樹莓派我們需要使用開源軟件xrdp
使用命令
- 下載xrdp
sudo apt-get install xrdp
- 使用遠(yuǎn)程桌面連接
使用電腦自帶軟件,進(jìn)行連接。
當(dāng)連接成功則能進(jìn)入畫面,跟用HDMI線進(jìn)行連接顯示的畫面一致。
遠(yuǎn)程文件傳輸FileZilla
在虛擬機(jī)中,我們常使用的是共享文件夾,在樹莓派中,當(dāng)然我們也可以使用moba工具進(jìn)行傳輸文件,但是我們常用的工具還是FileZilla。
連接上后,左邊為windows文件,右邊為樹莓派文件。