Fedora 17 Configure Automatic PostgreSQL startup

Source: Internet
Author: User

After Postgresql is installed using the Fedora package management tool, it cannot be automatically started by the random device. Today, I spent some time reading some related documents and finally found a solution. In fact, it is also very simple.

The root cause is that after Postgresql is installed, the database is stored in/var/pgsql/data, while the default storage location of Postgresql is/var/lib/pgsql/data. Therefore, the database cannot be found using the default installation configuration, so the startup fails.

In the process of solving the problem, I first wanted to customize a boot script to solve the problem, but there was a problem with all the online solutions. The root cause is that after Fedora15, Systemd is used to replace the original init. Therefore, it is no longer feasible to write or modify rc scripts on the Internet.

In Systemd, the startup service is configured in/etc/systemd/system and/lib/systemd/system. The/lib/systemd/system/postgresql. service file is the default service configuration file installed in postgresql. The Recommended Practice (http://docs.fedoraproject.org/zh-CN/Fedora/16/html/Release_Notes/sect-Release_Notes-Changes_for_Sysadmin.html) should not directly modify this file, but should be copied to/etc/systemd/system and then modified.

Now the location is changed:

Sudo cp/lib/systemd/system/postgresql. service/etc/systemd/system

Sudo servicectl enable postgresql. service # activate the postgresql service

Open/etc/systemd/system/postgresql. service in the editor and set the PGDATA modifier to the correct path (my options are/var/pgsql/data)

Sudo systemctl -- system daemon-reload

Success.

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.