wifi_hotpot/README.md

79 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## Linux嵌入板卡自发热点连接无线网络
### 介绍
Linux嵌入板卡发出热点供客户端连接客户端通过浏览器访问热点连接到Linux嵌入板卡的热点并进行交互。
### 环境准备
#### (1) 安装依赖项:
```
sudo apt-get update
sudo apt-get install hostapd dnsmasq
```
#### (2) 克隆项目到本地并安装依赖:
```
// 克隆项目到本地 https or ssh
git clone http://43.132.157.186:3000/gaohz/wifi_hotpot.git
cd wifi_hotpot
```
#### (3) 安装Python端环境依赖
```
sudo pip install flask psutil
```
#### (4) 配置开机自启动服务项:
- 编辑
```
sudo vim /etc/systemd/system/wifi_hotspot.service
```
- 内容:
```
[Unit]
Description=WiFi Hotspot Wrapper
After=network.target
Wants=network.target
[Service]
Type=oneshot
ExecStart=python3 /home/orangepi/wifi_hotpot/wifi_manager.py
WorkingDirectory=/home/orangepi/wifi_hotpot
User=root
[Install]
WantedBy=default.target
```
- 配置
```
sudo systemctl daemon-reload
sudo systemctl enable wifi_hotspot.service
# sudo systemctl disable wifi_hotspot.service
```
- 开始(测试)
```
sudo systemctl start wifi_hotspot.service
```
- 查看输出
```
sudo systemctl status wifi_hotspot.service
```
#### (5) 配置热点信息:
- 手动连接`http://192.168.12.1/`
- 连接成功后,输入用户名密码,即可进入交互界面。