zoukankan      html  css  js  c++  java
  • postgresql-9.2 install

    [root@weblogic opt]# groupadd postgresql
    [root@weblogic opt]# useradd -g postgresql postgres

    [root@weblogic opt]# passwd postgres

    [root@weblogic opt]# chmod +x postgresql-9.2.19-1-linux-x64.run
    [root@weblogic opt]# ll postgresql-9.2.19-1-linux-x64.run
    -rwxr-xr-x 1 root root 39523652 Sep  6 01:12 postgresql-9.2.19-1-linux-x64.run

    安装

    [root@weblogic opt]# ./postgresql-9.2.19-1-linux-x64.run

    next---next 

    配置环境变量

    /etc/profile

    export LD_LIBRARY_PATH=/opt/PostgreSQL/9.2/lib:$LD_LIBRARY_PATH
    export PATH=/opt/PostgreSQL/9.2/bin:$PATH
    export PGDATA=/opt/PostgreSQL/9.2/data

    source /etc/profile

    su - postgres

    cd   /opt/PostgreSQL/9.2/bin

    初始化数据库

    [postgres@weblogic bin]$ ./initdb -D /opt/PostgreSQL/9.2/data
    initdb: invalid locale name ""
    initdb: invalid locale name ""
    initdb: invalid locale name ""
    initdb: invalid locale name ""
    initdb: invalid locale name ""
    initdb: invalid locale name ""
    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 "C".
    The default database encoding has accordingly been set to "SQL_ASCII".
    The default text search configuration will be set to "english".
    fixing permissions on existing directory /opt/PostgreSQL/9.2/data ... ok
    creating subdirectories ... ok
    selecting default max_connections ... 100
    selecting default shared_buffers ... 32MB
    creating configuration files ... ok
    creating template1 database in /opt/PostgreSQL/9.2/data/base/1 ... ok
    initializing pg_authid ... ok
    initializing dependencies ... ok
    creating system views ... ok
    loading system objects' descriptions ... ok
    creating collations ... locale: Cannot set LC_MESSAGES to default locale: No such file or directory
    ok
    creating conversions ... ok
    creating dictionaries ... ok
    setting privileges on built-in objects ... ok
    creating information schema ... ok
    loading PL/pgSQL server-side language ... ok
    vacuuming database template1 ... ok
    copying template1 to template0 ... ok
    copying template1 to postgres ... 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:
        ./postgres -D /opt/PostgreSQL/9.2/data
    or
        ./pg_ctl -D /opt/PostgreSQL/9.2/data -l logfile start
    [postgres@weblogic bin]$

    启动PG

    [postgres@weblogic bin]$ ./postgres -i -D /opt/PostgreSQL/9.2/data &
    [1] 18363
    [postgres@weblogic bin]$ LOG:  database system was shut down at 2019-09-06 01:59:02 PDT
    LOG:  database system is ready to accept connections
    LOG:  autovacuum launcher started
    [postgres@weblogic bin]$ lsof -i:5432
    COMMAND    PID     USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
    postgres 18363 postgres    3u  IPv4 439718      0t0  TCP *:postgres (LISTEN)
    postgres 18363 postgres    4u  IPv6 439719      0t0  TCP *:postgres (LISTEN)
    [postgres@weblogic bin]$
     

     登录PG

    [postgres@weblogic bin]$ psql
    psql.bin (9.2.19)
    Type "help" for help.
    postgres=# du
                                 List of roles
     Role name |                   Attributes                   | Member of
    -----------+------------------------------------------------+-----------
     postgres  | Superuser, Create role, Create DB, Replication | {}
    postgres=#

    PG 版本查看:

    postgres=# select version();
                                                        version                                                    
    ----------------------------------------------------------------------------------------------------------------
     PostgreSQL 9.2.19 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-55), 64-bit
    (1 row)
    postgres=#
  • 相关阅读:
    DNS原理总结及其解析过程详解
    linux修改进程名
    mq_open失败,Invalid argument
    Posix消息队列
    undefined reference to 'mq_open'
    量化投资学习笔记08——统计学基础补漏
    量化投资学习笔记07——python知识补漏
    量化投资学习笔记06——《打开量化投资的黑箱》读书笔记
    量化投资学习笔记05——检验计算回测指标程序
    量化投资学习笔记04——回测实盘策略
  • 原文地址:https://www.cnblogs.com/vzhangxk/p/11476928.html
Copyright © 2011-2022 走看看