安装脚本

#!/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."