Thread: Compiling/Installing as a non-admin user

Compiling/Installing as a non-admin user

From
Ritesh Nadhani
Date:
Hello All

Me and my professor are planning to work upon machine learning in
postgresql over tsearch2. So I have some questions:

We have a server where Postgresql is running without any problem with
postgres username and admin rights. I have a user account in that
server. I plan to compile and run another postgresql for our testing so
I was thinking of how to do that? My prior knowledge of using postgresql
has always been as admin where I have full rights.

As I see, using the default MAKE for postgresql will set the data
directory etc. in /usr/local/data etc which I dont have access to as a user.

So I would like to compile and run postgresql as a normal user with
every thing like data kept in my usr directory. I should be able to run
the instance over separate port and can start and stop it.

Basically, I want to run the server as in user mode....

How should I configure the MAKE and INSTALL in this circumstances? What
are your suggestions....

Ritesh

Re: Compiling/Installing as a non-admin user

From
Thomas Kellerer
Date:
Ritesh Nadhani wrote on 01.11.2006 07:51:
> We have a server where Postgresql is running without any problem with
> postgres username and admin rights.

Interesting. On Windows, PG will *refuse* to run on an account with admin rights.

Re: Compiling/Installing as a non-admin user

From
"Gurjeet Singh"
Date:
You are talking about /usr/local/data; so I assume that you are trying this on Linux or some other Nixen.

You just need to use the --prefix option to configure... Here's what I typically do:

Download/'CVS checkout' the sources. Enter the source directory, and invoke configure like this:

./configure --enable-debug --prefix `pwd`/db CFLAGS=-O0

And the run 'make' and 'make install'. This will install the data in your <sources_dir>/db/data.

HTH...

Regards,

--
gurjeet[.singh]@EnterpriseDB.com
singh.gurjeet@{ gmail | hotmail | yahoo }.com

On 11/1/06, Ritesh Nadhani <riteshn@gmail.com> wrote:
Hello All

Me and my professor are planning to work upon machine learning in
postgresql over tsearch2. So I have some questions:

We have a server where Postgresql is running without any problem with
postgres username and admin rights. I have a user account in that
server. I plan to compile and run another postgresql for our testing so
I was thinking of how to do that? My prior knowledge of using postgresql
has always been as admin where I have full rights.

As I see, using the default MAKE for postgresql will set the data
directory etc. in /usr/local/data etc which I dont have access to as a user.

So I would like to compile and run postgresql as a normal user with
every thing like data kept in my usr directory. I should be able to run
the instance over separate port and can start and stop it.

Basically, I want to run the server as in user mode....

How should I configure the MAKE and INSTALL in this circumstances? What
are your suggestions....

Ritesh

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

Re: Compiling/Installing as a non-admin user

From
Richard Huxton
Date:
Gurjeet Singh wrote:
> You are talking about /usr/local/data; so I assume that you are trying this
> on Linux or some other Nixen.
>
> You just need to use the --prefix option to configure... Here's what I
> typically do:
>
> Download/'CVS checkout' the sources. Enter the source directory, and invoke
> configure like this:
>
> ./configure --enable-debug --prefix `pwd`/db CFLAGS=-O0
>
> And the run 'make' and 'make install'. This will install the data in your
> <sources_dir>/db/data.

And then of course you'll need to remember to set your port to something
other than 5432, and tweak your PATH, PGPORT etc or define some
aliases/wrappers so you don't end up running against the default
installation. Oh, and you'll need to tweak the startup scripts and
logging configuration so you get logs somewhere useful.

I think Tom Lane has a script that lets him switch between different
installations (versions in his case). I only tend to have two versions
active at any one time, so I just define an alias for psql.
   alias psql82='/usr/local/pgsql82/bin/psql -p 5434'
On the rare occasion when I run an 8.2 createdb I need to remember to
put the port number in manually of course.

