Installing uWSGI

Installing from a distribution package

uWSGI is available as a package in several OS/distributions.

Installing from source

To build uWSGI you need Python and a C compiler (gcc and clang aresupported). Depending on the languages you wish to support you will need theirdevelopment headers. On a Debian/Ubuntu system you can install them (and therest of the infrastructure required to build software) with:

  1. apt-get install build-essential python

And if you want to build a binary with python/wsgi support (as an example)

  1. apt-get install python-dev

On a Fedora/Redhat system you can install them with:

  1. yum groupinstall "Development Tools"
  2. yum install python

For python/wsgi support:

  1. yum install python-devel

If you have a variant of make available in your system you can simply runmake. If you do not have make (or want to have more control) simply run:

  1. python uwsgiconfig.py --build

You can also use pip to install uWSGI (it will build a binary with python support).

  1. # Install the latest stable release:
  2. pip install uwsgi
  3. # ... or if you want to install the latest LTS (long term support) release,
  4. pip install https://projects.unbit.it/downloads/uwsgi-lts.tar.gz

Or you can use ruby gems (it will build a binary with ruby/rack support).

  1. # Install the latest stable release:
  2. gem install uwsgi

At the end of the build, you will get a report of the enabled features. Ifsomething you require is missing, just add the development headers and rerunthe build. For example to build uWSGI with ssl and perl regexp support youneed libssl-dev and pcre headers.

Alternative build profiles

For historical reasons when you run ‘make’, uWSGI is built with Python as theonly supported language. You can build customized uWSGI servers using buildprofiles, located in the buildconf/ directory. You can use a specificprofile with:

  1. python uwsgiconfig.py --build <profile>

Or you can pass it via an environment variable:

  1. UWSGI_PROFILE=lua make
  2. # ... or even ...
  3. UWSGI_PROFILE=gevent pip install uwsgi

Modular builds

This is the approach your distribution should follow, and this is the approachyou MUST follow if you want to build a commercial service over uWSGI (seebelow). The vast majority of uWSGI features are available as plugins. Pluginscan be loaded using the –plugin option. If you want to give users the maximumamount of flexibility allowing them to use only the minimal amount ofresources, just create a modular build. A build profile named “core” isavailable.

  1. python uwsgiconfig.py --build core

This will build a uWSGi binary without plugins. This is called the “servercore”. Now you can start building all of the plugins you need. Check theplugins/ directory in the source distribution for a full list.

  1. python uwsgiconfig.py --plugin plugins/psgi core
  2. python uwsgiconfig.py --plugin plugins/rack core
  3. python uwsgiconfig.py --plugin plugins/python core
  4. python uwsgiconfig.py --plugin plugins/lua core
  5. python uwsgiconfig.py --plugin plugins/corerouter core
  6. python uwsgiconfig.py --plugin plugins/http core
  7. ...

Remember to always pass the build profile (‘core’ in this case) as the thirdargument.