-1

The below 3 lines are part of my shell script, but it is executing first line and copying file properly. In-order execute this rpm file, i need to prompt to root user. Hence, 2nd step i wrote. But it is not executing, hence i'm not able to install the rpm file.

aws s3 cp s3://mybucket/oracle-instantclient12.2-basiclite.rpm /home/user1/ sudo su yum -y install /home/user1/oracle-instantclient12.2-basiclite.rpm

So, any alternate solution to this (sudo su) or tell me how to prompt to root user in-order to install the mentioned rpm file.

Thanks

Sreeni
  • 91
  • 1
  • 3
  • 10
  • aws s3 cp s3://mybucket/oracle-instantclient12.2-basiclite-12.2.0.1.0-1.x86_64.rpm /home/user1/ sudo su yum -y install /home/user1/oracle-instantclient12.2-basiclite-12.2.0.1.0-1.x86_64.rpm – Sreeni Sep 11 '18 at 09:08
  • In the above alignment is not propoer, it is 3 line code (sudo su is 2nd line) and next is 3rd command. – Sreeni Sep 11 '18 at 09:10
  • Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Super User](http://superuser.com/) or [Unix & Linux Stack Exchange](http://unix.stackexchange.com/) would be a better place to ask. – jww Sep 11 '18 at 14:34

3 Answers3

0

You could try using sudo -s or

sudo yum -y install /home/user1/oracle-instantclient12.2-basiclite-12.2.0.1.0-1.x86_64.rpm

The first option switches you to the root user, while the second allows you to run the command as root.

0

aws s3 cp s3://mybucket/oracle-instantclient12.2-basiclite.rpm /home/user1/ && sudo -i yum -y install /home/user1/oracle-instantclient12.2-basiclite.rpm

Silent Legend
  • 11
  • 1
  • 3
0

you'd have to add && (see this answer) in between the two commands and install with sudo yum:

aws s3 cp s3://mybucket/oracle-instantclient12.2-basiclite.rpm /home/user1/ && sudo yum -y install /home/user1/oracle-instantclient12.2-basiclite.rpm

sudo rpm -i /home/user1/oracle-instantclient12.2-basiclite.rpm should also work.

there is no other way to run two commands from a single command-line ...

are you sure the seconds half of the command-line even runs on the remote host? because I'd rather would expect it to be prefixed with send-command (in case running this from a local shell and not on the remote host). it is also not being indicated which Linux distribution you attempt to run the command against; adding the relevant RPM repository and then installing from there, might be the most reliable method of doing so.

Martin Zeitler
  • 1
  • 19
  • 155
  • 216