Is it possible to install aws-cli package without root permission?
For AWS CLI v2, the recommended solution is passing options -i
and -b
when installing indicating directories for which user has write permissions.
Example:
[user@localhost ~]$ cd Downloads
[user@localhost Downloads]$ curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
[user@localhost Downloads]$ unzip awscliv2.zip
[user@localhost Downloads]$ ./aws/install -i ~/aws-cli -b ~/aws-cli/bin
From Amazon Web Service's documentation:
You can install without
sudo
if you specify directories that you already have write permissions to. Use the following instructions for theinstall
command to specify the installation location:
Ensure that the paths you provide to the
-i
and-b
parameters contain no volume name or directory names that contain any space characters or other white space characters. If there is a space, the installation fails.
--install-dir
or-i
– This option specifies the directory to copy all of the files to.The default value is
/usr/local/aws-cli
.
--bin-dir
or-b
– This option specifies that the mainaws
program in the install directory is symbolically linked to the fileaws
in the specified path. You must have write permissions to the specified directory. Creating a symlink to a directory that is already in your path eliminates the need to add the install directory to the user's$PATH
variable.The default value is
/usr/local/bin
.
(I believe the accepted answer is outdated in that it only works for AWS CLI v1.)
There's a bundled installer for that purpose.
Install aws
command to $HOME/bin
$ wget https://s3.amazonaws.com/aws-cli/awscli-bundle.zip
$ unzip awscli-bundle.zip
$ ./awscli-bundle/install -b ~/bin/aws
Set $PATH
environment variable
$ echo $PATH | grep ~/bin // See if $PATH contains ~/bin (output will be empty if it doesn't)
$ export PATH=~/bin:$PATH // Add ~/bin to $PATH if necessary
Test the AWS CLI Installation
$ aws help
See the following link for details: http://docs.aws.amazon.com/cli/latest/userguide/awscli-install-bundle.html#install-bundle-user