Thanks to Adrian for pointing to this site. http://toomuchdata.com/2012/06/25/how-to-install-python-2-7-3-on-centos-6-2/ I was able to get the virtual environment set up and install psycopg2 from there. Now things seem to be working well when I'm logged in as root.
But I need to be able to use the virtualenv as a non-root user, joshmoe. (And start/stop postgresql as this other user)
The command for getting into the virtualenv is:
source /root/Python-2.7.3/projectdir/bin/activate
Understandably, when I run this command as joshmoe, I get a permission denied message:
-bash: /root/Python-2.7.3/projectdir/bin/activate: Permission denied
In an attempt to make this command available to joshmoe, I started with chmod and gave all rwx. Still gave me the same message. So I edited /etc/sudoer to include the following line:
joshmoe ALL=NOPASSWD: /root/Python-2.7.3/projectdir/bin/activate
Now from the joshmoe login, when I run:
sudo source /root/Python-2.7.3/projectdir/bin/activate
I get the following:
sudo: source: command not found
It seems pretty clear to me that I'm not using the sudoers file correctly to specify sourcing this file -- I seem to be giving access to that activate file successfully, but not to the built-in source function. Both of following lines are a no-go in the sudoers file-- syntax error
joshmoe ALL=NOPASSWD: source
joshmoe ALL=NOPASSWD: source /root/Python-2.7.3/projectdir/bin/activate
I've found a good many examples of sudoer statements. But I can't figure out the syntax that will make this work. I'm hoping once I get this one, I'll be able to give access to statements like 'service postgresql status' and so forth.
On Fri, Sep 27, 2013 at 10:58 AM, Adrian Klaver <adrian.klaver@xxxxxxxxx> wrote:
On 09/27/2013 04:45 AM, Augori wrote:
Re: my previous post. I was assuming you are not using Python 2.7 for anything important at this point. That might be an erroneous assumption, in which case truly cleaning house might not be the way to go.
Do you have other ideas?
--
Adrian Klaver
adrian.klaver@xxxxxxxxx