suse11 postgresql installation cookie: system environment variables repair

postgresql install
Download https://www.postgresql.org/ the download page select the corresponding version of the database
system for the Linux SUSE 11 postgresql - 9.4.21
database installed version of postgresql-9.4.21-1-linux-x64- binaries. the tar
the tar-9.4.21-1--xvzf PostgreSQL-x64-Linux-binaries.tar
after installation pgsql extract from directory listings / wrp / pgsql
add postgres user password and set
the useradd postgres
the passwd postgres
new in / wrp / directory directory pgsql_data Note: pgsql_data and pgsql similar
chown postgres ./pgsql_data/ postgres user to add access
su - postgres switch users
to add environment variables vi / etc / Profile
#
#postgresql
#
Export POSTGRESQL_HOME = / WRP / pgsql
Export PGDATA = / WRP / pgsql_data
Export the PATH = $ the PATH: $ POSTGRESQL_HOME / bin: $ PGDATA
environment variables added after the implementation of source / etc / profile to make it work

Initialize the database / wrp / pgsql / bin / initdb -D / wrp / pgsql_data /

Start the database / wrp / pgsql / bin / pg_ctl -D / wrp / pgsql_data -l logfile.log start

Here -l specified log file location, where direct output / wrp / under their own mkdir logfile.log, this can specify your own, here -D specify the data directory by default if not direct error can not find the data directory
Note: this logfile.log encounter an error, do not have this file to manually create, any directory with a good
experience logfile.log error gave permission to add the file permissions chmod
PS -ef | grep Postgres database to start the process to see
pgsql default port number for the 5432
lsof -i: 5432 View monitor the situation

Stop the database / wrp / pgsql / bin / pg_ctl -D / wrp / pgsql_data stop

Connect to the database into the pgsql directory
./bin/psql -h 127.0.0.1 -d postgres -U postgres -p 5432
which -h parameter to specify the server address, the default is 127.0.0.1, you can not specify a default, -d to specify the connection after select the database, the default is postgres, -U user specified, the default is the current user, -p port number is specified, the default is "5432"

If you do not understand the look here for the Linux environment variables 

About PG installation, Here I briefly explain, because I have not worked before operation and maintenance, so in the course of the study, to learn a lot about redhat, such as:

/ Ect / profile, / home / user / .bash_profile, / home / user / .bashrc set the environment variable environment and enter into force.

"Using the source file name, the file such that at the commencement of the terminal. / Ect / profile is a system-level ,, / home / user / .bash_profile, / home / user / .bashrc is the user level. System level functions for all users, only user-level functions corresponding to the user.

"Source .bashrc can take effect immediately, even if the newly opened terminal is also effective.

"But the source .bash_prifile only applies to the current terminal, the newly opened terminal does not take effect only when restarted, will take effect.

"For export + environment variables, such as environment variables to become global.

"For a detailed description, reference: http://blog.csdn.net/chenchong08/article/details/7833242 

Environment variable configuration error caused the system does not recognize the command, do not panic

You modify environment variables problem
solutions
echo $ PATH export the current environment variables to identify the problem of the environment variable
to add a temporary environment variables
export PATH = / usr / local / sbin: / usr / local / bin: / sbin: / bin : / usr / sbin: / usr / bin: / root / bin
and then return to normal su login
vi / etc / profile delete or comment out the variable in question

 

Guess you like

Origin www.cnblogs.com/Smoredemo/p/11201548.html