Forum OpenACS Development: Re: New Installation Question

Collapse
Posted by russ m on
generally speaking, you do not have to reinstall the entire system. it is perfectly sufficient to remove the packages.
aptitude remove openacs (for instance)

FYI, on Debian (and Ubuntu) if you've messed something up and want to start again, you should purge packages instead of removing... "remove" leaves configuration files behind in case you want to reinstall at some stage, but if your configuration is broken this isn't what you want... "purge" will remove every trace of a package that apt is aware of...

aptitude purge openacs

(not actually required in this case, but a general apt tip)

Collapse
Posted by Raul Rodriguez on
Thank you for your help. I am still having problems.

With default install everything works fine.

I did the following to reinstall:

sudo killall aolserver4-nsd
sudo dpkg --purge openacs
sudo dpkg --purge postgresql-8.2

sudo aptitude install postgresql-8.2
sudo aptitude install openacs

However, when I keep all defaults, except for the default Database owner username, I get the standard DB Confirguration OACS error. The patch mentioned above seems to have been applied already.

[04/Sep/2008:18:37:46][11808.3083016384][-main-] Notice: Database API: The following pools are available for OpenACS: pool2 pool3 pool1
[04/Sep/2008:18:37:46][11808.3083016384][-main-] Notice: dbdrv: opening database 'postgres:localhost:5432:openacs'
[04/Sep/2008:18:37:46][11808.3083016384][-main-] Notice: Opening openacs on localhost
[04/Sep/2008:18:37:46][11808.3083016384][-main-] Error: Ns_PgOpenDb(postgres):  Could not connect to localhost:5432:openacs:  could not connect to server: No\
 such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

Any ideas?

Also is there any documentation on how to create a new instance on the same machine?

TIA

