tag做的最好的网站,公司网站建站要多少钱,网站开发用户登录前 登录后,一级a做爰片在线看网站PostgreSQL安装与使用 目录 依赖包的安装源码编译和安装初始化数据库集簇简单配置依赖包安装 PostgreSQL源码安装依赖以下四个软件包 readline
zlib
flex
bison 在Ubuntu中可是应用以下命令直接进行安装#xff1a; sudo apt-get install libreadline6 libreadline6-dev zlib1…PostgreSQL安装与使用 目录 依赖包的安装源码编译和安装初始化数据库集簇简单配置依赖包安装 PostgreSQL源码安装依赖以下四个软件包 readline
zlib
flex
bison 在Ubuntu中可是应用以下命令直接进行安装 sudo apt-get install libreadline6 libreadline6-dev zlib1g-dev flex bison 如果实在redhat系发行版的Linux中可以使用以下命令 yum install flex bison zlib-devel readline-devel 源码编译和安装 例如下载的源码包为 -rwxrw-rw- 1 bingo bingo 19260568 Dec 2 00:27 postgresql-9.6.1.tar.bz2*
tar -jxvf postgresql-9.6.1.tar.bz2 //解压源码包 进入到源码文件夹根目录下执行以下命令:(各项参数可以根据 sudo ./configure --help 获取帮助) sudo ./configure --prefix/opt/pgsql --enable-debug CFLAGS-O0 常用的几个参数如下 sudo make //或者 make world 编译一切可以编译的东西包括文档HTML和手册以及额外的模块contrib
sudo make install
mkdir /usr/local/pgsql/data
useradd -s /bin/bash -m -p 123456 postgres
chown -R postgres:postgres /usr/local/pgsql/data初始化数据库集簇 su postgres
cd /usr/local/pgsql/bin
./initdb -D ../data
./pg_ctl -D ../data start 登录数据库 ./psql -h IP -p 5432 -U postgres test 清理 make uninstall // 卸载已安装的文件不会删除掉任何创建出来的目录
make clean //清理编译过程中生成的文件并释放磁盘空间
make distclean // 将源码树恢复成发布的状态 自启动配置 PG自启动脚本postgresql复制到/etc/init.d并在各个启动级别文件夹中创建软连接。如 ln -s /etc/init.d/postgresql /etc/rc0.d/K02postgresql #! /bin/sh # Installation prefix
prefix/usr/local/pgsql # Data directory
PGDATA/usr/local/pgsql/data # Who to run the postmaster as, usually postgres. (NOT root)
PGUSERpostgres # Where to keep a log file
PGLOG$PGDATA/serverlog # Its often a good idea to protect the postmaster from being killed by the
# OOM killer (which will tend to preferentially kill the postmaster because
# of the way it accounts for shared memory). Setting the OOM_ADJ value to
# -17 will disable OOM kill altogether. If you enable this, you probably want
# to compile PostgreSQL with -DLINUX_OOM_ADJ0, so that individual backends
# can still be killed by the OOM killer.
#OOM_ADJ-17 ## STOP EDITING HERE # The path that is to be used for the script
PATH/usr/local/pgsql/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin # What to use to start up the postmaster. (If you want the script to wait
# until the server has started, you could use pg_ctl start -w here.
# But without -w, pg_ctl adds no value.)
DAEMON$prefix/bin/postmaster # What to use to shut down the postmaster
PGCTL$prefix/bin/pg_ctl set -e # Only start if we can find the postmaster.
test -x $DAEMON ||
{ echo $DAEMON not found if [ $1 stop ] then exit 0 else exit 5 fi
} # Parse command line parameters.
case $1 in start) echo -n Starting PostgreSQL: test x$OOM_ADJ ! x echo $OOM_ADJ /proc/self/oom_adj su - $PGUSER -c $DAEMON -D $PGDATA $PGLOG 21 echo ok ;; stop) echo -n Stopping PostgreSQL: su - $PGUSER -c $PGCTL stop -D $PGDATA -s -m fast echo ok ;; restart) echo -n Restarting PostgreSQL: su - $PGUSER -c $PGCTL stop -D $PGDATA -s -m fast -w test x$OOM_ADJ ! x echo $OOM_ADJ /proc/self/oom_adj su - $PGUSER -c $DAEMON -D $PGDATA $PGLOG 21 echo ok ;; reload) echo -n Reload PostgreSQL: su - $PGUSER -c $PGCTL reload -D $PGDATA -s echo ok ;; status) su - $PGUSER -c $PGCTL status -D $PGDATA ;; *) # Print help echo Usage: $0 {start|stop|restart|reload|status} 12 exit 1 ;;
esac exit 0 转载于:https://www.cnblogs.com/bingo711x/p/6145213.html