1.到supervisor官网看官方文档
1.1 官方文档链接
官方文档中介绍了supervisor离线安装与在线安装两种方式。在线安装比较简单,此文仅介绍离线安装方式
http://supervisord.org/installing.html#installing-to-a-system-without-internet-access
1.2 从离线方式部分,可以看到有如下提示内容
If the system that you want to install Supervisor to does not have Internet access, you’ll need to perform installation slightly differently. Since both pip
and python setup.py install
depend on internet access to perform downloads of dependent software, neither will work on machines without internet access until dependencies are installed. To install to a machine which is not internet-connected, obtain the following dependencies on a machine which is internet-connected:
setuptools (latest) from https://pypi.org/pypi/setuptools/.
Copy these files to removable media and put them on the target machine. Install each onto the target machine as per its instructions. This typically just means unpacking each file and invoking python setup.py install
in the unpacked directory. Finally, run supervisor’s python setup.py install
.
Note:
Depending on the permissions of your system’s Python, you might need to be the root user to invoke python setup.py install successfully for each package.
1.3 本文基础环境介绍
注1:本文环境基础为:Centos7.6 + python2.7.5 + setuptools 41.1.0 + supervisor 4.0.4
注2:python、setuptools以及supervisor的版本是有版本兼容要求的
2.按照官方步骤,先安装setuptools工具
2.1 到官网下载压缩包,并上传到服务器指定路径下
https://pypi.org/project/setuptools/41.1.0/#files
2.2 解压安装
获取压缩包setuptools-41.1.0.zip
,通过命令unzip setuptools-41.1.0.zip
解压到本地,进入解压后的文件夹中,通过命令python setup.py install
安装setuptools工具,如下,即为安装完成后的末尾输出
......
Installed /usr/lib/python2.7/site-packages/setuptools-41.1.0-py2.7.egg
Processing dependencies for setuptools==41.1.0
Finished processing dependencies for setuptools==41.1.0
[root@vincent setuptools-41.1.0]#
至此,setuptools安装完毕
注意:需要考虑本地python版本与setuptools的版本兼容性
3.安装supervisord
3.1 到官网下载压缩包,并上传到服务器指定路径下
https://pypi.org/project/supervisor/4.0.4/
3.2 解压安装
获取压缩包supervisor-4.0.4.tar.gz
,通过命令tar zxvf supervisor-4.0.4.tar.gz
解压到本地,进入解压后的文件夹中,通过命令python setup.py install
安装supervisor工具,如下,即为安装完成后的末尾输出
......
Installed /usr/lib/python2.7/site-packages/supervisor-4.0.4-py2.7.egg
Processing dependencies for supervisor==4.0.4
Searching for meld3>=1.0.0
Reading http://mirrors.tencentyun.com/pypi/simple/meld3/
Best match: meld3 2.0.1
Downloading http://mirrors.tencentyun.com/pypi/packages/53/af/5b8b67d04a36980de03505446d35db39c7b2a01b9bac1cb673434769ddb8/meld3-2.0.1.tar.gz#sha256=3ea266994f1aa83507679a67b493b852c232a7905e29440a6b868558cad5e775
Processing meld3-2.0.1.tar.gz
Writing /tmp/easy_install-4Xupfl/meld3-2.0.1/setup.cfg
Running meld3-2.0.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-4Xupfl/meld3-2.0.1/egg-dist-tmp-9W1497
zip_safe flag not set; analyzing archive contents...
Adding meld3 2.0.1 to easy-install.pth file
Installed /usr/lib/python2.7/site-packages/meld3-2.0.1-py2.7.egg
Finished processing dependencies for supervisor==4.0.4
[root@vincent supervisor-4.0.4]#
通过如下命令可查看当前supervisor的版本信息
[root@vincent ~]# /usr/bin/supervisord -v
4.0.4
[root@vincent ~]#
至此,supervisor离线安装完毕
注意:需要考虑本地python版本、setuptools版本与supervisor的兼容性
3.3 安装过程中其他情况
若安装过程中遇到如下问题
......
Installing echo_supervisord_conf script to /usr/bin
Installing pidproxy script to /usr/bin
Installing supervisorctl script to /usr/bin
Installing supervisord script to /usr/bin
Installed /usr/lib/python2.7/site-packages/supervisor-4.0.4-py2.7.egg
Processing dependencies for supervisor==4.0.4
Searching for meld3>=1.0.0
Reading https://pypi.python.org/simple/meld3/
Couldn't find index page for 'meld3' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/
No local packages or download links found for meld3>=1.0.0
error: Could not find suitable distribution for Requirement.parse('meld3>=1.0.0')
[root@10-60-246-120 supervisor-4.0.4]# supervisorctl status
Traceback (most recent call last):
File "/usr/bin/supervisorctl", line 5, in <module>
from pkg_resources import load_entry_point
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 3250, in <module>
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 3234, in _call_aside
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 3263, in _initialize_master_working_set
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 583, in _build_master
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 900, in require
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 786, in resolve
pkg_resources.DistributionNotFound: The 'meld3>=1.0.0' distribution was not found and is required by supervisor
[root@10-60-246-120 supervisor-4.0.4]#
说明当前python环境中缺少meld3
模块,且supervisor对该模块要求是meld3>=1.0.0
需要到官网下载此meld3_1.0.2版本https://pypi.org/project/meld3/1.0.2/#files
,然后上传到服务器,解压,并参考上述安装setup和super的操作,同理安装meld3即可python setup.py install
......
Installed /usr/lib/python2.7/site-packages/meld3-1.0.2-py2.7.egg
Processing dependencies for meld3==1.0.2
Finished processing dependencies for meld3==1.0.2
[root@10-60-246-120 meld3-1.0.2]#
[root@10-60-246-120 meld3-1.0.2]#
[root@10-60-246-120 meld3-1.0.2]# supervisorctl status
http://localhost:9001 refused connection
[root@10-60-246-120 meld3-1.0.2]#
[root@10-60-246-120 meld3-1.0.2]# /usr/bin/supervisord -v
4.0.4
[root@10-60-246-120 meld3-1.0.2]#