树莓派版本:Zero W

几个需要用到的网站

Raspbain官方系统镜像下载:https://www.raspberrypi.org/software/operating-systems/
阿里云开源镜像站:https://developer.aliyun.com/mirror/
Java官方下载地址:https://www.oracle.com/cn/java/technologies/javase/javase-jdk8-downloads.html
balenaEtcher官方下载地址:https://www.balena.io/etcher/
MobaXterm官方下载地址:https://mobaxterm.mobatek.net/download.html

安装系统

需要准备一张32G的SD卡
系统安装工具为:balenaEtcher
安装RNDIS驱动
配置config.txt、cmdline.txt、ssh、,通过OTG接口本地ssh连接
config.txt

  1. //最后一行
  2. dtoverlay=dwc2

cmdline.txt

  1. //rootawait 后面空一格
  2. modules-load=dwc2,g_ether

wpa_supplicant.conf

  1. country=CN
  2. ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
  3. update_config=1
  4. network={
  5. ssid="******"
  6. psk="******"
  7. key_mgmt=WPA-PSK
  8. priority=1
  9. }

推荐使用MobaXterm这个远程连接工具

ssh登录地址:raspberrypi.local
默认用户名:pi
默认密码:raspberry

环境搭建

修改登录密码

  1. sudo passwd pi

修改apt源

/etc/apt/sources.list

  1. deb https://mirrors.aliyun.com/raspbian/raspbian/ buster main non-free contrib
  2. deb-src https://mirrors.aliyun.com/raspbian/raspbian/ buster main non-free contrib

安装基本软件

  1. //更新软件源列表
  2. sudo apt-get update
  3. //升级软件包
  4. sudo apt-get upgrade
  5. //安装neovimgitneofetch
  6. sudo apt-get install neovim git neofetch

python

  1. //安装pip
  2. sudo apt-get install python3-pip
  3. //修改pip阿里源
  4. nvim ~/.pip/pip.conf
  5. [global]
  6. index-url = https://mirrors.aliyun.com/pypi/simple/
  7. [install]
  8. trusted-host=mirrors.aliyun.com

java

  1. //安装java8
  2. sudo apt-get install openjdk-8-jdk

mariadb

  1. //安装mariadb服务器
  2. sudo apt-get install mariadb-server
  3. //修改mariadb服务器root密码
  4. sudo mysqladmin -u root password
  5. //MariaDbMySQL5.x远程登录账号
  6. GRANT ALL PRIVILEGES ON *.* TO 'hui'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
  7. //MySQL8.0远程登录账号
  8. CREATE user 'hui'@'%' IDENTIFIED BY '123456';
  9. GRANT ALL PRIVILEGES ON *.* TO 'hui'@'%' WITH GRANT OPTION;
  10. //刷新权限
  11. FLUSH PRIVILEGES;

tomcat

  1. //安装tomcat
  2. sudo apt-get install tomcat9
  3. //war包部署位置
  4. /var/lib/tomcat9/webapps
  5. //server.xml位置
  6. /etc/tomcat9/server.xml

nginx

  1. //安装nginx
  2. sudo apt-get install nginx
  3. //网站部署位置
  4. /var/www/html
  5. //服务器配置文件
  6. /etc/nginx/sites-enabled/default

php

  1. sudo apt-get install php7.3 php7.3-fpm php7.3-mysql php7.3-xml php7.3-gd php7.3-curl