1.使用读卡器烧写完系统后开启SSH服务
在boot盘中新建ssh文件,无后缀
2.安装vim sudo apt-get install vim
/etc/vim/vim
配置sudo vim /etc/vim/vimrc.local
set nu
syntax enable
syntax on
set tabstop=4
set shiftwidth=4
set hlsearch
set wildmenu
3.配置固定ip
打开/etc/dhcpcd.conf文件配置如下:
interface eth0
static ip_address=192.168.137.129/24
static ip6_address=fd51:42f8:caae:d92e::ff/64
static routers=192.168.137.1
static domain_name_servers=192.168.137.1 8.8.8.8 fd51:42f8:caae:d92e::
4.修改阿里镜像源
文件/etc/apt/sources.list
镜像源http://mirrors.aliyun.com/raspbian/raspbian/
修改完之后sudo apt-get update
5.安装VNC(若为桌面版)
sudo apt-get install tightvncserver
tightvncserver 此时为设置密码
启动vncserver
开机启动脚本
/etc/init.d/tightvncserver
#####################################################
#!/bin/sh
### BEGIN INIT INFO
# Provides: tightvncserver
# Required-Start: $syslog $remote_fs $network
# Required-Stop: $syslog $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts VNC Server on system start.
# Description: Starts tight VNC Server. Script written by James Swineson.
### END INIT INFO
# /etc/init.d/tightvncserver
VNCUSER='pi'
case "$1" in
start)
su $VNCUSER -c '/usr/bin/tightvncserver :1'
echo "Starting TightVNC Server for $VNCUSER"
;;
stop)
pkill Xtightvnc
echo "TightVNC Server stopped"
;;
*)
echo "Usage: /etc/init.d/tightvncserver {start|stop}"
exit 1
;;
esac
exit 0
#####################################################
6.安装Mysql
安装 sudo apt-get install mysql-server 过程中会提示输入数据库root密码,自己保管好。
进入数据库管理sudo mysql -u root -p
显示数据库show databases;
使用数据库use mysql;
查看当前用户select host,user from user;
新增用户并赋权grant all on . to ‘username’@’ip’ identified by ‘password’;
实例grant all on . to ‘test’@’%’ identified by ‘test123’; 允许所有ip用%代替ip
刷新权限flush privileges;
修改远程权限/etc/mysql/mariadb.conf.d/50-server.cnf或者/etc/mysql/my.cnf 注释掉bind-address一行
7.若需要添加用户
useradd testuser
passwd testuser
8.设置时间
安装ntp: sudo apt-get install ntpdate
启用:sudo timedatectl set-ntp true
添加环境变量:vim /etc/environment export TZ=’Asia/Shanghai’
sudo dpkg-reconfigure tzdata 选择设置为上海时间
9.开机启动
vim /etc/rc.local 在exit前添加,例:exec /home/app
10.安装pyqt5
树莓派 sudo apt-get install python-pyqt5