2

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):
oguz ismail
  • 1
  • 16
  • 47
  • 69
user182944
  • 7,897
  • 33
  • 108
  • 174

1 Answers1

1

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
lambda-larry
  • 343
  • 1
  • 7