postgresql在linux下的的开机自启动服务与环境变量的配置
2016-09-26 14:43
731 查看
设置PostgreSQL开机自启动
PostgreSQL的开机自启动脚本位于PostgreSQL源码目录的contrib/start-scripts路径下
linux文件即为linux系统上的启动脚本
1)修改linux文件属性,添加X属性
#chmod a+x linux
2) 复制linux文件到/etc/init.d目录下,更名为postgresql
#cp linux /etc/init.d/postgresql
3)修改/etc/init.d/postgresql文件的两个变量
prefix设置为postgresql的安装路径:/opt/pgsql-9.4.4
PGDATA设置为postgresql的数据目录路径:/opt/pgsql/data
4) 执行service postgresql start,就可以启动PostgreSQL服务
#service postgresql start
5)设置postgresql服务开机自启动
#chkconfig --add postgresql
执行上面的命令,就可以实现postgresql服务的开机自启动。
另一种方式
PostgreSQL数据库Linux系统开机启动
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
修改start部分代码
su - $PGUSER -c "$DAEMON -i -D '$PGDATA' &" >>$PGLOG 2>&1加上-i参数以支持JAVA程序调取的处理
reboot
环境变量的设置
可以把下面的内容添加到UNIX用户的~/.bash_profile或~/.profile文件中,
[root@highgo postgresql-9.4.0]# su - postgres
[postgres@highgo ~]$ vi ~/.bash_profile
...#postgres
PGDATA=/usr/local/pgsql/data
PATH=/usr/local/pgsql/bin:$PATH
export PGDATA PATH
[postgres@highgo ~]$ . .bash_profile
PostgreSQL的开机自启动脚本位于PostgreSQL源码目录的contrib/start-scripts路径下
linux文件即为linux系统上的启动脚本
1)修改linux文件属性,添加X属性
#chmod a+x linux
2) 复制linux文件到/etc/init.d目录下,更名为postgresql
#cp linux /etc/init.d/postgresql
3)修改/etc/init.d/postgresql文件的两个变量
prefix设置为postgresql的安装路径:/opt/pgsql-9.4.4
PGDATA设置为postgresql的数据目录路径:/opt/pgsql/data
4) 执行service postgresql start,就可以启动PostgreSQL服务
#service postgresql start
5)设置postgresql服务开机自启动
#chkconfig --add postgresql
执行上面的命令,就可以实现postgresql服务的开机自启动。
另一种方式
PostgreSQL数据库Linux系统开机启动
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
修改start部分代码
su - $PGUSER -c "$DAEMON -i -D '$PGDATA' &" >>$PGLOG 2>&1加上-i参数以支持JAVA程序调取的处理
reboot
环境变量的设置
可以把下面的内容添加到UNIX用户的~/.bash_profile或~/.profile文件中,
[root@highgo postgresql-9.4.0]# su - postgres
[postgres@highgo ~]$ vi ~/.bash_profile
...#postgres
PGDATA=/usr/local/pgsql/data
PATH=/usr/local/pgsql/bin:$PATH
export PGDATA PATH
[postgres@highgo ~]$ . .bash_profile
相关文章推荐
- linux环境配置tomcat开机自启动
- 配置Linux服务下mysql数据库服务开机自启动
- linux上安装tomcat,配置tomcat服务开机自启动
- Linux环境CentOS下JDK安装及环境变量配置、多个Tomcat的安装及开机自启配置
- Linux 开机启动软件配置和环境变量配置
- Linux下Tomcat配置为系统服务,并开机自启动
- Linux下配置Tomcat为系统服务并开机自启动
- postgresql9.5 run 文件linux安装后配置成开机服务
- linux环境下memcached服务自启动的配置
- 设置 linux环境 tomcat 服务开机自启动
- linux下 配置weblogic 与nodemanager到服务里,开机自启动
- linux上安装tomcat,配置tomcat服务开机自启动
- Linux下配置java环境变量以及Eclipse配置
- Linux下安装JDK并配置Java环境变量
- linux配置java环境变量(详细)
- Windows和Linux下的Java环境变量配置
- 【VNC】Linux环境VNC服务安装、配置与使用
- linux下jdk环境变量的配置和Eclipse的配置(经本人亲自试验总结而成)
- linux上的Apache服务和LAMP环境的配置
- linux下oracle服务开机自启动最简单的解决方法