当前位置: 首页> 汽车> 车展 > 福田补贴每人9000元_交友小程序源码_百度竞价推广怎么样才有效果_海城seo网站排名优化推广

福田补贴每人9000元_交友小程序源码_百度竞价推广怎么样才有效果_海城seo网站排名优化推广

时间:2025/7/12 8:58:28来源:https://blog.csdn.net/shulu/article/details/143428618 浏览次数: 0次
福田补贴每人9000元_交友小程序源码_百度竞价推广怎么样才有效果_海城seo网站排名优化推广

1.系统环境

  • 系统

    系统版本:centos7.9

    gcc版本:系统自带(4.8.5)

  • make

    3.80版本以上

    make --version
    GNU Make 3.82
    
  • 安装依赖包

    yum install readline readline-devel
    yum install zlib zlib-devel
    

    zlib:默认情况下一般要使用数据库中的压缩功能,需要第三方的zlib压缩开发包支持。

    readline:如果想要方便地在psql中使用上下方向键把历史命令找出来,需要安装readline开发包。

    如果还需要支持其它功能需要安装其它依赖包:

    yum install perl perl-ExtUtils-Embed
    yum install openssl openssl-devel
    yum install libxml2 libxml2-devel
    yum install uuid uuid-devel
    yum install tcl tcl-devel
    yum install python-devel
    

