标签:The create -- pre div 下载 rest 数据 相关
[root@test2019030517 ~]# wget https://ftp.postgresql.org/pub/source/v10.5/postgresql-10.5.tar.gz
[root@test2019030517 postgresql-10.5]# useradd postgres [root@test2019030517 postgresql-10.5]# groupadd postgres [root@test2019030517 postgresql-10.5]# passwd postgres
[root@test2019030517 postgresql-10.5]# tar zxvf postgresql-10.5.tar.gz [root@test2019030517 postgresql-10.5]# cd postgresql-10.5
[root@test2019030517 postgresql-10.5]# mkdir /usr/local/postgresql
[root@test2019030517 postgresql-10.5]# yum -y install -y readline-devel
[root@test2019030517 postgresql-10.5]# ./configure --prefix=/usr/local/postgresql
[root@test2019030517 postgresql-10.5]# make [root@test2019030517 postgresql-10.5]# make install
[root@test2019030517 postgresql-10.5]# cd contrib [root@test2019030517 contrib]# make && make install
♦数据目录
[root@test2019030517 contrib]# mkdir -p /usr/local/postgresql/data
♦日志目录
[root@test2019030517 contrib]# mkdir -p /usr/local/postgresql/logs
[root@test2019030517 postgresql-10.5]# chown -R postgres:postgres /usr/local/postgresql
[root@test2019030517 postgresql-10.5]# cat /etc/profile.d/pgsql.sh export PATH=$PATH:/usr/local/postgresql/bin/ [root@test2019030517 postgresql-10.5]# source /etc/profile.d/pgsql.sh
[root@test2019030517 postgresql-10.5]# su postgres 初始化数据库 [postgres@test2019030517 postgresql-10.5]$ initdb -D /usr/local/postgresql/data/ 启动服务 pg_ctl -D /var/postgresql/data -l /var/postgresql/logs/logfile start 连接数据库 [postgres@test2019030517 postgresql-10.5]$ psql 创建数据库 postgres=# create database test; 创建表 postgres=# create table t_user (id integer, name text); 插入测试数据 postgres=# insert into t_user values (1,‘joke‘); 查询数据 postgres=# select * from t_user; 退出psql窗口 postgres-# \q
[postgres@test2019030517 postgresql-10.5]$ vim /usr/local/postgresql/data/postgresql.conf 60 listen_addresses = ‘*‘ # what IP address(es) to listen on; 65 max_connections = 100 # (change requires restart)
[postgres@test2019030517 postgresql-10.5]$ vim /usr/local/postgresql/data/pg_hba.conf #在文件的最下方加上下面的这句话 host all all 0.0.0.0/0 trust
[postgres@test2019030517 postgresql-10.5]$ tail -n 6 /usr/local/postgresql/data/pg_hba.conf # replication privilege. local replication all trust host replication all 127.0.0.1/32 trust host replication all ::1/128 trust host all all 0.0.0.0/0 trust
# 切换root用户 su - root # 防火墙 允许5432 端口
[root@test2019030517 postgresql-10.5]# su - postgres [postgres@test2019030517 ~]$ pg_ctl -D /usr/local//postgresql/data/ -l /usr/local/postgresql/logs/logfile restart
[postgres@test2019030517 ~]$ pg_ctl -D /usr/local//postgresql/data/ -l /usr/local/postgresql/logs/logfile stop
切换到root用户 [postgres@test2019030517 ~]$ su root 找到解压后源码包里面的一个linux文件 [root@test2019030517 postgres]# chmod a+x /data/postgresql-10.5/contrib/start-scripts/linux 复制linux文件到/etc/init.d目录下,更名为postgresql [root@test2019030517 postgres]# cp /data/postgresql-10.5/contrib/start-scripts/linux /etc/init.d/postgresql
31 # Installation prefix
32 prefix=/usr/local/postgresql 33 34 # Data directory 35 PGDATA="/usr/local/postgresql/data" 37 # Who to run the postmaster as, usually "postgres". (NOT "root") 38 PGUSER=postgres
[root@test2019030517 postgres]# chkconfig --add postgresql [root@test2019030517 postgres]# chkconfig --level 2345 postgresql on [root@test2019030517 postgres]# chkconfig --list
标签:The create -- pre div 下载 rest 数据 相关
原文地址:https://www.cnblogs.com/charon2/p/10579865.html