0
点赞
收藏
分享

微信扫一扫

IovrySQL教程(一)YUM安装

at小涛 2022-03-30 阅读 81

YUM下载地址:Highgo Yum Repositoryicon-default.png?t=M276https://yum.highgo.ca/ivorysql.html

点击图中按钮下载:

传到Centos7下,执行以下命令安装:

rpm -ivh ivorysql-release-1.0-1.noarch.rpm

 搜索安装包:

yum search ivory

结果如下:

ivorysql1.x86_64 : IvorySQL client programs and libraries
ivorysql1-contrib.x86_64 : Contributed source and binaries distributed with IvorySQL
ivorysql1-devel.x86_64 : IvorySQL development header files and libraries
ivorysql1-docs.x86_64 : Extra documentation for IvorySQL
ivorysql1-libs.x86_64 : The shared libraries required for any IvorySQL clients
ivorysql1-llvmjit.x86_64 : Just-in-time compilation support for IvorySQL
ivorysql1-plperl.x86_64 : The Perl procedural language for IvorySQL
ivorysql1-plpython3.x86_64 : The Python3 procedural language for IvorySQL
ivorysql1-pltcl.x86_64 : The Tcl procedural language for IvorySQL
ivorysql1-server.x86_64 : The programs needed to create and run a IvorySQL server
ivorysql1-test.x86_64 : The test suite distributed with IvorySQL
ivorysql-release.noarch : Highgo Software Inc. Yum Repository Configuration RPM

要安装数据库服务,执行以下命令:

yum install -y ivorysql1-server.x86_64

配置数据库服务:

创建用户:

/usr/sbin/groupadd -g 1001 ivory
/usr/sbin/useradd -g 1001 -u 1001 ivory
passwd ivory

创建目录:

mkdir -p /usr/local/ivorysql/ivorysql-1
mkdir -p /ivorysql/1.2/data
mkdir /var/run/ivorysql/ivorysql-1
ln -sf /usr/local/ivorysql/ivorysql-1 /opt/ivorysql
chown -R ivory.ivory /usr/local/ivorysql/ivorysql-1
chown -R ivory.ivory /ivorysql/1.2/
chown -R ivory.ivory /var/run/ivorysql/ivorysql-1
chmod 0700 /usr/local/ivorysql/ivorysql-1
chmod 0700 /ivorysql/1.2/data

配置用户ivory环境变量:

echo "set user ivory's env:"
cat >> /home/ivory/.bash_profile <<EOF

################################ add by QCJ at `date +%Y-%m-%d_%H:%M:%S` ################################
umask 022
export LD_LIBRARY_PATH=/usr/local/ivorysql/ivorysql-1/lib:\$LD_LIBRARY_PATH
export PATH=/usr/local/ivorysql/ivorysql-1/bin:\$PATH
export PGDATA=/ivorysql/1.2/data
################################ the End Line  at `date +%Y-%m-%d_%H:%M:%S` ################################

EOF

切换到ivory用户(su - ivory)执行以下命令:


source .bash_profile

echo "666666" > /tmp/pwfile
initdb -A md5 -D $PGDATA -E 'UTF8' --pwfile=/tmp/pwfile

cat >> $PGDATA/pg_hba.conf <<EOF
################################ add by QCJ at `date +%Y-%m-%d_%H:%M:%S` ################################
# IPv4 local connections:
  host    all             all             0.0.0.0/0               md5
################################ the End Line  at `date +%Y-%m-%d_%H:%M:%S` ################################

EOF

cat >> /home/ivory/.pgpass <<EOF
# host:port:database:user:password
localhost:5333:postgres:ivory:666666
EOF

chmod 0600 /home/ivory/.pgpass

 启动数据库:

pg_ctl start

进入数据库:

[ivory@Node02 ~]$ psql postgres ivory
psql (14.2)
Type "help" for help.

postgres=# 

 

举报

相关推荐

0 条评论