1.安装依赖包:
yum install -y zlib readline readline-devel zlib zlib-devel openssl openssl-devel make cmake gcc flex bison autoconf
2.解压:
tar xvzf postgresql-10.0.tar.gz
3.添加用户:
useradd postgres
4.创建目录:
mkdir -p /opt/pg10/
mkdir -p /pgdata/10/{data,backup,script,archive_wal}
chown -R postgres:postgres /pgdata/10
chmod 0700 /pgdata/10/data
5.编译安装:
./configure --prefix=/opt/pg10/ --with-pgport=5432
gmake
gmake install
设置软连接:
ln -s /opt/pg10 /opt/pgsql
6.初始化数据库:
[[email protected] ~]$ /opt/pgsql/bin/initdb -D /pgdata/10/data -W
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.UTF-8".
The default database enCoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are Disabled.
Enter new superuser password:
Enter it again:
fixing permissions on existing directory /pgdata/10/data ... ok
creating subdirectorIEs ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A,or
--auth-local and --auth-host,the next time you run initdb.
Success. You can Now start the database server using:
/opt/pgsql/bin/pg_ctl -D /pgdata/10/data -l logfile start
7.启动关闭数据库:
启动数据库:
[[email protected] ~]$ /opt/pgsql/bin/pg_ctl -D /pgdata/10/data start
waiting for server to start....2018-12-08 02:44:44.495 EST [15059] LOG: Listening on IPv6 address "::1",port 5432
2018-12-08 02:44:44.495 EST [15059] LOG: Listening on IPv4 address "127.0.0.1",port 5432
2018-12-08 02:44:44.500 EST [15059] LOG: Listening on Unix socket "/tmp/.s.PGsql.5432"
2018-12-08 02:44:44.515 EST [15060] LOG: database system was shut down at 2018-12-08 02:42:52 EST
2018-12-08 02:44:44.517 EST [15059] LOG: database system is ready to accept connections
done
server started
查看数据库状态:
[[email protected] ~]$ /opt/pgsql/bin/pg_ctl -D /pgdata/10/data status
pg_ctl: server is running (PID: 15059)
/opt/pg10/bin/postgres "-D" "/pgdata/10/data"
关闭数据库:
[[email protected] ~]$ /opt/pgsql/bin/pg_ctl -D /pgdata/10/data -ms stopwaiting for server to shut down....2018-12-08 02:47:08.919 EST [15059] LOG: received smart shutdown request2018-12-08 02:47:08.922 EST [15059] LOG: worker process: logical replication launcher (PID 15066) exited with exit code 12018-12-08 02:47:08.923 EST [15061] LOG: shutting down2018-12-08 02:47:08.936 EST [15059] LOG: database system is shut downdoneserver stopped
以上是内存溢出为你收集整理的postgresql安装参考全部内容,希望文章能够帮你解决postgresql安装参考所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)