Check out how OpenResty XRay helps organizations troubleshoot issues and optimize the performance of their applications.

Learn More LIVE DEMO

This tutorial will demonstrate how to install OpenResty on CentOS 8 via dnf.

screenshot 1

We’ll use this fresh install of CentOS 8 in this tutorial.

We can always goto the web site to find the instructions.


Then click on the Installation link on the left side bar.


And click on the link “official pre-built packages” under the “Binary Packages” section.


As we can see here, we do support a lot of different Linux distributions.


Scroll down to the CentOS section.


We can find all the commands for enabling the yum repository and installing the OpenResty rpm packages.

Back to our CentOS 8 system, first install the standard wget package if you don’t have it already.

sudo dnf -y install wget

screenshot 4

Use wget to download the openresty.repo file from our site.

wget ''

screenshot 5

We move this file into the yum repositories' configuration directory.

sudo mv openresty.repo /etc/yum.repos.d/

screenshot 6

Note that we need sudo here.

We update the yum index database.

sudo dnf check-update

screenshot 8

Now it’s time to install our main RPM package, openresty.

sudo dnf -y install openresty

screenshot 9

Check if the openresty executable is available.

which openresty

screenshot 10

This openresty executable is just a symbolic link.

file `which openresty`

screenshot 11

And check its version.

openresty -V

screenshot 12

We can start the default openresty server like this.

sudo systemctl start openresty

screenshot 13

Check if the nginx processes are up and running.

ps aux|grep nginx

screenshot 14


Test the default home page with the curl command.


screenshot 16

Yay, it’s working.

Note, however, that the resty command-line utility is not installed yet.

which resty

screenshot 18

If you want it, then you can install the openresty-resty RPM package from the same repository.

sudo dnf -y install openresty-resty

screenshot 19

Now it should be ready.

which resty
resty -e 'print("Hello Resty")'

screenshot 20

Similarly, if you want to use the restydoc command-line utility, you should install the openresty-doc package.

sudo dnf -y install openresty-doc

screenshot 21

Now it’s available too. Try it out!

restydoc -s content_by_lua_file

We can also install OPM for installing more Lua modules contributed by the OpenResty community.

sudo dnf -y install openresty-opm

screenshot 23

We can try installing the lua-resty-http library authored by James Hurst.

sudo opm get pintsized/lua-resty-http

screenshot 24

Try loading it with the resty utility.

resty -e 'require "resty.http"'

screenshot 25


There is also a debug build of OpenResty which includes debugging logs and all the internal assertions enabled.

sudo dnf -y install openresty-debug

screenshot 27

We can invoke this debug version of openresty like this.

which openresty-debug

screenshot 28

This openresty-debug executable is also a symbolic link.

file `which openresty-debug`

screenshot 29

We should never use it in production since it is much slower than the release build.

Furthermore, there are also special builds for checking memory issues via Valgrind and Address Sanitizer.

sudo dnf list openresty-valgrind openresty-asan

screenshot 31

Try these when you have memory issues to debug. We may cover these in future tutorials.

To upgrade OpenResty packages to their latest versions, just run these commands.

sudo dnf check-update
sudo dnf upgrade 'openresty*'

screenshot 33

To check all the available packages in our openresty repository.

dnf --disablerepo='*' --enablerepo="openresty" list available

screenshot 34

We’ve got a lot of packages here.

We can find detailed documentation for all these RPM packages on the web page


We have indeed got a lot of packages for the user to choose from.


That’s all I’d like to cover today. Have fun!

If you like this tutorial, please subscribe to this blog site and our YouTube channel. Thank you!

About The Author

Yichun Zhang (Github handle: agentzh), is the original creator of the OpenResty® open-source project and the CEO of OpenResty Inc..

Yichun is one of the earliest advocates and leaders of “open-source technology”. He worked at many internationally renowned tech companies, such as Cloudflare, Yahoo!. He is a pioneer of “edge computing”, “dynamic tracing” and “machine coding”, with over 22 years of programming and 16 years of open source experience. Yichun is well-known in the open-source space as the project leader of OpenResty®, adopted by more than 40 million global website domains.

OpenResty Inc., the enterprise software start-up founded by Yichun in 2017, has customers from some of the biggest companies in the world. Its flagship product, OpenResty XRay, is a non-invasive profiling and troubleshooting tool that significantly enhances and utilizes dynamic tracing technology. And its OpenResty Edge product is a powerful distributed traffic management and private CDN software product.

As an avid open-source contributor, Yichun has contributed more than a million lines of code to numerous open-source projects, including Linux kernel, Nginx, LuaJIT, GDB, SystemTap, LLVM, Perl, etc. He has also authored more than 60 open-source software libraries.