英文:
New Relic Silent installation on Amazon Linux 2 ARM 64 bit
问题
我正在尝试在Amazon Linux 2(ARM 64)上以静默模式安装New Relic PHP代理,但不幸的是它进入了交互模式。我已经按照文档中提到的步骤设置了环境变量,我是否漏掉了什么?
export NR_INSTALL_PATH=/usr/bin
export NR_INSTALL_SILENT=1
export NR_INSTALL_KEY=XXYYZZ
wget https://download.newrelic.com/php_agent/release/newrelic-php5-10.10.0.1-linux.tar.gz
gzip -dc newrelic-php5-10.10.0.1-linux.tar.gz | tar xf -
cd newrelic-php5-10.10.0.1-linux/
sudo ./newrelic-install install
输出(这些步骤将我带入交互模式安装,但我想执行静默安装):
New Relic PHP Agent Installation (interactive mode)
===================================================
输入New Relic许可证密钥(或留空):
英文:
I am trying to install New Relic PHP agent on Amazon Linux 2 (ARM 64) in silent mode but unfortunately it is getting into interactive mode. I have set the environment variables as mentioned in the doc. Here are the steps I followed, am I missing something?
export NR_INSTALL_PATH=/usr/bin
export NR_INSTALL_SILENT=1
export NR_INSTALL_KEY=XXYYZZ
wget https://download.newrelic.com/php_agent/release/newrelic-php5-10.10.0.1-linux.tar.gz
gzip -dc newrelic-php5-10.10.0.1-linux.tar.gz | tar xf -
cd newrelic-php5-10.10.0.1-linux/
sudo ./newrelic-install install
Output (These steps are getting me into an interactive mode installation but I want to do a silent installation):
New Relic PHP Agent Installation (interactive mode)
===================================================
Enter New Relic license key (or leave blank):
答案1
得分: 1
sudo 启动的进程,除非明确配置,否则不会继承环境变量。
# 告诉 sudo 保留所需的环境变量,以减少污染
sudo --preserve-env=NR_INSTALL_PATH,NR_INSTALL_SILENT,NR_INSTALL_KEY ./newrelic-install install
# 更短的命令,但可能会有污染的风险(特别是 PATH)
sudo -E ./newrelic-install install
如果 sudo 用户没有权限保留环境变量(sudoers 安全策略),
我们可以使用 `env` 来手动设置它。
sudo env NR_INSTALL_PATH=/usr/bin NR_INSTALL_SILENT=1 NR_INSTALL_KEY=XXYYZZ ./newrelic-install install
英文:
Process started by sudo does not inherit the environment variables unless
explicitly configured to do so.
# Tell sudo to keep the desired environment variables with least contamination
sudo --preserve-env=NR_INSTALL_PATH,NR_INSTALL_SILENT,NR_INSTALL_KEY ./newrelic-install install
# Shorter command, but risk of contamination (especially PATH)
sudo -E ./newrelic-install install
In case the sudo user does not have permission to keep environment variables (sudoers security policy),
we can use env
to set it manually.
sudo env NR_INSTALL_PATH=/usr/bin NR_INSTALL_SILENT=1 NR_INSTALL_KEY=XXYYZZ ./newrelic-install install
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论