我有一台带有 virtualmin 的 linode 服务器,它托管了我的几个域。我正在尝试寻找有关如何在 Ubuntu 18 上升级到最新稳定版 nginx 的指南,但我在 medium 上找到的唯一一篇文章说,第一步是安装依赖项
$ sudo apt-get install software-properties-common python-software-properties
但收到一条消息
$ sudo apt-get install software-properties-common python-software-properties
sh: 1: $: not found
$ apt-get install software-properties-common python-software-properties
sh: 1: $: not found
本指南的其余部分建议如下,但我不确定该怎么做,因为第一步不起作用
添加 Nginx 稳定版本的存储库
$ sudo add-apt-repository ppa:nginx/stable
现在更新它
$ sudo apt-get update
运行安装
$ sudo apt-get install nginx
When it asks you if you want to keep using the old config or get the new config like this.
Configuration file '/etc/nginx/nginx.conf'
==> Modified (by you or by a script) since installation.
==> Package distributor has shipped an updated version.
What would you like to do about it ? Your options are:
Y or I : install the package maintainer's version
N or O : keep your currently-installed version
D : show the differences between the versions
Z : start a shell to examine the situation
The default action is to keep your current version.
*** nginx.conf (Y/I/N/O/D/Z) [default=N] ?
Select N(No). It will Install the new version of the current config files in /etc/nginx/sites-available directory.
答案1
我不确定你的指示是从哪里来的,但你失败的第一步并不是官方指示的一部分https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-open-source/#stable_vs_mainline
$ sudo wget https://nginx.org/keys/nginx_signing.key
$ sudo apt-key add nginx_signing.key
$ sudo vi /etc/apt/sources.list
deb https://nginx.org/packages/mainline/ubuntu/ bionic nginx
deb-src https://nginx.org/packages/mainline/ubuntu/ bionic nginx
$ sudo apt-get remove nginx-common
$ sudo apt-get update
$ sudo apt-get install nginx