PgSQL基础之 安装postgresql数据系统
参考这位仁兄的文章,真的非常好:https://blog.csdn.net/jerry_sc/article/details/76408116#创建数据目录
后来我又自己写了一个shell脚本,来自动化安装pgsql10.5版本。
#!/bin/bash
#进入软件的制定安装目录
echo "进入目录/usr/local,下载pgsql文件"
cd /usr/local
#判断是否有postgre版本的安装包
if [ -d post* ]
then
rm -rf /usr/local/post*
echo "安装包删除成功"
fi
#开始下载pgsql版本10.5并解压
if [ ! -d /usr/local/src ]
then
mkdir /usr/local/src
fi
cd /usr/local/src
wget https://ftp.postgresql.org/pub/source/v10.5/postgresql-10.5.tar.gz
if [ $? == ]
thentar -zxf postgresql-10.5.tar.gz -C /usr/local/
fi
echo "pgsql文件解压成功"
#判断用户是否存在
id $postgres >& /dev/null
echo "用户postgres已存在"
if [ $? -ne ]
then
echo "用户不存在,开始创建postgres用户"
groupadd postgres
useradd -g postgres postgres
fi
echo "重命名postgresql并且进入安装目录"
mv /usr/local/post* /usr/local/pgsql
cd /usr/local/pgsql
#-------------------------------安装pgsql------------------------------------
echo "安装一些库文件"
yum install -y zlib zlib-devel >& /del/null
echo "开始执行configure步骤"
./configure --prefix=/usr/local/pgsql --without-readline
if [ $? == ]
then
echo "configure配置通过,开始进行make编译"
make
if [ $? == ]
then
echo "make编译通过,开始进行make install安装步骤"
make install
if [ $? != ];then
echo "make install安装失败"
fi
echo "安装成功"
else
echo "make编译失败,检查错误。"
fi
else
echo "configure检查配置失败,请查看错误进行安装库文件"
fi
echo "开始进行pgsql的配置"
echo "给pgsql创建data目录"
mkdir -p /usr/local/pgsql/data
echo "修改用户组"
chown -R postgres:postgres /usr/local/pgsql
echo "添加环境变量,进入postgres用户的家目录"
cd /home/postgres
if [ -f .bash_profile ] ;then
cp .bash_profile .bash_profile.bak
echo "export PGHOME=/usr/local/pgsql" >> .bash_profile
echo "export PGDATA=/usr/local/pgsql/data" >> .bash_profile
echo "PATH=$PGHOME/bin:$PATH" >> .bash_profile
echo "MANPATH=$PGHOME/share/man:$MANPATH" >> .bash_profile
echo "LD_LIBRARY_PATH=$PGHOME/lib:$LD_LIBRARY_PATH" >> .bash_profile
fi
alias pg_start='pg_ctl -D $PGDATA -l /usr/local/pgsql/logfile start'
alias ps_stop='pg_ctl -D $PGDATA -l /usr/local/pgsql/logfile stop'
echo "切换至postgres用户来初始化数据库"
su - postgres -c "/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data"
echo "---------------------------------------------------------------------------------------"
echo "---------------------------------------------------------------------------------------"
echo "----------------------------SUCCESS INSTALLATION OF POSTGRESQL-------------------------"
PgSQL基础之 安装postgresql数据系统的更多相关文章
- Centos7 yum安装postgresql 9.5
添加RPM yum install https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-7-x86_64/pgdg-centos ...
- CentOS 6安装PostgreSQL
https://zh.wikipedia.org/wiki/PostgreSQL PostgreSQL是自由的对象-关系型数据库服务器(数据库管理系统),在灵活的BSD-风格许可证下发行.它在其他开放 ...
- centos6.4下面安装postgresql以及客户端远程连接
一.安装 centos6.4服务器IP:192.168.220.131 window7客户端IP:192.168.199.218 在centos官网http://www.postgresql.org/ ...
- Linux CentOS安装postgresql 9.4
一.前言 PostgreSQL通常也简称Postgres,是一个关系型数据库管理系统,适用于各种Linux操作系统.Windows.Solaris.BSD和Mac OS X.PostgreSQL遵循P ...
- CentOS6.5下安装PostgreSQL
一.配置 YUM 仓库 修改原始的 yum 仓库配置: vim /etc/yum.repos.d/CentOS-Base.repo 在[base]和[updates] 节(section)部分的尾部插 ...
- 安装postgreSQL出现configure:error:readline library not found解决方法
要安装 readline , readline-dev 开发包,要么使用 --without-readline 选项关闭 readline 功能. #yum install readline; #yu ...
- 在CentOS上编译安装PostgreSQL
http://my.oschina.net/tashi/blog 第一步:准备阶段 获取必需软件包: CentOS中查看是否安装了某个软件的命令:rpm -qa | grep 软件名.which命令可 ...
- ubuntu14.04源代码安装postgresql 9.1
项目须要使用gisgraphy,怎奈gisgraphy3.0仅仅支持postgis1.5.因此仅仅能安装老版本号的posgresql和postgis了.从postgis的support matrix图 ...
- CentOS安装postgresql 9.4
第一步:在CentOS6.5下安装Postgresql 1. 安装PostgreSQL源 # yum install http://yum.postgresql.org/9.4/redhat/rhel ...
随机推荐
- VC++记录
1. 记录时间 #include <atlstr.h>#include <time.h>clock_t clockBegin, clockEnd; clockBegin = c ...
- ASP.NET截取网页注释行之间的内容
这是网友在论坛问到的问题,网友要求:“我想要抓取每一个<!-- 文字新闻spider begin -->开始<!-- 文字新闻spider end --> 结尾的中间 ...
- c#关于路径的总结(转)
来源:http://www.cnblogs.com/yugongmengjiutian/articles/5521165.html 前一段时间写代码时经常遇到获取路径问题,总是感觉有点乱,于是就总结了 ...
- JS去掉字符串前后空格或去掉所有空格的用法
1. 去掉字符串前后所有空格: 代码如下: function Trim(str) { return str.replace(/(^\s*)|(\s*$)/g, ""); } 说明 ...
- [日常] Go语言圣经-错误,函数值习题
Go语言圣经-错误 1.panic异常.panic是来自被调函数的信号,表示发生了某个已知的bug 2.任何进行I/O操作的函数都会面临出现错误的可能 3.错误是软件包API和应用程序用户界面的一个重 ...
- 漫画 | Java多线程与并发(一)
1.什么是线程? 2.线程和进程有什么区别? 3.如何在Java中实现线程? 4.Java关键字volatile与synchronized作用与区别? volatile修饰的变量不保留拷贝,直接访问主 ...
- java.lang.ExceptionInInitializerError异常
今天在开发的过程中,遇到java.lang.ExceptionInInitializerError异常,百度查了一下,顺便学习学习,做个笔记 静态初始化程序中发生意外异常的信号,抛出Exception ...
- JavaScript中七种数据类型·中·一
Standing on Shoulders of Giants; 说到JavaScript里的类型很容易就让人想起 42和"42",分别是string型和number型,但是他们可 ...
- php+layui实现图片上传与预览
端代码: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <titl ...
- 使用ThinkPHP实现生成/校验验证码功能
首先了解父类Verity.class.php(ThinkPHP/Library/Think/Verity.class.php)中的一些函数 1:check() 校验验证码是否正确 2:entry()输 ...