暂无图片
暂无图片
3
暂无图片
暂无图片
暂无图片

Ubuntu 22.04.1 LTS 下编译安装IvorySQL

原创 夏克 2022-11-20
1118

图片.png

摘要

IvorySQL可以在Linux, OSX, Unix和Windows平台上构建。虽然官方给出了Linux的编译安装步骤,但是实际上并不适用于Ubuntu。本文主要演示IvorySQL在Ubuntu 22.04.1 LTS 上的编译、部署及运行

环境准备

编译环境

实验环境使用的是Windows自带Linux系统——WSL。

  • 系统信息
PRETTY_NAME="Ubuntu 22.04.1 LTS" NAME="Ubuntu" VERSION_ID="22.04" VERSION="22.04.1 LTS (Jammy Jellyfish)" VERSION_CODENAME=jammy ID=ubuntu ID_LIKE=debian HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" UBUNTU_CODENAME=jammy
复制
  • 编译器
gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0 Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
复制

源代码

git clone https://github.com/IvorySQL/IvorySQL.git
复制

依赖包

sudo apt install libssl-dev libreadline-dev libbison-dev zlib1g-dev
复制

注:此处与官网有差别。

  • (可选)编译doc
sudo apt install libxml2 libxml2-utils xsltproc
复制

编译

./configure --prefix=/home/frank/ivorysql
复制

注:/home/frank/ivorysql 是指定的安装路径,可以根据你自己的环境进行修改。

make -j 8
复制

注:-j N 是指定并行编译的进程个数,可以根据你CPU核数进行调整。

make install
复制

验证

  • 初始化
cd /home/frank/ivorysql/bin $ ./initdb -D /home/frank/IvorySQL/data The files belonging to this database system will be owned by user "frank". This user must also own the server process. The database cluster will be initialized with locale "C.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. creating directory /home/frank/IvorySQL/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 ... loading ivy contrib modules ... ok syncing data to disk ... ok initdb: warning: enabling "trust" authentication for local connections initdb: hint: 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: pg_ctl -D /home/frank/IvorySQL/data -l logfile start
复制
  • 启动数据库
cd /home/frank/ivorysql $ ./bin/pg_ctl -D /home/frank/IvorySQL/data -l logfile start waiting for server to start.... done server started
复制
  • 连接IvorySQL
$ bin/psql -p5333 -d postgres psql (16devel) Type "help" for help.
复制
  • 验证版本
postgres=# \l List of databases Name | Owner | Encoding | Collate | Ctype | ICU Locale | Locale Provider | Access privileges -----------+-------+----------+---------+---------+------------+-----------------+------------------- ivorysql | frank | UTF8 | C.UTF-8 | C.UTF-8 | | libc | postgres | frank | UTF8 | C.UTF-8 | C.UTF-8 | | libc | template0 | frank | UTF8 | C.UTF-8 | C.UTF-8 | | libc | =c/frank + | | | | | | | frank=CTc/frank template1 | frank | UTF8 | C.UTF-8 | C.UTF-8 | | libc | =c/frank + | | | | | | | frank=CTc/frank (4 rows) postgres=# select version(); version ---------------------------------------------------------------------------------------------------------------------------- PostgreSQL 16devel (IvorySQL 3devel) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0, 64-bit (1 row)
复制

注:version()列出的版本信息中,操作系统和gcc版本与上述实验环境一致。

总结

IvorySQL的编译安装与PostgreSQL的编译安装基本一样,有几个地方需要注意一下,1. 监听端口是5333;2. 安装后\l查看数据库,会有一个名为ivorysql的数据库;3.select * from pg_extension;,会看到默认安装了plisql插件。

图片.png

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论

目录
  • 摘要
  • 环境准备
    • 编译环境
    • 源代码
    • 依赖包
  • 编译
  • 验证
  • 总结