HTH
--
   Richard Huxton
   Archonet Ltd

Re: Compiling/Installing as a non-admin user

From
Alvaro Herrera
Date:
Ritesh Nadhani wrote:

> As I see, using the default MAKE for postgresql will set the data
> directory etc. in /usr/local/data etc which I dont have access to as a user.

Specify the --prefix=DIR argument to configure, pointing to a directory
you can write (presumably within your $HOME).  You can also pick a port
with --with-port=NNN if you need it.

--
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Re: Compiling/Installing as a non-admin user

From
Thomas Kellerer
Date:
Ritesh Nadhani wrote on 01.11.2006 07:51:
> Hello All
>
> Me and my professor are planning to work upon machine learning in
> postgresql over tsearch2. So I have some questions:
>
> We have a server where Postgresql is running without any problem with
> postgres username and admin rights. I have a user account in that
> server. I plan to compile and run another postgresql for our testing so
> I was thinking of how to do that? My prior knowledge of using postgresql
> has always been as admin where I have full rights.
>
> As I see, using the default MAKE for postgresql will set the data
> directory etc. in /usr/local/data etc which I dont have access to as a
> user.
>
> So I would like to compile and run postgresql as a normal user with
> every thing like data kept in my usr directory. I should be able to run
> the instance over separate port and can start and stop it.
>
> Basically, I want to run the server as in user mode....
>
> How should I configure the MAKE and INSTALL in this circumstances? What
> are your suggestions....
>

I have no experience with PG on Unix/Linux so if I'm missing something please
bear with me.

The port where postmaster is listening on is defined in postgresql.conf which is
local to the data directory.

Couldn't you simply initdb using e.g. $HOME/pgdata, then edit
$HOME/pgdata/postgresql.conf change the port and then start (the already
installed) postmaster from within your acount using the -D switch pointing to
$HOME/pgdata?

