安装¶
安装说明取决于您试图安装 Supervisor 的系统是否具有互联网访问权限。
安装到有互联网接入的系统¶
使用 Pip 网络安装¶
可以使用 pip install
来安装 Supervisor:
pip install supervisor
Depending on the permissions of your system’s Python, you might need
to be the root user to install Supervisor successfully using
pip
.
You can also install supervisor in a virtualenv via pip
.
Internet-Installing Without Pip¶
If your system does not have pip
installed, you will need to download
the Supervisor distribution and install it by hand. Current and previous
Supervisor releases may be downloaded from PyPi. After unpacking the software
archive, run python setup.py install
. This requires internet access. It
will download and install all distributions depended upon by Supervisor and
finally install Supervisor itself.
备注
Depending on the permissions of your system’s Python, you might
need to be the root user to successfully invoke python
setup.py install
.
Installing To A System Without Internet Access¶
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
.
备注
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.
Installing a Distribution Package¶
Some Linux distributions offer a version of Supervisor that is installable through the system package manager. These packages are made by third parties, not the Supervisor developers, and often include distribution-specific changes to Supervisor.
Use the package management tools of your distribution to check availability;
e.g. on Ubuntu you can run apt-cache show supervisor
, and on CentOS
you can run yum info supervisor
.
A feature of distribution packages of Supervisor is that they will usually
include integration into the service management infrastructure of the
distribution, e.g. allowing supervisord
to automatically start when
the system boots.
备注
Distribution packages of Supervisor can lag considerably behind the official Supervisor packages released to PyPI. For example, Ubuntu 12.04 (released April 2012) offered a package based on Supervisor 3.0a8 (released January 2010). Lag is often caused by the software release policy set by a given distribution.
备注
Users reported that the distribution package of Supervisor for Ubuntu 16.04
had different behavior than previous versions. On Ubuntu 10.04, 12.04, and
14.04, installing the package will configure the system to start
supervisord
when the system boots. On Ubuntu 16.04, this was not done
by the initial release of the package. The package was fixed later. See
Ubuntu Bug #1594740
for more information.
创建配置文件¶
一旦 Supervisor 安装完成,运行 echo_supervisord_conf
。这将打印一个 “sample” Supervisor 配置文件到您的终端标准输出。
一旦你看到文件回显到你的终端,重新调用命令 echo_supervisord_conf > /etc/supervisord.conf
。如果你没有根用户权限,这是行不通的。
如果你没有根目录权限,或者你不想把 supervisord.conf
文件放在 /etc/supervisord.conf
目录下,你可以把它放在当前目录下(echo_supervisord_conf > supervisord.conf
)然后用 -c
标志启动 supervisord,以指定配置文件的位置。
“例如:supervisord -c supervisord.conf
。在这种情况下,使用 -c
标志实际上是多余的,因为 supervisord 会在查找文件的其他位置之前,先在当前目录中查找 supervisord.conf
,但它是可以工作的。有关 -c
标志的更多信息,请参见 运行 Supervisor。
一旦您的文件系统上有了配置文件,您就可以开始根据自己的喜好修改它。