树莓派环境搭建整理

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值