Is it possible to install aws-cli package without root permission?

*爱你&永不变心* 提交于 2021-01-21 03:49:05

问题


As title suggested, I haven't been able to find a good way to install aws-cli (https://github.com/aws/aws-cli/) without having the root access (or equivalent of sudo privileges).

The way Homebrew setup on Mac is hinting at it may be possible, provided that a few directories and permissions are set in a way to facility future installs. However, I have yet to find any approach in Linux (specially, Red Hat Enterprise Linux or CentOS distroes).

I am also aware of SCL from RHEL (https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Developer_Guide/scl-utils.html) But again, it requires sudo.


回答1:


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




回答2:


Obviously, the answers is possible. The trick is to install the whole stack in an alternate location on the host machine.

So altinstall python, then easy_intsall, then pip. Here are the command history in my log.

cd
mkdir installations
cd installations/
curl -O https://www.python.org/ftp/python/2.7/Python-2.7.tar.bz2
tar xjf Python-2.7.tar.bz2 
cd Python-2.7
mkdir -p ~/usr/local
make altinstall prefix=~/usr/local exec-prefix=~/usr/local
~/usr/local/bin/python2.7 -V
ln -s ~/usr/local/bin/python2.7 ~/usr/local/bin/python
echo "export $PATH=~/usr/local/bin:$PATH" >> ~/.bashrc
source ~/.bashrc
cd
mkdir virtualenv
cd virtualenv/
curl -O https://raw.github.com/pypa/virtualenv/master/virtualenv.py
mkdir ~/envs
python virtual-python.py --prefix=~/env/aws
curl -O http://peak.telecommunity.com/dist/ez_setup.py
~/env/aws/bin/python ez_setup.py
echo "export $PATH=~/env/aws/bin:~/usr/local/bin:$PATH" >> ~/.bashrc
source ~/.bashrc
easy_install virtualenv
virtualenv --no-site-packages ~/env/awscli
source ~/env/awscli/bin/activate
pip -V
pip install awscli

These are helpful links that I followed to help me achieve that goal.

Install Python in an alternate location

Install Python stack without root privilege




回答3:


You can install without root access with the --user flag to pip:

pip install --user -U awscli

(Hat tip to Etan Reisner who wrote this in a comment).



来源:https://stackoverflow.com/questions/26123740/is-it-possible-to-install-aws-cli-package-without-root-permission

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!