Configuration of the start-up service and environment variables for PostgreSQL under Linux

Source: Internet
Author: User
Tags postgresql

Set up PostgreSQL boot from

PostgreSQL's boot-up script is located under the contrib/start-scripts path of the PostgreSQL source directory

The Linux file is the startup script on the Linux system

1) Modify the Linux file properties and add the X attribute

#chmod A+x Linux

2) Copy the Linux file to the/ETC/INIT.D directory and rename it to PostgreSQL

#cp Linux/etc/init.d/postgresql

3) Modify the two variables of the/etc/init.d/postgresql file

Prefix installation path set to PostgreSQL:/opt/pgsql-9.4.4

Pgdata Data Directory path set to PostgreSQL:/opt/pgsql/data

4) The PostgreSQL service can be started by executing service PostgreSQL start

#service PostgreSQL Start

5) Set up PostgreSQL service to boot from

#chkconfig--add PostgreSQL

Execute the above command to enable the start-up of the PostgreSQL service.

A different way

PostgreSQL database Linux system boot up

chmod A+x/opt/postgresql-8.4.3/contrib/start-scripts/linux

Cp/opt/postgresql-8.4.3/contrib/start-scripts/linux/etc/init.d/postgresql

Chkconfig--add PostgreSQL

Vi/ect/init.d/postgresql

Modify the Start section code

su-$PGUSER-C "$DAEMON-i-d ' $PGDATA ' &" >> $PGLOG 2>&1 Plus-I parameter to support Java program fetch processing

Reboot

Settings for Environment variables

You can add the following to the UNIX user's ~/.bash_profile or ~/.profile file,

[Email protected] postgresql-9.4.0]# Su-postgres

[Email protected] ~]$ VI ~/.bash_profile

... #postgres

Pgdata=/usr/local/pgsql/data

Path=/usr/local/pgsql/bin: $PATH

Export PGDATA PATH

[Email protected] ~]$. . bash_profile

Configuration of the start-up service and environment variables for PostgreSQL under Linux

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.