Problem in installing postgresql on ubunto

Dears,
Hope you can help me with this problem, whenever i try to adduser by typing the command sudo -u postgres createuser -SDRP username
it returns (Could not chnage the directory to “/root” : permission denied)

this is my first time installing DHIS2 and working with it, can anyone tell me what shall i do please?
Best regards

Welcome to the community @Haliz.t ! :tada:

Please share which guide you are using to perform the installation? I’m not sure you’re supposed to perform any of the installation steps directly from the ‘root’. You’d be using a user with the right authorities but probably not directly into ‘root’ please correct me if I’m wrong.

Thanks!

Dear @Gassim Thanks for welcoming me.
Actually as i said am very new to linux and its commands , so i depend on DHIS2 server installation guide for DHIs2 core version 2.38 however i can never seem to succeed and am very short on time. would be very thankful if you could show me how this works! is there any step by step guide that i can follow?
Looking forward to your reply and many thanks in advance.

1 Like

Hi Haliz.

This message does not a problem. It only shows Linux can’t change directory.

You may check users by command

compgen -u

If the command displays your new user - everything is ok and you may go on.

Alexander

1 Like

Dear @OleksandrM
Thank you very much for your reply and recommendation. the name i used for the new user is there, however when i try to create a database i face the same message stated above " could not change directory…" so is that ok, and how to know if am on the right path?
Also if i go a different way by installing DHIS2 on my windows 10 PC, will then i be able to link it to a the ubuntu server (linode space that i paid for) or not?

Hi @Haliz.t,

Like I said, I think that you are facing this issue because you are using root directly. Please switch/create a standard user and then follow the guide and instead of using ‘root’ you will be using sudo.

Hope this works! If it does please mark post as solution, if it doesn’t feel free to post back to the community. Thanks!

@OleksandrM @Gassim , Now i have this problem, when i try to monitor the behaviour of tomcat, by typing tail -f tomcat-dhis-haliz/logs/catalina.out i get the following error saying that " Error occuring during initialization of vm , Initial heap size set to a larger value than the maximum heap size "
i have set up the Xmx to 700m and Xms to 4000m but still it says the same
???

Dear @Gassim thank you very much for your reply.
shall i perform all the actions of creating a database and editing the postgresql configurations from the user i created or the root?

1 Like

You’re welcome! Yes, don’t use the root directly. Just use a standard user since the commands already have ‘sudo’ it should work. I think the errors appeared when root was used directly.

Thanks! :slight_smile:

Hi Haliz.

…the same message stated above " could not change directory…"

This message is not error. It means the user has no right to change directory in the file system.

Now you may test connection to Postgres.

su postgres

psql

And check if the database was created

\l

If the database exists you done all properly)

1 Like

Hi Haliz

What changes do you want to make for Postgres?

I think, for the first installation you may leave postgresql.conf by default.

1 Like

Dear @OleksandrM thank you for your reply.
I have another question, i am following the document of DHIS2 server setup of core version 2.38 and there the configurations of postgresql are all for a dedicated CPU with a 16 GB RAM , while my ubuntu is on shared CPU with 2 GB RAM. so i believe the postgresql performance tuning configurations would be different , is that right? if it has different configurations can you tell me where i can find them please?
Thanks

well I have been following this document

that is how i am doing things, and i am getting all the trouble :slight_smile:

Am i on the right track???

​You are on right way.

Follow it.

Dear @OleksandrM much appreciate your support

i am writing this command to start the DHIS2

however am getting the message of server refuse to connect , how to solve it please ?

Hi Haliz,
you could try using PGTune https://pgtune.leopard.in.ua/ and selecting DB Type as Mixed type of application.