官方提供的操作系统是 Raspbian,这是 Debian 系统的定制版。
树莓派系统装好后,在系统根目录创建 SSH 文件,开启 SSH 协议,注意没有后缀名
1.开启账号
1 | sudo passwd root |
2 | // 输入两遍密码 |
3 | |
4 | sudo nano /etc/ssh/sshd_config |
5 | Ctrl+W 快捷键 搜索 PermitRootLogin without-password |
6 | 修改 PermitRootLogin without-password 为 PermitRootLogin yes |
7 | Ctrl+O 快捷键 保存 |
8 | Ctrl+X 快捷键 退出 Nano 编辑器 |
9 | |
10 | sudo passwd --unlock root // 打开账号 |
11 | sudo reboot // 重启系统 |
2.更换软件源
推荐清华源 官网
查看树莓派版本
1 | getconf LONG_BIT # 查看系统位数 |
2 | uname -a # kernel 版本 |
3 | /opt/vc/bin/vcgencmd version # firmware版本 |
4 | strings /boot/start.elf | grep VC_BUILD_ID # firmware版本 |
5 | cat /proc/version # kernel |
6 | cat /etc/os-release # OS版本资讯 |
7 | cat /etc/issue # Linux distro 版本 |
8 | cat /etc/debian_version # Debian版本编号 |
我使用的是debian 版本是9.4
1 | # 编辑 `/etc/apt/sources.list` 文件,删除原文件所有内容,用以下内容取代: |
2 | deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main non-free contrib |
3 | deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main non-free contrib |
4 | |
5 | # 编辑 `/etc/apt/sources.list.d/raspi.list` 文件,删除原文件所有内容,用以下内容取代: |
6 | deb http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ stretch main ui |
7 | |
8 | sudo apt-get update // 更新软件源 |
3.安装 Node
1 | curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - |
2 | sudo apt install nodejs |
查看版本
1 | node -v |
2 | v8.16.2 |