Collapse
Posted by Steffen Tiedemann Christensen on
Is PostgreSQL running? What happens when you try to run:
psql openacs
(or psql -p 5432 openacs

If you get the same error, you should try starting up the postgresql backend. It might be done with something like this:
sudo /etc/init.d/postgresql start

Collapse
Posted by Raul Rodriguez on
No luck, I get the same db errror. I did:
psql: FATAL:  role "root" does not exist
remadmin@ticket:~$ sudo psql openacs
psql: FATAL:  role "root" does not exist
remadmin@ticket:~$ sudo psql -p 5432 openacs
psql: FATAL:  role "root" does not exist
remadmin@ticket:~$ sudo /etc/init.d/postgresql start
sudo: /etc/init.d/postgresql: command not found
remadmin@ticket:~$ sudo /etc/init.d/postgresql-8.2 start
 * Starting PostgreSQL 8.2 database server                                                                                                             [ OK ]
remadmin@ticket:~$ sudo killall aolserver4-nsd
remadmin@ticket:~$ sudo /etc/init.d/openacs start
Starting web server: openacs.
remadmin@ticket:~$ sudo /etc/init.d/postgresql-8.3 start
 * Starting PostgreSQL 8.3 database server                                                                                                             [ OK ]
remadmin@ticket:~$ sudo killall aolserver4-nsd
remadmin@ticket:~$ sudo /etc/init.d/openacs start
Starting web server: openacs.

Collapse
Posted by Steffen Tiedemann Christensen on
Alright, so this starts up the database server (which is good to keep in mind since that's a prerequisite for everything else):

sudo /etc/init.d/postgresql-8.3 start

And since you're using version 8.3, I'm fairly certain you'll need to use port 5433 in your config file (and possibly specifiy -p 5433 when calling psql/createuser/createdb later on.)

I'm not a wizard when it comes to configuring PostgreSQL on Debian, so you should have a look in the OpenACS install guide. A few quick pointers though:

createuser creates a role or a user for accessing the database.
createdb reate a new database
psql accesses that database.

As a general rule you should never, ever call these three with sudo; instead create a postgresql user for yourself using createuser. This is usually done like this:

sudo su - postgres
createuser -p 5433 <yourusername>
exit

Now, as yourself create a database:

createdb -p 5433 openacs

Now, finally you'll be able to connect o the newly created database:

psql -p 5433 openacs

After the database is create and running, you'll be able to start up openacs for the first time and do the installation.

Again, all of this is pretty well specified in the OpenACS Installation Guide or in any primer to PotsgreSQL so you would benefit from looking there.

Collapse
Posted by Raul Rodriguez on
I did this:
sudo su - postgres

psql -p 5432 openacs

and I got connected to the interactive terminal
I then stopped and started aolserver and still had the same problem.

When I did my install I only installed postgres8.2 per the installation instructions.

I do know that when I use all default values, everything works; however, I dont want the default database user name.

Collapse
Posted by Raul Rodriguez on
I also missed mentioning the error log shows a different error:


[13/Sep/2008:16:03:40][11244.3083901120][-main-] Notice: Database API: Default database (dbn) is: 'default'
[13/Sep/2008:16:03:40][11244.3083901120][-main-] Notice: Database API: Using ALL database pools for OpenACS.
[13/Sep/2008:16:03:40][11244.3083901120][-main-] Notice: Database API: The following pools are available for OpenACS: pool2 pool3 pool1
[13/Sep/2008:16:03:40][11244.3083901120][-main-] Notice: dbdrv: opening database 'postgres:localhost:5432:openacs'
[13/Sep/2008:16:03:40][11244.3083901120][-main-] Notice: Opening openacs on localhost
[13/Sep/2008:16:03:40][11244.3083901120][-main-] Error: Ns_PgOpenDb(postgres): Could not connect to localhost:5432:openacs: FATAL: Ident authentication fa\
iled for user "foo"

[13/Sep/2008:16:03:40][11244.3083901120][-main-] Error: dbdrv: failed to open database 'postgres:localhost:5432:openacs'
[13/Sep/2008:16:03:40][11244.3083901120][-main-] Warning: Database API: couldn't allocate a handle from database pool "pool2".
[13/Sep/2008:16:03:40][11244.3083901120][-main-] Error: Database API: RDBMS type could not be determined for any pool.

Collapse
Posted by Raul Rodriguez on
I have been trying to figure out what is going on.
I saw this:
/usr/sbin/aolserver4-nsd -u www-data -g www-data -b 127.0.0.1:8000 -t /etc/openacs/config.tcl

So I ended up doing this:

sudo killall aolserver4-nsd
sudo /usr/sbin/aolserver4-nsd -u foo -g www-data -b 127.0.0.1:8000 -t /etc/openacs/config.tcl

The DB error went away but now I get the following message in the browser:

* The /usr/share/openacs directory has incorrect permissions. It must be owned by the user executing the web server, normally nsadmin, and the
owner must have read and write privileges on this directory. You can correct this by running the following script as root. To give another user
access to the files, add them to web group.

groupadd web
chown -R nsadmin:web /usr/share/openacs
chmod -R ug+rw /usr/share/openacs

* The /usr/share/openacs/packages directory has incorrect permissions. It must be owned by the user executing the web server, normally nsadmin and
the owner must have read and write privileges on this directory and all of its subdirectories. You can correct this by running the following
script as root. To give another user access to the files, add them to web group.

groupadd web
chown -R nsadmin:web /usr/share/openacs/packages
chmod -R ug+rw /usr/share/openacs/packages

I dont think that the recommended fix will work since the group seems to be www-data now?

Any Ideas?
TIA

Collapse
Posted by Raul Rodriguez on
I was able to get the server to come up with the standard installation screen by doing the following:

sudo emacs /etc/init.d/openacs (changed user from www-data to foo)
sudo chown -R foo:www-data /usr/share/openacs
sudo chmod -R ug+rw /usr/share/openacs

Does anyone know how to set another instance on the same server?

---rer

Collapse
Posted by Héctor Romojaro on
Hi Raul,

At this point the openacs debian/ubuntu packages doesn't support multiple instances on the same server. You can make a copy of the /usr/share/openacs directory, change the owner, rebuild the symlinks... but it will be a mess, mainly at upgrading to a newer version later 🤔

If you are going to use more instances on the same server I recommend you to use the source instalation.

About the database errors, let's start for the beginning. It seems that aptitude is installing postgresql 8.3 when installing the openacs package, because postgresql-8.3 is the default postgresql version on ubuntu, and the package openacs recommends just "postgresql".

I corrected the wiki pages from debian and ubuntu to use apt-get instead of aptitude. Apt-get doesn't install by default the packages marked as "recommended", only straight dependencies.

I fixed some days ago an issue of the package related to connecting to postgresql with another user than default, so I recommend you to download the package again.

The default install works because the owner of the database is the same as the owner of the openacs files, the user www-data. The postgresql defaults for localhost socket connections are (from pg_hba.conf):

# TYPE DATABASE USER CIDR-ADDRESS METHOD
local all all ident sameuser

Which means that if you want to use a different DB user, you must allow access to that user on postgres, adding a line like this before the previous one on /etc/postgresql/8.2/main/pg_hba.conf:

# TYPE DATABASE USER CIDR-ADDRESS METHOD
local openacs user md5

If you are using a blank password, change "md5" for "trust", for example.

I will add a warning on the installer to beware people of granting access if they change the user. It goes beyond to the purpose of the installer to chan
ge the postgresql access policies, I think.

Well, let's start again and do the things right:

1- Purge some packages and drop database:

- Purge openacs
# sudo apt-get remove openacs --purge

- Purge postgresql 8.3
# sudo apt-get remove postgresql-8.3 postgresql-client-8.3 --purge

- Drop the database on postgresql 8.2 if it exists.
# sudo su - postgres -c 'dropdb openacs'

- Purge postgresql 8.2
# sudo apt-get remove postgresql-8.2 postgresql --purge

2- Start the install again:

# sudo apt-get clean
# sudo apt-get update
# sudo apt-get install postgresql-8.2
# sudo apt-get install openacs

Fill the questions and put whatever DB owner you want, if you granted access on postgresql to him :)

3- Check the install opening a browser on localhost:8000.

# firefox http://localhost:8000 (in example)

Cheers, Héctor

Collapse
Posted by Héctor Romojaro on
Hi all,

I've just fixed some things on dotlrn and openacs debian packages:

- Postgresql and daemontools are now "Suggested" dependencies instead of "Recommends", to avoid problems with aptitude.
- The installer grants access permissions on postgresql's pg_hba.conf automatically if the user wants to (only if postgresql is installed on localhost).
- Fixed some issues with dpkg-reconfigure.

Purging previous packages is recommended before installing the new ones. To purge and install:

# sudo apt-get clean
# sudo apt-get update
# sudo apt-get remove openacs | dotlrn --purge
# sudo apt-get install openacs | dotlrn

The database is not dropped on purge, so don't be afraid of doing it :)

Cheers, Héctor