As far as I can tell, all you'd need is execute rights on the installed
postmaster (maybe that's the problem...)


Thomas

Re: Updated: Compiling/Installing as a non-admin user

From
Ritesh Nadhani
Date:
Hello All

Thanks for all the suggestions. I was able to configire and compile it.
I set the data directory to one of my directories, use 'initdb'
successfully. I am also able to start the pgsql and can see that it is
running on port 4444 as I had configured.

Now the problem is when I try to create a db using createdb, I get the
error:

createdb: could not connect to database postgres: FATAL:  role "ritesh"
does not exist

I am not sure what is that?

Doing a google gave me:
http://pgfoundry.org/pipermail/pgcluster-general/2006-May/000699.html

 > You must be postgres user to run this. Another option might be
passing > a user switch .

I cannot run with postgres as I dont have access and I am not sure how
to use the user switch? Any help?

I guess once I am through with this, I am successful!

Ritesh

Richard Huxton wrote:
> Gurjeet Singh wrote:
>> You are talking about /usr/local/data; so I assume that you are trying
>> this
>> on Linux or some other Nixen.
>>
>> You just need to use the --prefix option to configure... Here's what I
>> typically do:
>>
>> Download/'CVS checkout' the sources. Enter the source directory, and
>> invoke
>> configure like this:
>>
>> ./configure --enable-debug --prefix `pwd`/db CFLAGS=-O0
>>
>> And the run 'make' and 'make install'. This will install the data in your
>> <sources_dir>/db/data.
>
> And then of course you'll need to remember to set your port to something
> other than 5432, and tweak your PATH, PGPORT etc or define some
> aliases/wrappers so you don't end up running against the default
> installation. Oh, and you'll need to tweak the startup scripts and
> logging configuration so you get logs somewhere useful.
>
> I think Tom Lane has a script that lets him switch between different
> installations (versions in his case). I only tend to have two versions
> active at any one time, so I just define an alias for psql.
>   alias psql82='/usr/local/pgsql82/bin/psql -p 5434'
> On the rare occasion when I run an 8.2 createdb I need to remember to
> put the port number in manually of course.
>
> HTH

Re: Compiling/Installing as a non-admin user

From
Ritesh Nadhani
Date:
Thanks to all of you.

I have get it up and running according to my needs. Help by everybody is
appreciated!

Richard Huxton wrote:
> Gurjeet Singh wrote:
>> You are talking about /usr/local/data; so I assume that you are trying
>> this
>> on Linux or some other Nixen.
>>
>> You just need to use the --prefix option to configure... Here's what I
>> typically do:
>>
>> Download/'CVS checkout' the sources. Enter the source directory, and
>> invoke
>> configure like this:
>>
>> ./configure --enable-debug --prefix `pwd`/db CFLAGS=-O0
>>
>> And the run 'make' and 'make install'. This will install the data in your
>> <sources_dir>/db/data.
>
> And then of course you'll need to remember to set your port to something
> other than 5432, and tweak your PATH, PGPORT etc or define some
> aliases/wrappers so you don't end up running against the default
> installation. Oh, and you'll need to tweak the startup scripts and
> logging configuration so you get logs somewhere useful.
>
> I think Tom Lane has a script that lets him switch between different
> installations (versions in his case). I only tend to have two versions
> active at any one time, so I just define an alias for psql.
>   alias psql82='/usr/local/pgsql82/bin/psql -p 5434'
> On the rare occasion when I run an 8.2 createdb I need to remember to
> put the port number in manually of course.
>
> HTH

Re: Updated: Compiling/Installing as a non-admin user

From
"Shoaib Mir"
Date:
Before using the createdb binary, su the Linux console as the same user which you used while doing the initdb process on your $PGDATA folder.

Thanks,
--------
Shoaib Mir
EnterpriseDB ( www.enterprisedb.com)

On 11/1/06, Ritesh Nadhani <riteshn@gmail.com> wrote:
Hello All

Thanks for all the suggestions. I was able to configire and compile it.
I set the data directory to one of my directories, use 'initdb'
successfully. I am also able to start the pgsql and can see that it is
running on port 4444 as I had configured.

Now the problem is when I try to create a db using createdb, I get the
error:

createdb: could not connect to database postgres: FATAL:  role "ritesh"
does not exist

I am not sure what is that?

Doing a google gave me:
http://pgfoundry.org/pipermail/pgcluster-general/2006-May/000699.html

> You must be postgres user to run this. Another option might be
passing > a user switch .

I cannot run with postgres as I dont have access and I am not sure how
to use the user switch? Any help?

I guess once I am through with this, I am successful!

Ritesh

Richard Huxton wrote:
> Gurjeet Singh wrote:
>> You are talking about /usr/local/data; so I assume that you are trying
>> this
>> on Linux or some other Nixen.
>>
>> You just need to use the --prefix option to configure... Here's what I
>> typically do:
>>
>> Download/'CVS checkout' the sources. Enter the source directory, and
>> invoke
>> configure like this:
>>
>> ./configure --enable-debug --prefix `pwd`/db CFLAGS=-O0
>>
>> And the run 'make' and 'make install'. This will install the data in your
>> <sources_dir>/db/data.
>
> And then of course you'll need to remember to set your port to something
> other than 5432, and tweak your PATH, PGPORT etc or define some
> aliases/wrappers so you don't end up running against the default
> installation. Oh, and you'll need to tweak the startup scripts and
> logging configuration so you get logs somewhere useful.
>
> I think Tom Lane has a script that lets him switch between different
> installations (versions in his case). I only tend to have two versions
> active at any one time, so I just define an alias for psql.
>   alias psql82='/usr/local/pgsql82/bin/psql -p 5434'
> On the rare occasion when I run an 8.2 createdb I need to remember to
> put the port number in manually of course.
>
> HTH

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to majordomo@postgresql.org so that your
       message can get through to the mailing list cleanly