RaspberryPi.1.开机与远程桌面

raspberry  3b+

-------------------------------------------------------------------------------

写系统

有很多系统可选,我是第一次玩,所以选择官方定制系统。下载树莓派官方深度定制 Raspbian 系统。

官方下载链接: https://www.raspberrypi.org/downloads/

下载后解压得到 .img 文件。

使用 win32DiskImager 将系统写入sd卡

---------------------------------------------------------------

开机上电

插上 SD卡、网线、电源,上电。

板上有两个指示灯 PWR ACT

PWR 常亮 ,电源正常;ACT 闪烁 ,SD卡正常活动,系统启动。

系统默认账号: pi / raspberry

由于我没有可以用的显示器,就只能使用putty和远程桌面登陆。

都需要先查看板子的ip。

-----------------------------------------------------------------

SSH登陆

需要在sd卡 boot 区 新建一个空白文件ssh ,否则无法登陆。

我使用的是Putty

------------------------------------------------------------

配置WIFI上网

可以在未启动时在SD卡中修改 /boot/wpa_supplicant.conf 文件配置,如果没有新建一个,上电后,系统会加载到/etc/wpa_supplicant/wpa_supplicant.conf ;所以也可以上电后在 /etc/wpa_supplicant/wpa_supplicant.conf 修改文件配置。

country=CN
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
 
network={
ssid="ssid_name"
psk="password"
key_mgmt=WPA-PSK
priority=1
}
 

#priority 是连接优先级数字越大等级越高,不可以为负值

---------------------------------------------------------------------------------

设置静态IP

修改 /etc/dhcpcd.conf 配置文件。文件下写法列子。

interface eth0
static ip_address=192.168.31.81/24
static routers=192.168.31.1
static domain_name_servers=192.168.31.1

interface wlan0
static ip_address=192.168.31.81/24
static routers=192.168.31.1
static domain_name_servers=192.168.31.1

IP为192.168.31.xx/24,一定不能冲突。

设置完成 重启 sudo reboot

---------------------------------------------------------------------------------------------

远程桌面

我是用的是windows自带的远程桌面。

安装

sudo apt-get install tightvncserver xrdp

启动 sudo /etc/init.d/xrdp restart

查看 netstat -tnl

只要 3350 3389 5910 这三个端口处于LISTEN,就没有问题。

------------------------------------------------------------------------------------------------------------------------------

修改时区

找到方法有两个,一是在树莓派设置中修改 sudo raspi-config

选择 4 localisation --- I2 change timezone ---  asia --- shanghai

二是使用NTP(Network Time Protocol,网络时间协议)

1.安装 sudo apt-get install ntpdate

2.启用 sudo timedatectl set-ntp true

3.修改 sudo dpkg-reconfigure tazdata  

  这里就是选择 时区 。

输入 date 查看时间

------------------------------------------------------------------------------------------

更换源

原始的源下载会很慢所以替换国内源。

先备份原文件(这是个好习惯),再修改 /etc/apt/sorces.list 文件的内容

sudo cp /etc/apt/sorces.list /etc/apt/source.list.bak

deb http://mirrors.ustc.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi
deb-src http://mirrors.ustc.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi

可以添加多个源

------------------------------------------------------------------------------------------

via

http://shumeipai.nxez.com/

https://blog.csdn.net/xdw1985829/article/details/38817195

https://www.cnblogs.com/shubin/p/7746399.html

https://www.cnblogs.com/maoguy/p/5678563.html

xrdp/win10 remote desktop fails: https://www.raspberrypi.org/forums/viewtopic.php?p=1045111

原文地址:https://www.cnblogs.com/protogenoi/p/9866981.html