Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of setting up PostgreSQL Boot by Ubuntu 16.04

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Because PostgreSQL is compiled and installed, boot needs to be set up. For Ubuntu systems, it's a little different from systems like Red Hat.

First of all, since we are used to using systems like Red Hat, we need to get a chkconfig out. This command is a command to configure Red Hat service startup and stop, but it is not available on Ubuntu. We can use sysv-rc-conf.

Sudo apt install sysv-rc-conf

After installing sysv-rc-conf, we replaced it with chkconfig. After all, this order is too hard to remember.

Sudo cp / usr/sbin/sysv-rc-conf / usr/sbin/chkconfig

Next we can try to use the chkconfig command to see

Once this is done, we need to go to the / postgresql-10.3/contrib/start-scripts directory of the PostgreSQL installation package. There are several system configuration files under the directory. We are using Ununtu here. Select linux and copy this file to / etc/init.d/. And give executable x permission.

Postgres@postgres-N65S01:~/postgresql-10.3/contrib/start-scripts$ lsfreebsd linux macos osxpostgres@postgres-N65S01:~/sudo cp linux / etc/init.d/postgres@postgres-N65S01:/etc/init.d$sudo mv linux postgresql-10.0postgres@postgres-N65S01:/etc/init.d$chmod axix postgresql-10.0

After doing the above, you need to modify the file, mainly in the following two locations

Prefix is the postgreSQL installation directory, and PGDATA is the directory where the database files are located. Save after the modification is completed. Execute the following command to set the service to start automatically.

Postgres@postgres-N65S01:/etc/init.d$ sudo chkconfig postgresql-10.0 onpostgres@postgres-N65S01:/etc/init.d$ sudo chkconfig-- list | grep postgrespostgresql-1 2:on 3:on 4:on 5:on

After rebooting the host again, you can find that the postgreSQL database can start automatically.

Postgres@postgres-N65S01:/etc/init.d$ ps-ef | grep pgdatapostgres 2460 10 19:19? 00:00:00 / opt/PostgreSQL-10/bin/postmaster-D / pgdata/datapostgres 4683 2853 0 19:43 pts/18 00:00:00 grep-- color=auto pgdata

Summary

The above is the method of setting up PostgreSQL boot by Ubuntu 16.04. if you have any questions, please leave me a message and the editor will reply to you in time. Thank you very much for your support to the website!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 259

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report