It's possible to install Python packages on your VPS without using 'sudo'. This requires to use Python's Virtual Environment (virtualenv): a tool to keep the dependencies required by different projects in separate places, by creating virtual Python environments for them.
The following steps detail how to install boto-rsync on a DreamHost VPS as a simple user, without using 'sudo'.
- In your users home directory, create a new directory for the Python project and move into it:
[server]$ mkdir my_python [server]$ cd my_python/
- Create the virtual environment:
[server]$ virtualenv venv New python executable in venv/bin/python Installing distribute..................................done. Installing pip...............done.
The command makes a copy of the Python interpreter and libraries from the VPS operating system and puts them in the /venv directory.
- To activate the virtual environment, run the following command:
[server]$ source venv/bin/activate (venv)$
If you now run 'which python' you can see that once the virtual environment is active, the Python interpreter used is no longer the default system version.
- Run the following command to confirm the Python interpreter is now located in your virtualenv.
(venv)$ which python /home/$YOURUSER/my_awscli/venv/bin/pythonNow you're ready to install boto-rsync to use with DreamObjects.
- Use 'pip' to install.
(venv)$ pip install boto_rsync Downloading/unpacking boto-rsync Downloading boto_rsync-0.8.1.tar.gz Running setup.py egg_info for package boto-rsync ---- Downloading/unpacking boto>=2.2.1 (from boto-rsync) Downloading boto-2.40.0.tar.gz (1.4Mb): 1.4Mb downloaded Running setup.py egg_info for package boto [... a bunch of output...] Successfully installed boto-rsync boto Cleaning up...
The installation is now complete. You can now use boto-rsync to upload or download files in DreamObjects. For example:
(venv)$ boto-rsync -a $ACCESS_KEY -s $SECRET_KEY --endpoint objects-us-east-1.dream.io test s3://stefphone test 32.0b of 32.0b 100% 32.0b/s 0:00:00----
If you don't want to enter your access/secret key information each time you execute the command, you can create a .boto file to store them. View the following article for instructions: