Configuration steps for Postgres db - postgresql

I want to build and run following application https://github.com/sdeleuze/geospatial-messenger
I have little experience with backend and data bases so I need some guidance with following installation step:
Customize database configuration on application.yml.
application.yml
logging:
level:
org.springframework.web.servlet: INFO
spring:
datasource:
platform: "postgis"
driver-class-name: "org.postgis.DriverWrapper"
url: "jdbc:postgresql_postGIS://localhost/geospatial-messenger"
username: "postgres"
mvc:
async:
request-timeout: 1000000
Please outline steps that I should perform with my data base to configure it according to a file.
I have PostgreSQL 10 on Ubuntu 18.04

After installation of PostgreSQL10, please follow the below steps :
1. Login to root user, run this command su – postgres
2. Locate the pg_hba.conf file by running select Query: select current_setting('hba_file');
3. Modify the pg_hba.conf file
4. Example : vim /prod/pgsql_10/pg_hba.conf command.
5. Press insert key where you want to modify and save it using esc + :wq
Example: host all all 10.10.11.183/32 md5
trust – without password authentication
md5 – with password authentication
6. After modification, we should restart the postgres service using this command
systemctl restart postgresql-10.service
7. Also modify the postgresql.conf file as same as pg_hba.conf file.
locate postgresql.conf
vim /prod/pgsql_10/postgresql.conf
8. After modification, we should restart the postgres service using this command
systemctl restart postgresql-10.service
9. To login postgres, run this command psql -U esb(user) postgres(DB)

You already have the PostgreSQL installed, so you only need PostGIS for this to work. For Ubuntu, it is better if you use UbuntuGIS. You can add UbuntuGIS repository and install PostGIS from it. http://trac.osgeo.org/ubuntugis/wiki/QuickStartGuide.
Another way is to use PostgreSQL's repository http://trac.osgeo.org/postgis/wiki/UsersWikiPostGIS24UbuntuPGSQL10Apt

Related

How to install Kong (https://konghq.com/) on Ubuntu 20.04?

I tried to install using the instructions available on https://docs.konghq.com/install/ubuntu/ and also using snap store but I get the same error. I don't know if it's relevant or not but I am using postgres-12.2 which comes pre-installed with Ubuntu-20.04. The directory structure in postgres-12.2 is different from the earlier ones.
error: cannot perform the following tasks:
- Run install hook of "kong" snap if present (run hook "install":
-----
The files belonging to this database system will be owned by user "snap_daemon".
This user must also own the server process.
The database cluster will be initialized with locale "C.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
creating directory /var/snap/kong/172/postgresql/10/main ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default timezone ... Asia/Kolkata
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
Success. You can now start the database server using:
/snap/kong/172/usr/lib/postgresql/10/bin/pg_ctl -D /var/snap/kong/172/postgresql/10/main -l logfile start
createuser: could not connect to database postgres: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/snap/kong/common/sockets/.s.PGSQL.5432"?
-----)```
[1]: https://i.stack.imgur.com/2pzKn.png
Finally, it was done after a lot of research and endless tries. If you face the same issue, follow the following order(For Ubuntu 20.04 only):
Better not install using apt-get or snap(at least until a snap for Ubuntu 20.04 is available). Install using the .deb package available at https://docs.konghq.com/install/ubuntu/#packages. After downloading the package, navigate to the Downloads folder in the terminal and run the following commands to install:
sudo apt-get install openssl libpcre3 procps perl
sudo dpkg -i kong-2.0.4.*.deb
Don't know what the first command is installing but it is suggested to do so as per the official documentation of KONG.
In another terminal, create a new user and database in postgres for KONG connectivity.
sudo -i -u postgres
psql
CREATE USER kong;
CREATE DATABASE kong OWNER kong;
Back to the terminal where you were installing KONG. Try running the command:
sudo kong migrations bootstrap
If everything goes without a glitch, consider yourself lucky and go to step 5.
If there occurs an error at step 3 as:
Error: missing password, required for connect, there's more work to be done.
Run the command: kong check
This should list an error as [error] no file at: /etc/kong/kong.conf. Create a file named kong.conf in the directory /etc/kong and paste the contents available at https://github.com/Kong/kong/blob/master/kong.conf.default.
Thereafter, uncomment the lines which initialize the following variables: https://docs.konghq.com/2.0.x/configuration/#postgres-settings. If in step 2, you created user and database with different names, make sure to modify the credentials in the file kong.conf with your user(role) and database names.
[You may face trouble creating files and editing them at this step.]
Run the command
sudo kong start
to verify the correct configuration. Open your browser and navigate to http://localhost:8001. If some page opens, KONG is correctly configured on your device. Go back to the terminal and stop KONG using the command
sudo kong stop

Running PGAdmin after Silent installation, what is the login?

I started an installation of Postgres in unatended mode with the commandline:
postgresql-9.5.2-1-windows-x64-x64.exe --unattendedmodeui minimal --mode unattended --superpassword "password" --servicename "postgreSQL"
--servicepassword "password" --serverport 5432
After the installation is finished i want to login to the database with pgadmin. i tried with "password" but i get the error:
fatal password authentication failed for user postgres
so what are my login data for the installed database?
Thanks a lot
Marcel
If you don't know the password you have to change the pg_hba.conf file that contains all the authentication information.
You can read about how it works here:
http://www.postgresql.org/docs/devel/static/auth-pg-hba-conf.html
I suggest you to create a backup of the original file first and to reboot the server after changes.
I was facing the same issue. It looked like there was a conflict with previous installations of Postgres.
I could login using the password specified by --superpassword after cleaning all Postgres-related folders in program files as well as in custom install locations.
A professional approach would be running your installer on a clean system or a VM.

how to install Odoo 9 on ubuntu?

I have pre installed postgres , postgres-9.3 and pgadmin on port 5432 and 5433 .
uninstall them then trying to install odoo 9 using http://openies.com/blog/install-openerp-odoo-9-on-ubuntu-server-14-04-lts/
this tutorial .
but when i ttrying to execute command
createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo
then it gives following error :
createuser: could not connect to database postgres: 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"?
sudo netstat -nltp | grep 5432 is not showing any result .
pg_hba.conf
# Database administrative login by Unix domain socket
local all postgres peer
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all peer
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local replication postgres peer
#host replication postgres 127.0.0.1/32 md5
#host replication postgres ::1/128 md5
1. Introduction
In this tutorial I will learn you how to install Odoo 9 on Ubuntu 14.04. The script that you will use is based on the code from André Schenkels but has been updated and improved.
2. Downloading the script
The first step is to download my script from GitHub and to add the code in a new .sh file on your Ubuntu machine, wherever you’d like this.
For example right under /home. Open up an Ubuntu terminal and cd to the directory where you’d like to keep the script and then create the file:
sudo wget https://raw.githubusercontent.com/Yenthe666/InstallScript/9.0/odoo_install.sh
If you’re curious about how the whole code looks and works you can find it on my Github account.
Now open up the file and edit the parameters to your liking:
sudo nano odoo_install.sh
There are some things you can configure/change to your likings at the top of the script. You can choose if you wish to install Wkhtmltopdf or not, which version you’d like, where the location is and most importantly what the master admin password is. Tip: always modify this for every Odoo you install!
3. Making the Odoo installation file executable
The next step is to make this file executable. After you’ve made it executable you can execute it and everything will be installed automatically.
do this with the following command:
sudo chmod +x odoo_install.sh
4.Running the script
Now that the code is in your file and the file is executable you simply have to execute it with the following command:
./odoo_install.sh
You will see that the script automatically starts updates, downloads required packages, creates the user, downloads the code from Github, …
Give the script a few minutes to configure and install everything and eventually you will see something like this:
You now have a fully functional Odoo V9 on your system! Congratulations.
Odoo V9
5. Extra information
In the script you saw there was an option to change the Odoo port (OE_PORT). When you’d change this port number to 8070 in the install script it would be applied to /etc/your-config-file.conf and this would give you the ability to change the default port.
To apply these changes you should do the following:
The -c will change the configuration and memorize what you’ve changed under /etc/your-config-file.conf. Because my port was set to 8070 this is telling the Odoo that it should run on port 8070. When you would now open up your browser and navigate to http://localhost:8070/ you will see it is running there:
Odoo V9 alternative port
This issue comes form installing the postgres package with out a version number. Although postgres will be installed and it will be the correct version the script to setup the cluster will not be run correctly. It's a packaging issue. If your comfortable with Postgres there is a script you can run to crete this cluster and get postgres running however if your like me then you do it the easy way. First purdge the old postgres install. The issue currently lies with 9.1 so I will assume that's what you have installed
sudo apt-get remove --purge postgresql-9.1
Now simply reinstall
sudo apt-get install postgresql-9.1
Note the package name with the version number. HTH.
I have installed odoo using http://openies.com/blog/install-openerp-odoo-9-on-ubuntu-server-14-04-lts/ got no issue with the fresh ubuntu 14.04 LTS.
But, you need to check that there is no postmaster.pid in your postgres directory, probably /usr/local/var/postgres/
Remove this and start server using
rm /usr/local/var/postgres/postmaster.pid
It should work.
Check this to install odoo 10 in ubuntu 16.04 LTS
Bitnami ODOO, easy to install in your Machine.
Download from Here
It is compatible with preinstall postgresql.
As mentioned before you can use one simple script to install Odoo of any version (9, 10, 11).
Follow the steps:
Log in to your system and work as an superuser: sudo su
Update the system: apt-get update
Download the script. You can change to the version of your choice:
wget https://raw.githubusercontent.com/Yenthe666/InstallScript/11.0/odoo_install.sh
Run the script: ./odoo_install.sh
Now you can access Odoo at http://serverIP:8069
If you are running it locally that would be 127.0.0.1:8069
The next steps would be to configure the Apache/Nginx or another server to point a domain to the Odoo instance. Also, remember to set the proper access rules on your server (for example on Amazon that would be by opening the port 80 and 8069 in the security rules). It is also wise to change the default password in Odoo config from admin to something more secure.
If you used the script without editing your Odoo config file would be installed in /etc/odoo-serfer.config. Use nano, vi or another editor to change the default settings.

After installing postgres 9.4 on fedora 20, couldn't launch psql

I have installed postgres 9.4 on fedora 20.
i have followed the steps through the link below
https://wiki.postgresql.org/wiki/YUM_Installation
I have started the server using the command
service postgresql-9.4 initdb
Then I set the auto start using the command
chkconfig postgresql-9.4 on
I am able to connect with Data base server via pg admin
but I am not able to connect with postgres DB server or SQL command line via terminal
If I enter psql for postgres/or any user, it says command not found.
can any one please help me on this.
You need to go to the installation bin directory and use './ExecutableFile' to run when logged in with postgres user.
So, use ./psql when you are in bin directory.
Or you can use "export PATH=path/to/bin/" to avoid using './'

Unable to connect to PostgreSQL 9.3

Recently, I have installed PostgreSQL 9.3 on my windows 7 64 bit PC but today I have formatted my PC. Now again I tried to install PostgreSQL 9.3 but after installation when I tried to connect it throws error See below screenshot :-
My pg_hba.conf is shown below :
I have also saw Postgres password authentication fails but nothing helps.
I am new to PostgreSQL,please help me on this.
Finally I found the solution hope this will help to other users if they are facing the same problem :-
I have to edit pg_hba.conf file which is located in "C:\Program Files\PostgreSQL\9.3\data". In that file I have to make method md5 to trust as #Craig Ringer said. So the line will look like host all postgres 127.0.0.1/32 trust.
Then to restart the PostgreSQL on windows - Go to start > run > services.msc then restart the service.
Then open pg Admin create new server enter all the required details and save it. That's it !!