树莓派安装弱网服务

1.安装树莓派系统

#下载地址
https://www.raspberrypi.org/downloads/

2.更新系统

apt-get update -y

3.准备环境

安装pip

#下载setuptools
https://pypi.org/project/setuptools/#files
#解压安装
python setup.py install
#下载pip
https://pypi.org/project/pip/#files
#解压安装
python setup.py install

安装Python依赖库

pip install atc_thrift atcd django-atc-api django-atc-demo-ui django-atc-profile-storage

安装git

apt-get install git -y

4.安装配置create_ap服务

git clone https://github.com/oblique/create_ap
cd create_ap
make install

测试

create_ap wlan0 eth0 MyAccessPoint

5.安装配置augmented-traffic-control服务

git clone https://github.com/facebookarchive/augmented-traffic-control
django-admin startproject atcui
cd atcui

修改atcui/settings.py文件

INSTALLED_APPS = (
    ...
    # Django ATC API
    'rest_framework',
    'atc_api',
    # Django ATC Demo UI
    'bootstrap_themes',
    'django_static_jquery',
    'atc_demo_ui',
    # Django ATC Profile Storage
    'atc_profile_storage',
)

修改atcui/urls.py文件

from django.views.generic.base import RedirectView
from django.conf.urls import include

urlpatterns = [
    ...
    # Django ATC API
    url(r'^api/v1/', include('atc_api.urls')),
    # Django ATC Demo UI
    url(r'^atc_demo_ui/', include('atc_demo_ui.urls')),
    # Django ATC profile storage
    url(r'^api/v1/profiles/', include('atc_profile_storage.urls')),
    url(r'^$', RedirectView.as_view(url='/atc_demo_ui/', permanent=False)),
]

测试

python manage.py migrate

6.安装配置supervisor服务

安装服务

apt-get install supervisor -y

修改/etc/supervisord/supervisord.conf文件
添加

[program:wifi]
command=create_ap wlan0 eth0 MyAccessPoint MyAccessPoint
stdout_events_enabled=true
stderr_events_enabled=true

[program:atcd]
command=/usr/local/bin/atcd --atcd-wan eth0 --atcd-lan eth1 --atcd-burst-size 12000 --atcd-mode secure 
stdout_events_enabled=true
stderr_events_enabled=true

[program:atcui]
command=python manage.py runserver 0.0.0.0:8000
stdout_events_enabled=true
stderr_events_enabled=true

重启服务

service supervisord restart 

7.参考地址

pip

https://pypi.org

create_ap

https://github.com/oblique/create_ap

augmented-traffic-control

https://github.com/facebookarchive/augmented-traffic-control

你可能感兴趣的:(树莓派安装弱网服务)