一键安装Openresty

安装脚本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash
# Check if OpenResty is already installed
if command -v openresty &> /dev/null; then
echo "OpenResty is already installed."
exit
fi
# Add OpenResty software repository
sudo apt-get update
sudo apt-get install -y curl gnupg2 ca-certificates lsb-release
echo "deb http://openresty.org/package/ubuntu $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/openresty.list
curl -fsSL https://openresty.org/package/pubkey.gpg | sudo apt-key add -
sudo apt-get update
# Install OpenResty
sudo apt-get install -y openresty
# Install OpenResty OPM
sudo apt-get install -y openresty-opm
echo "OpenResty is now installed."