menu Chancel's Blog
rss_feed lightbulb_outline

在WSL下配置Supervisor

warning 知悉:这篇文章距离上次更新超过720天,文中部分信息可能已失效。

Windows Subsystem for Linux(简称WSL)是一个为在Windows 10上能够原生运行Linux二进制可执行文件(ELF格式)的兼容层,即Windows10的子系统Linux。

WSL系统是个残缺版的Linux,在这里记录一下如何在WSL(Ubuntu16.04)版本下安装supervisor并配置Web界面。

更换WSL软件源

  • 查看版本

    chancel@chancel-cp:/mnt/c/Users/ycs10$ lsb_release -c
    Codename:       xenial
    
  • 更改软件源

    • 根据查看版本返回的Codename替换掉下面列表中的xenial

      deb http://mirrors.aliyun.com/ubuntu/ xenial main multiverse restricted universe
      deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main multiverse restricted universe
      deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main multiverse restricted universe
      deb http://mirrors.aliyun.com/ubuntu/ xenial-security main multiverse restricted universe
      deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main multiverse restricted universe
      deb-src http://mirrors.aliyun.com/ubuntu/ xenial main multiverse restricted universe
      deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main multiverse restricted universe
      deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main multiverse restricted universe
      deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main multiverse restricted universe
      deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main multiverse restricted universe
      

安装Supervisor

  • 安装Python2.7

    sudo apt-get install python python-pip
    
  • 安装Supervisor

    sudo pip install supervisor
    

配置Supervisor

  • 编辑Supervisor文件

    sudo vim /etc/supervisord/supervisord.conf
    
  • 配置参考

    • 根据情况修改youruseryourpasswd
    • 如果需要暴露给外网访问,请将127.0.0.1修改成0.0.0.0
    • 注意logfile路径必须存在

    ; supervisor config file
    [inet_http_server]
    port = 127.0.0.1:9001
    username = your_user
    password = your_passwd
    
    [unix_http_server]
    file=/var/run/supervisor.sock   ; (the path to the    socket file)
    chmod=0700                       ; sockef file mode    (default 0700)
    
    [supervisord]
    logfile=/var/log/supervisor/supervisord.log ; (main    log file;default $CWD/supervisord.log)
    
    pidfile=/var/run/supervisord.pid ; (supervisord    pidfile;default supervisord.pid)
    childlogdir=/var/log/supervisor            ;    ('AUTO' child log dir, default $TEMP)
    
    ; the below section must remain in the config file    for RPC
    ; (supervisorctl/web interface) to work, additional    interfaces may be
    ; added by defining them in separate rpcinterface:    sections
    [rpcinterface:supervisor]
    supervisor.rpcinterface_factory =    supervisor.rpcinterface:make_main_rpcinterface
    
    [supervisorctl]
    serverurl=unix:///var/run/supervisor.sock ; use a    unix:// URL  for a unix socket
    
    ; The [include] section can just contain the    "files" setting.  This
    ; setting can list multiple files (separated by    whitespace or
    ; newlines).  It can also contain wildcards.  The    filenames are
    ; interpreted as relative to this file.  Included    files *cannot*
    ; include files themselves.
    
    [include]
    files = /etc/supervisor/conf.d/*.conf
    
  • 启动supervisor

    sudo supervisord -c /etc/supervisord/supervisord.conf
    

阅读 - 129
分类 - 操作系统
创建于 2019-03-15 10:07:07
阅读 - 129
分类 - 操作系统
创建于 2019-03-15 10:07:07
博文目录

[[replyMessage== null?"发表评论":"@" + replyMessage.m_author]]

account_circle
email
web_asset
textsms

评论列表([[messageList.data.items.length]])

[[messageItem.create_time]]
[[messageItem.m_environ.browser]] [[messageItem.m_environ.os]] [[messageItem.m_environ.device]]
[[subMessage.m_author]] @ [[subMessage.parent_message.m_author]]
[[subMessage.create_time]]
[[subMessage.m_environ.browser]] [[subMessage.m_environ.os]] [[subMessage.m_environ.device]]