-
Notifications
You must be signed in to change notification settings - Fork 360
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove unnecessary sudo commands, since scripts run with root user pr…
…ivileges by default.
- Loading branch information
Showing
3 changed files
with
25 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ check_sys_and_add_source(){ | |
|
||
if check_sys sysRelease centos; then | ||
# 安装依赖 | ||
sudo yum install -y yum-utils | ||
yum install -y yum-utils | ||
|
||
# 添加 Nginx 源 | ||
touch /etc/yum.repos.d/nginx.repo | ||
|
@@ -28,12 +28,12 @@ check_sys_and_add_source(){ | |
|
||
if [[ ${PKG_FLAG} = "1" ]]; then | ||
# 安装nginx 稳定版 | ||
sudo yum-config-manager --disable nginx-mainline | ||
sudo yum install -y nginx | ||
yum-config-manager --disable nginx-mainline | ||
yum install -y nginx | ||
elif [[ ${PKG_FLAG} = "2" ]]; then | ||
# 安装nginx 主线版 | ||
sudo yum-config-manager --enable nginx-mainline | ||
sudo yum install -y nginx | ||
yum-config-manager --enable nginx-mainline | ||
yum install -y nginx | ||
fi | ||
|
||
if [ $? -eq 0 ]; then | ||
|
@@ -42,59 +42,59 @@ check_sys_and_add_source(){ | |
|
||
elif check_sys sysRelease debian; then | ||
# 安装依赖 | ||
sudo apt install -y curl gnupg2 ca-certificates lsb-release | ||
apt install -y curl gnupg2 ca-certificates lsb-release | ||
|
||
if [[ ${PKG_FLAG} = "1" ]]; then | ||
# 添加 Nginx稳定版 源 | ||
echo "deb https://nginx.org/packages/debian `lsb_release -cs` nginx" | sudo tee /etc/apt/sources.list.d/nginx.list | ||
echo "deb https://nginx.org/packages/debian `lsb_release -cs` nginx" | tee /etc/apt/sources.list.d/nginx.list | ||
elif [[ ${PKG_FLAG} = "2" ]]; then | ||
# 添加 Nginx主线版 源 | ||
echo "deb https://nginx.org/packages/mainline/debian `lsb_release -cs` nginx" | sudo tee /etc/apt/sources.list.d/nginx.list | ||
echo "deb https://nginx.org/packages/mainline/debian `lsb_release -cs` nginx" | tee /etc/apt/sources.list.d/nginx.list | ||
fi | ||
|
||
# 导入官方的nginx签名密钥 | ||
curl -fsSL https://nginx.org/keys/nginx_signing.key | sudo apt-key add - | ||
curl -fsSL https://nginx.org/keys/nginx_signing.key | apt-key add - | ||
|
||
# 验证key是否正确 | ||
# 打印如下: | ||
# pub rsa2048 2011-08-19 [SC] [expires: 2024-06-14] | ||
# 573B FD6B 3D8F BC64 1079 A6AB ABF5 BD82 7BD9 BF62 | ||
# uid [ unknown] nginx signing key <[email protected]> | ||
sudo apt-key fingerprint ABF5BD827BD9BF62 | ||
apt-key fingerprint ABF5BD827BD9BF62 | ||
|
||
# 安装nginx | ||
sudo apt update | ||
sudo apt install -y nginx | ||
apt update | ||
apt install -y nginx | ||
|
||
if [ $? -eq 0 ]; then | ||
_echo -i "nginx安装成功." | ||
fi | ||
|
||
elif check_sys sysRelease ubuntu && version_ge ${version} 16.04; then | ||
# 安装依赖 | ||
sudo apt install -y curl gnupg2 ca-certificates lsb-release | ||
apt install -y curl gnupg2 ca-certificates lsb-release | ||
|
||
if [[ ${PKG_FLAG} = "1" ]]; then | ||
# 添加 Nginx稳定版 源 | ||
echo "deb https://nginx.org/packages/ubuntu `lsb_release -cs` nginx" | sudo tee /etc/apt/sources.list.d/nginx.list | ||
echo "deb https://nginx.org/packages/ubuntu `lsb_release -cs` nginx" | tee /etc/apt/sources.list.d/nginx.list | ||
elif [[ ${PKG_FLAG} = "2" ]]; then | ||
# 添加 Nginx主线版 源 | ||
echo "deb https://nginx.org/packages/mainline/ubuntu `lsb_release -cs` nginx" | sudo tee /etc/apt/sources.list.d/nginx.list | ||
echo "deb https://nginx.org/packages/mainline/ubuntu `lsb_release -cs` nginx" | tee /etc/apt/sources.list.d/nginx.list | ||
fi | ||
|
||
# 导入官方的nginx签名密钥 | ||
curl -fsSL https://nginx.org/keys/nginx_signing.key | sudo apt-key add - | ||
curl -fsSL https://nginx.org/keys/nginx_signing.key | apt-key add - | ||
|
||
# 验证key是否正确 | ||
# 打印如下: | ||
# pub rsa2048 2011-08-19 [SC] [expires: 2024-06-14] | ||
# 573B FD6B 3D8F BC64 1079 A6AB ABF5 BD82 7BD9 BF62 | ||
# uid [ unknown] nginx signing key <[email protected]> | ||
sudo apt-key fingerprint ABF5BD827BD9BF62 | ||
apt-key fingerprint ABF5BD827BD9BF62 | ||
|
||
# 安装nginx | ||
sudo apt update | ||
sudo apt install -y nginx | ||
apt update | ||
apt install -y nginx | ||
|
||
if [ $? -eq 0 ]; then | ||
_echo -i "nginx安装成功." | ||
|