1.下载树莓派系统镜像:
https://shumeipai.nxez.com/download#os
2.制作系统盘:
使用Win32DiskImager将下载好的系统镜像写入SD卡。启动系统就可以登陆,默认用户名pi,默认密码raspberry。
3.树莓派键盘设置:
启动后使用键盘输入符号可能会有错位的情况,需要进行键盘设置。
sudo raspi-config
选择Localisation Options

选择Change Keyboard Layout

选择Generic 104-key pc
选择other
选择English (US)
剩下默认选择。
4.查看网络连接:
查看网络情况
ifconfig
关闭wifi
sudo ifconfig wlan0 down
开启wifi
sudo ifconfig wlan0 up
执行开启wifi命令时可能会有operation not possible due to rf-kill。rfkill是一个内核级别的管理工具,可以打开和关闭设备的蓝牙和wifi。
#列出所有可用设备
rfkill list all
0: phy0: Wireless LAN
Soft blocked: yes
Hard blocked: no
2: hci0: Bluetooth
Soft blocked: yes
Hard blocked: no
可以看出无线网设备Wireless LAN的软件锁处于开启状态。
#打开编号0的设备
rfkill unblock 0
之后就可以执行开启wifi的命令。
5.连接WiFi:
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
network={
ssid="你的wifi热点名"
psk="你的wifi密码"
scan_ssid=1 #如果是隐藏的无线网(隐藏ssid)则要加这个配置参数
priority=2 #连接优先级,多个网络时有效
}
设置静态IP:
sudo vi /etc/dhcpcd.conf
#设置以下参数
interface wlan0
static ip_address=192.168.xxx.xxx/24
static routers=你的默认网关
static domain_name_servers=你的默认网关 8.8.8.8
sudo reboot #重启
6.开机自开启ssh权限:
sudo /etc/init.d/ssh start
设置开机自开启ssh权限
sudo raspi-config
选择Interfacing Options
选择ssh,选择yes开启ssh
7.配置国内镜像:
sudo vi /etc/apt/sources.list
#替换原有镜像
deb http://mirrors.tuna.tsinghua.edu.cn/raspberry-pi-os/raspbian/ buster main non-free contrib rpi
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspberry-pi-os/raspbian/ buster main non-free contrib rpi
sudo vi /etc/apt/sources.list.d/raspi.list
#替换原有镜像
deb http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ buster main ui
替换完成后进行更新。
#更新软件源列表
sudo apt-get update
#更新软件版本
sudo apt-get upgrade
sudo apt-get dist-upgrade
#更新系统内核
sudo rpi-update
8.安装vim
sudo apt-get remove vim-common
sudo apt-get install vim
设置vim支持右键粘贴,在vim中执行:
:set mouse-=a
9.安装mysql
apt-get install mysql-server
设置密码
sudo mysqladmin -u root password "new_password";
配置远程连接
sudo vim /etc/mysql/mariadb.conf.d/50-server.cnf
#bind-address=0.0.0.0
1130错误
use mysql;
select 'host' from user where user='root';
update user set host='%' where user='root';
flush privileges;
1698错误
update user set plugin='unix_socket' where user="root";
select plugin from user where user="root";
update user set user.Host='%' where user.User='root';
flush privileges;
grant all privileges on *.* to root@'%' identified by 'your_root_password';
10.常用命令
重启:
sudo reboot
shutdown -r now
关机:
sudo shutdown -h now
sudo halt
sudo poweroff
sudo init 0

9462

被折叠的 条评论
为什么被折叠?



