Hello,
I'm new to CentOS, trying to bring up a server on CentOS5 -- working from Debian instructions.
I've just installed postgres and an init.d script postgres8-2.4. My Debian instructions next
tell me to execute:
update-rc.d postgresql-8.4 defaults
...which doesn't work on CentOS.
Searching Google, I see that I should use chkconfig instead. But it doesn't work either.
My guess is that I to add code to the init.d file, but what?
Can anyone please point me right?
Many thanks,
LRP
chkconfig vs. update-rc.d?
-
- Posts: 661
- Joined: 2009/01/18 00:39:15
- Location: 44 49′14″N 20 27′44″E
Re: chkconfig vs. update-rc.d?
Hi,
in CentOS, and Red Hat based distros (or should I say System V based, rather than BSD), [b]chkconfig[/b] is used to configure services' behavior on boot. Hence, if you run:
[code]
chkconfig postgresql on
[/code]
[b]postgresql[/b] service will only be configured to start during boot on runlevels 2, 3, 4 and 5. All services managed by [b]chkconfig[/b] may be listed with:
[code]
chkconfig --list
[/code]
along with their current boot behavior configuration. For more info on [b]chkconfig[/b] please read manual pages for [b]chkconfig[/b].
Meanwhile, in order to start the service instantly, rather than configuring it to always start during boot-up, use [b]service[/b] command. It very neat:
[code]
[root@xxxxxx ~]# service postgresql status
postmaster is stopped
[root@xxxxxx ~]# service postgresql start
Initializing database: [ OK ]
Starting postgresql service: [ OK ]
[/code]
For more info on the [b]service[/b] command please read manual pages.
Also, to my knowledge [b]update-rc.d[/b] doesn't exist on CentOS.
in CentOS, and Red Hat based distros (or should I say System V based, rather than BSD), [b]chkconfig[/b] is used to configure services' behavior on boot. Hence, if you run:
[code]
chkconfig postgresql on
[/code]
[b]postgresql[/b] service will only be configured to start during boot on runlevels 2, 3, 4 and 5. All services managed by [b]chkconfig[/b] may be listed with:
[code]
chkconfig --list
[/code]
along with their current boot behavior configuration. For more info on [b]chkconfig[/b] please read manual pages for [b]chkconfig[/b].
Meanwhile, in order to start the service instantly, rather than configuring it to always start during boot-up, use [b]service[/b] command. It very neat:
[code]
[root@xxxxxx ~]# service postgresql status
postmaster is stopped
[root@xxxxxx ~]# service postgresql start
Initializing database: [ OK ]
Starting postgresql service: [ OK ]
[/code]
For more info on the [b]service[/b] command please read manual pages.
Also, to my knowledge [b]update-rc.d[/b] doesn't exist on CentOS.
-
- Retired Moderator
- Posts: 18276
- Joined: 2006/12/13 20:15:34
- Location: Tidewater, Virginia, North America
- Contact:
chkconfig vs. update-rc.d?
[quote]
milosb wrote:
...
Also, to my knowledge [b]update-rc.d[/b] doesn't exist on CentOS.[/quote]
I am venturing a guess that "chkconfig" covers that territory. First hit from [url=http://www.google.com/search?q="update-rc.d"&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a]google[/url]
http://www.debuntu.org/how-to-manage-services-with-update-rc.d
milosb wrote:
...
Also, to my knowledge [b]update-rc.d[/b] doesn't exist on CentOS.[/quote]
I am venturing a guess that "chkconfig" covers that territory. First hit from [url=http://www.google.com/search?q="update-rc.d"&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a]google[/url]
http://www.debuntu.org/how-to-manage-services-with-update-rc.d
Re: chkconfig vs. update-rc.d?
Hi,
Many thanks for help.
Problem solved.
I needed a different install script.
Found the answer here:
http://wiki.scinterface.com/index.php/HowTo:_Install_PostgreSQL#Installing_for_PostgreSQL_v8.3_for_CentOS_5
And it is:
Create a postgres startup script
The source installation will not automatically start on bootup. This is a requirement if you want the SCM to start when you bootup the machine. Postgres must be started before SCM.
Locate the file contrib/start-scripts/linux in the PostgreSQL source distribution. If you need to download the source, go to the section on installing PostgreSQL from source.
First, copy the linux startup script to /etc/rc.d/init.d
cp /contrib/start-scripts/linux /etc/rc.d/init.d/postgresql
make it executable
chmod 775 /etc/rc.d/init.d/postgresql
Make sure to add it to start for your runlevel. This varies from distro to distro. Typically for Redhat and Suse you will use 'chkconfig' and for Debian/Ubuntu 'update-rc.d'
chkconfig:
chkconfig --add postgresql
Once again, I much appreciate your help.
LRP
Many thanks for help.
Problem solved.
I needed a different install script.
Found the answer here:
http://wiki.scinterface.com/index.php/HowTo:_Install_PostgreSQL#Installing_for_PostgreSQL_v8.3_for_CentOS_5
And it is:
Create a postgres startup script
The source installation will not automatically start on bootup. This is a requirement if you want the SCM to start when you bootup the machine. Postgres must be started before SCM.
Locate the file contrib/start-scripts/linux in the PostgreSQL source distribution. If you need to download the source, go to the section on installing PostgreSQL from source.
First, copy the linux startup script to /etc/rc.d/init.d
cp /contrib/start-scripts/linux /etc/rc.d/init.d/postgresql
make it executable
chmod 775 /etc/rc.d/init.d/postgresql
Make sure to add it to start for your runlevel. This varies from distro to distro. Typically for Redhat and Suse you will use 'chkconfig' and for Debian/Ubuntu 'update-rc.d'
chkconfig:
chkconfig --add postgresql
Once again, I much appreciate your help.
LRP
-
- Retired Moderator
- Posts: 18276
- Joined: 2006/12/13 20:15:34
- Location: Tidewater, Virginia, North America
- Contact:
Re: chkconfig vs. update-rc.d?
The major problem with that approach is that [url=http://wiki.centos.org/PackageManagement/SourceInstalls]Source Installs[/url] are [b]highly[/b] discouraged. A package-based system should use packages, otherwise things are likely to break when packages are updated because the package system knows nothing about your source libraries and executables, and you have apparently not used yum exclude= directives to prevent that. This is a very fragile setup.
Please read:
[url=http://www.centos.org/modules/newbb/viewtopic.php?topic_id=14274&forum=47]Readme First[/url]
[url=http://www.centos.org/modules/newbb/viewtopic.php?topic_id=14408&forum=47]Installing Software[/url]
[url=http://www.centos.org/modules/newbb/viewtopic.php?topic_id=14273&forum=47]Where to Find Answers[/url]
[url=http://wiki.centos.org/AdditionalResources/Repositories]Repositories[/url]
[url=http://wiki.centos.org/PackageManagement/Yum]Package Management with Yum[/url]
[url=http://wiki.centos.org/FAQ/General#head-472ce8446ebcfc82ca1800f775ba0e629ac835c7]FAQ#20. Where can I get the latest version of XyZ.rpm for CentOS? I cannot find it anywhere.[/url]
Please read:
[url=http://www.centos.org/modules/newbb/viewtopic.php?topic_id=14274&forum=47]Readme First[/url]
[url=http://www.centos.org/modules/newbb/viewtopic.php?topic_id=14408&forum=47]Installing Software[/url]
[url=http://www.centos.org/modules/newbb/viewtopic.php?topic_id=14273&forum=47]Where to Find Answers[/url]
[url=http://wiki.centos.org/AdditionalResources/Repositories]Repositories[/url]
[url=http://wiki.centos.org/PackageManagement/Yum]Package Management with Yum[/url]
[url=http://wiki.centos.org/FAQ/General#head-472ce8446ebcfc82ca1800f775ba0e629ac835c7]FAQ#20. Where can I get the latest version of XyZ.rpm for CentOS? I cannot find it anywhere.[/url]