2.安装部署

  • 创建用户

    groupadd postgres
    useradd -g postgres postgres
    passwd postgres
    
  • 创建目录

    df -Th
    mkdir -p /u01/pginstall/pg14.13
    cd /u01/pginstall/pg14.13
    mkdir data
    chown -R postgres:postgres data
    
  • 安装

    可以使用root编译安装,然后使用postgres账户进行数据库的创建

    #以root账号编译安装
    tar zxvf postgresql-14.13.tar.gz
    cd postgresql-14.13
    ./configure --help
    ./configure --prefix=/u01/pginstall/pg14.13 #基础功能
    ./configure --prefix=/u01/pginstall/pg14.13 --with-perl --with-python --with-openssl --with-libxml --with-tcl --with-ossp-uuidmake -j world  #包含contrib目录下的插件
    make install-world
    或者
    make -j
    make install
    cd contrib
    make
    make install
    

    --prefix=/u01/pginstall/pg14.13:这个选项指定了软件的安装目录。

    --with-perl:这个选项启用了Perl语言的支持。PostgreSQL可以使用Perl编写扩展或触发器等,因此如果需要在数据库中使用Perl,就应该启用这个选项。

    --with-python:这个选项启用了Python语言的支持。与Perl类似,启用这个选项后,PostgreSQL将能够使用Python编写扩展或触发器等。

    --with-openssl:启用OpenSSL的支持。OpenSSL是一个强大的开源工具包,用于实现SSL和TLS协议,以及提供加密功能。在PostgreSQL中启用OpenSSL支持可以增强数据库的安全性。

    --with-libxml :用于启用对 XML 数据类型的支持。

    --with-tcl:启用 Tcl(Tool Command Language)语言的支持。这允许 PostgreSQL 使用 Tcl 编写的扩展、触发器或其他功能。

    --with-ossp-uuid:启用 OSSP UUID 库的支持。UUID(Universally Unique Identifier)是一种用于唯一标识信息的标准。启用此选项后,PostgreSQL 可以生成和使用 UUID。

  • 初始化数据库

    /u01/pginstall/pg14.13/bin/initdb -D /u01/pginstall/pg14.13/dataThe 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.fixing permissions on existing directory /u01/pginstall/pg14.13/data ... ok
    creating subdirectories ... ok
    selecting dynamic shared memory implementation ... posix
    selecting default max_connections ... 100
    selecting default shared_buffers ... 128MB
    selecting default time zone ... Asia/Shanghai
    creating configuration files ... ok
    running bootstrap script ... ok
    performing post-bootstrap initialization ... ok
    syncing data to disk ... okinitdb: 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:/u01/pginstall/pg14.13/bin/pg_ctl -D /u01/pginstall/pg14.13/data -l logfile start[postgres@db01 data]$ ll
    total 56
    drwx------ 5 postgres postgres    41 Nov  1 11:47 base
    drwx------ 2 postgres postgres  4096 Nov  1 11:47 global
    drwx------ 2 postgres postgres     6 Nov  1 11:47 pg_commit_ts
    drwx------ 2 postgres postgres     6 Nov  1 11:47 pg_dynshmem
    -rw------- 1 postgres postgres  4789 Nov  1 11:47 pg_hba.conf
    -rw------- 1 postgres postgres  1636 Nov  1 11:47 pg_ident.conf
    drwx------ 4 postgres postgres    68 Nov  1 11:47 pg_logical
    drwx------ 4 postgres postgres    36 Nov  1 11:47 pg_multixact
    drwx------ 2 postgres postgres     6 Nov  1 11:47 pg_notify
    drwx------ 2 postgres postgres     6 Nov  1 11:47 pg_replslot
    drwx------ 2 postgres postgres     6 Nov  1 11:47 pg_serial
    drwx------ 2 postgres postgres     6 Nov  1 11:47 pg_snapshots
    drwx------ 2 postgres postgres     6 Nov  1 11:47 pg_stat
    drwx------ 2 postgres postgres     6 Nov  1 11:47 pg_stat_tmp
    drwx------ 2 postgres postgres    18 Nov  1 11:47 pg_subtrans
    drwx------ 2 postgres postgres     6 Nov  1 11:47 pg_tblspc
    drwx------ 2 postgres postgres     6 Nov  1 11:47 pg_twophase
    -rw------- 1 postgres postgres     3 Nov  1 11:47 PG_VERSION
    drwx------ 3 postgres postgres    60 Nov  1 11:47 pg_wal
    drwx------ 2 postgres postgres    18 Nov  1 11:47 pg_xact
    -rw------- 1 postgres postgres    88 Nov  1 11:47 postgresql.auto.conf
    -rw------- 1 postgres postgres 28765 Nov  1 11:47 postgresql.conf
    
  • 设置环境变量

    vi .bashrc
    export PGDATA=/u01/pginstall/pg14.13/data
    export PATH=/u01/pginstall/pg14.13/bin:$PATHpsql
    \q
    
  • pg_hba.conf

    host    all             all             0.0.0.0/0               md5
    
  • postgres.conf

    listen_addresses = '*'
    
  • 重启

    pg_ctl restart -m fast
    
  • 关闭

    pg_ctl stop -m fast
    -m fast:表示以fast模式快速干净的关闭数据库,关闭过程中回回滚未提交的事务,下次启动无需进行实例恢复。
    MODE can be "smart", "fast", or "immediate"
    smart       quit after all clients have disconnected
    fast        quit directly, with proper shutdown (default)
    immediate   quit without complete shutdown; will lead to recovery on restart
    
  • 启动

    如果设置了PGDATA环境变量:
    pg_ctl start -l logfile
    
  • 查看状态

    pg_ctl status
    pg_ctl: server is running (PID: 2647)
    /data/postgres/13.3/bin/postgrespstree -p 2647
    postgres(2647)─┬─postgres(2649)├─postgres(2650)├─postgres(2651)├─postgres(2652)├─postgres(2653)└─postgres(2654)
    

3.psql使用

  • psql连接数据库

    psql -h localhost -p 5432 -d postgres -U postgres\c 列出当前用户
    \d 列出对象
    create table t1(name text);
    \d t1 列出表结构
    \h create table  查看帮助
    select version();
    \l 列出数据库
    \l+ 包含表空间、大小select pg_postmaster_start_time();数据库启动时间\du 查看用户
    \dt+ t1 查看t1表大小\di 查看索引
    create index idx_name on t1(name);
    \di+ idx_name 查看索引大小创建用户:
    \h create user
    \h create role
    create user fx superuser password '123456';创建数据库:
    create database testdb owner fx;
    \c testdb fx 使用fx用户连接testdb查看表空间:
    \db查看视图:
    \dv
    
关键字:福田补贴每人9000元_交友小程序源码_百度竞价推广怎么样才有效果_海城seo网站排名优化推广

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: