通过命令行在Raspbian Lite版本上配置树莓派无线网络WIFI

测试环境:

 树莓派2代b+、3代b+, 树莓派操作系统为Raspbian Lite 4.14版本

如果您无法访问通过图形用户界面在Raspberry Pi上配置WiFi,则可按照下面的方法完成配置。 另请注意,不需要安装其他软件; 一切都已包含在Raspberry Pi中。

Continue reading “通过命令行在Raspbian Lite版本上配置树莓派无线网络WIFI”

树莓派定时任务Cron

Cron是Unix系统的一个配置定期任务的工具,用于定期或者以一定的时间间隔执行一些命令或者脚本;

运行crontab和-e选项来编辑cron table:

crontab -e

Cron配置文件说明

# m h  dom mon dow   command  
  
# * * * * *  command to execute  
# ┬ ┬ ┬ ┬ ┬  
# │ │ │ │ │  
# │ │ │ │ │  
# │ │ │ │ └───── 星期中的哪一天(0-7)(从0到6代表星期日到星期六,也可以使用名字;7是星期天,等同于0)  
# │ │ │ └────────── 月份 (1 - 12)  
# │ │ └─────────────── 月份中的日 (1 - 31)  
# │ └──────────────────── 小时 (0 - 23)  
# └───────────────────────── 分钟 (0 - 59)

 

在树莓派中安装PIP

PIP是一款非常方便的Python包管理工具,可在Python开发过程中大大提高开发效率,在玩树莓派时也需要跑一些python脚本,下面给大家介绍如何在树莓派中安装PIP。

树莓派系统已经预装有python2,我们只需要在终端执行下面的命令即可快速完成安装。

下载get-pip.py脚本:

wget https://bootstrap.pypa.io/get-pip.py

执行get-pip.py脚本:

sudo python get-pip.py

 

如何在树莓派上搭建DNS域名查询服务器

通过下面的命令安装 dnsmasq:

sudo apt-get install -y dnsmasq

启动dnsmasq服务:

sudo service dnsmasq start

编辑 /etc/dnsmasq.conf 文件更改dnsmasq配置信息:

# Dnsmasq.conf for raspberry pi
# /etc/dnsmasq.conf
# http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq.conf.example
 
# Set up your local domain here
domain=raspberry.local
resolv-file=/etc/resolv.dnsmasq
min-port=4096
server=8.8.8.8
server=8.8.4.4
 
# Max cache size dnsmasq can give us, and we want all of it!
cache-size=10000
 
# Below are settings for dhcp. Comment them out if you dont want
# dnsmasq to serve up dhcpd requests.
# dhcp-range=192.168.0.100,192.168.0.149,255.255.255.0,1440m
# dhcp-option=3,192.168.0.1
# dhcp-authoritative

重启dnsmasq服务:

sudo service dnsmasq restart

如需添加静态dns 指向,则在 /etc/dnsmasq.d/ 路径下新建立static.conf 文件,内容如下:

address=/dustit.me/127.0.0.1

完成后记得重启一下dnsmasq服务。