PostgreSQL 安装部署系列:使用YUM 方式在Centos 7.9 安装指定 PostgreSQL -15版本数据库
一、前言
千里之行始于足下,想学习一门数据库,首先要从安装部署开始,先拥有一套属于自己的学习测试库。为了更好的学习该数据库,可以选择一个在企业界使用率比较普及的操作系统,选择稳定版本的操作系统;如果不是为了研究数据库各版本软件差异,不是为了钻研最新版本数据库的新特性,建议选择一款比较新且稳定成熟的数据库版本软件。
PostGreSQL作为一款优秀的开源数据库,在国内外广受欢迎,被用于很多行业,在国内外也有很多的PG fans。
PostGreSQL安装的方式有多种,比如在Linux或MAC操作系统上,可以选择yum、二进制、源码方式安装。
相对于Windows操作系统,PostGreSQL更多安装在Linux等操作系统上,所以对于Windows如何安装PostGreSQL不在本系列讨论范围内。
作为PostGreSQL安装部署系列篇,本次讲解如何在Linux上使用YUM来安装,本次选择采用Centos 7.9操作系统来验证。
接下来,安装部署,走起。
二、前期准备
2.1 配置YUM源
如果你的Linux能联网,建议选择配置一个YUM源,比如选择使用比较普遍的阿里yum源。如何配置YUM源,大家可以搜下网络介绍,本次不作为分享内容,大家可以自行搜索部署。
2.2 下载软件
登录PostGreSQL官网地址:https://www.postgresql.org/download/,进入到如下界面。
参照上图,选择对应的操作系统,本次选择Linux,然后选择对应的Linux的发行版,本次选择Red Hat/Rocky/AlmaLinux发行版,如下所示。
然后进入到https://www.postgresql.org/download/linux/redhat/对应的页面,然后选择相应的数据库版本、对应的操作系统版本、对应的架构模式,本次选择PostGreSQL 15版本,如下所示。
三、安装部署
根据https://www.postgresql.org/download/linux/redhat/所填写内容,拷贝相应命令分别执行。
3.1 安装仓库RPM包
# 使用root用户执行如下命令:
[root@host19c-node1 ~]# sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm-- 上述命令执行结果如下:
pgdg-redhat-repo-latest.noarch.rpm | 9.0 kB 00:00:00
Examining /var/tmp/yum-root-CYlXMy/pgdg-redhat-repo-latest.noarch.rpm: pgdg-redhat-repo-42.0-35PGDG.noarch
Marking /var/tmp/yum-root-CYlXMy/pgdg-redhat-repo-latest.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package pgdg-redhat-repo.noarch 0:42.0-35PGDG will be installed
--> Finished Dependency ResolutionDependencies Resolved=============================================================================================================================================================================================================================================Package Arch Version Repository Size
=============================================================================================================================================================================================================================================
Installing:pgdg-redhat-repo noarch 42.0-35PGDG /pgdg-redhat-repo-latest.noarch 13 kTransaction Summary
=============================================================================================================================================================================================================================================
Install 1 PackageTotal size: 13 k
Installed size: 13 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
** Found 3 pre-existing rpmdb problem(s), 'yum check' output follows:
R-java-3.6.0-1.el7.x86_64 has missing requires of java-headless
ant-1.9.4-2.el7.noarch has missing requires of java-devel >= ('0', '1.5.0', None)
rlwrap-0.43-2.el7.x86_64 has missing requires of /usr/bin/python3.6Installing : pgdg-redhat-repo-42.0-35PGDG.noarch 1/1 Verifying : pgdg-redhat-repo-42.0-35PGDG.noarch 1/1 Installed:pgdg-redhat-repo.noarch 0:42.0-35PGDG Complete!
上述命令执行完毕后,可以使用yum search postgresql命令来查看安装了哪些PostGreSQL数据库相关软件。
# 使用yum search postgresql命令查看相关数据库软件
[root@host19c-node1 ~]# yum search postgresql
-- 上述命令执行结果如下:
pgdg-common/7/x86_64/signature | 198 B 00:00:00
pgdg-common/7/x86_64/signature | 2.9 kB 00:00:00 !!!
pgdg11/7/x86_64/signature | 198 B 00:00:00
pgdg11/7/x86_64/signature | 3.6 kB 00:00:00 !!!
pgdg12/7/x86_64/signature | 198 B 00:00:00
pgdg12/7/x86_64/signature | 3.6 kB 00:00:00 !!!
pgdg13/7/x86_64/signature | 198 B 00:00:00
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Importing GPG key 0x442DF0F8:Userid : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"Fingerprint: 68c9 e2b9 1a37 d136 fe74 d176 1f16 d2e1 442d f0f8Package : pgdg-redhat-repo-42.0-35PGDG.noarch (installed)From : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Is this ok [y/N]: y
pgdg13/7/x86_64/signature | 3.6 kB 00:00:38 !!!
pgdg14/7/x86_64/signature | 198 B 00:00:00
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Importing GPG key 0x442DF0F8:Userid : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"Fingerprint: 68c9 e2b9 1a37 d136 fe74 d176 1f16 d2e1 442d f0f8Package : pgdg-redhat-repo-42.0-35PGDG.noarch (installed)From : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Is this ok [y/N]: N
pgdg14/7/x86_64/signature | 3.6 kB 00:00:12 !!!
https://download.postgresql.org/pub/repos/yum/14/redhat/rhel-7-x86_64/repodata/repomd.xml: [Errno -1] Gpg Keys not imported, cannot verify repomd.xml for repo pgdg14
Trying other mirror.One of the configured repositories failed (PostgreSQL 14 for RHEL / CentOS 7 - x86_64),and yum doesn't have enough cached data to continue. At this point the onlysafe thing yum can do is fail. There are a few ways to work "fix" this:1. Contact the upstream for the repository and get them to fix the problem.2. Reconfigure the baseurl/etc. for the repository, to point to a workingupstream. This is most often useful if you are using a newerdistribution release than is supported by the repository (and thepackages for the previous distribution release still work).3. Run the command with the repository temporarily disabledyum --disablerepo=pgdg14 ...4. Disable the repository permanently, so yum won't use it by default. Yumwill then just ignore the repository until you permanently enable itagain or use --enablerepo for temporary usage:yum-config-manager --disable pgdg14orsubscription-manager repos --disable=pgdg145. Configure the failing repository to be skipped, if it is unavailable.Note that yum will try to contact the repo. when it runs most commands,so will have to try and fail each time (and thus. yum will be be muchslower). If it is a very temporary problem though, this is often a nicecompromise:yum-config-manager --save --setopt=pgdg14.skip_if_unavailable=truefailure: repodata/repomd.xml from pgdg14: [Errno 256] No more mirrors to try.
https://download.postgresql.org/pub/repos/yum/14/redhat/rhel-7-x86_64/repodata/repomd.xml: [Errno -1] Gpg Keys not imported, cannot verify repomd.xml for repo pgdg14
可以发现在执行yum search postgresql根据提示输入N后,会有failure: repodata/repomd.xml from pgdg14: [Errno 256] No more mirrors to try的报错信息。
根据上述报错查询了网上信息,根据https://www.postgresql.org/message-id/C7C14870-90FE-40B8-93CF-1068B1D43F78%40contoso.com这篇文章内容显示是遇到了一个bug,详细信息如下:
3.2 安装数据库
接下来,安装PostGreSQL 15版本数据库,详细信息如下:
# 使用root用户执行yum install -y postgresql15-server命令。
[root@host19c-node1 ~]# sudo yum install -y postgresql15-server
-- 上述命令执行结果如下:
base | 3.6 kB 00:00:00
epel | 4.7 kB 00:00:00
extras | 2.9 kB 00:00:00
pgdg-common/7/x86_64/signature | 198 B 00:00:00
pgdg-common/7/x86_64/signature | 2.9 kB 00:00:00 !!!
pgdg11/7/x86_64/signature | 198 B 00:00:00
pgdg11/7/x86_64/signature | 3.6 kB 00:00:00 !!!
pgdg12/7/x86_64/signature | 198 B 00:00:00
pgdg12/7/x86_64/signature | 3.6 kB 00:00:00 !!!
pgdg13/7/x86_64/signature | 198 B 00:00:00
pgdg13/7/x86_64/signature | 3.6 kB 00:00:00 !!!
pgdg14/7/x86_64/signature | 198 B 00:00:00
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Importing GPG key 0x442DF0F8:Userid : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"Fingerprint: 68c9 e2b9 1a37 d136 fe74 d176 1f16 d2e1 442d f0f8Package : pgdg-redhat-repo-42.0-35PGDG.noarch (installed)From : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
pgdg14/7/x86_64/signature | 3.6 kB 00:00:00 !!!
pgdg15/7/x86_64/signature | 198 B 00:00:00
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Importing GPG key 0x442DF0F8:Userid : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"Fingerprint: 68c9 e2b9 1a37 d136 fe74 d176 1f16 d2e1 442d f0f8Package : pgdg-redhat-repo-42.0-35PGDG.noarch (installed)From : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
pgdg15/7/x86_64/signature | 3.6 kB 00:00:00 !!!
updates | 2.9 kB 00:00:00
(1/11): pgdg12/7/x86_64/group_gz | 245 B 00:00:01
(2/11): pgdg13/7/x86_64/group_gz | 246 B 00:00:00
(3/11): pgdg11/7/x86_64/group_gz | 245 B 00:00:01
(4/11): pgdg12/7/x86_64/primary_db | 416 kB 00:00:01
(5/11): pgdg14/7/x86_64/primary_db | 249 kB 00:00:00
(6/11): pgdg11/7/x86_64/primary_db | 524 kB 00:00:02
(7/11): pgdg14/7/x86_64/group_gz | 244 B 00:00:00
(8/11): pgdg15/7/x86_64/group_gz | 246 B 00:00:00
(9/11): pgdg13/7/x86_64/primary_db | 337 kB 00:00:01
(10/11): pgdg15/7/x86_64/primary_db | 156 kB 00:00:00
(11/11): pgdg-common/7/x86_64/primary_db | 203 kB 00:00:02
Resolving Dependencies
--> Running transaction check
---> Package postgresql15-server.x86_64 0:15.5-1PGDG.rhel7 will be installed
--> Processing Dependency: postgresql15-libs(x86-64) = 15.5-1PGDG.rhel7 for package: postgresql15-server-15.5-1PGDG.rhel7.x86_64
--> Processing Dependency: postgresql15(x86-64) = 15.5-1PGDG.rhel7 for package: postgresql15-server-15.5-1PGDG.rhel7.x86_64
--> Processing Dependency: libpq.so.5()(64bit) for package: postgresql15-server-15.5-1PGDG.rhel7.x86_64
--> Running transaction check
---> Package postgresql15.x86_64 0:15.5-1PGDG.rhel7 will be installed
---> Package postgresql15-libs.x86_64 0:15.5-1PGDG.rhel7 will be installed
--> Finished Dependency ResolutionDependencies Resolved=============================================================================================================================================================================================================================================Package Arch Version Repository Size
=============================================================================================================================================================================================================================================
Installing:postgresql15-server x86_64 15.5-1PGDG.rhel7 pgdg15 5.8 M
Installing for dependencies:postgresql15 x86_64 15.5-1PGDG.rhel7 pgdg15 1.6 Mpostgresql15-libs x86_64 15.5-1PGDG.rhel7 pgdg15 284 kTransaction Summary
=============================================================================================================================================================================================================================================
Install 1 Package (+2 Dependent packages)Total download size: 7.7 M
Installed size: 34 M
Downloading packages:
warning: /var/cache/yum/x86_64/7/pgdg15/packages/postgresql15-libs-15.5-1PGDG.rhel7.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY ] 0.0 B/s | 112 kB --:--:-- ETA
Public key for postgresql15-libs-15.5-1PGDG.rhel7.x86_64.rpm is not installed
(1/3): postgresql15-libs-15.5-1PGDG.rhel7.x86_64.rpm | 284 kB 00:00:01
(2/3): postgresql15-server-15.5-1PGDG.rhel7.x86_64.rpm | 5.8 MB 00:00:01
(3/3): postgresql15-15.5-1PGDG.rhel7.x86_64.rpm | 1.6 MB 00:00:05
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 1.3 MB/s | 7.7 MB 00:00:05
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Importing GPG key 0x442DF0F8:Userid : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"Fingerprint: 68c9 e2b9 1a37 d136 fe74 d176 1f16 d2e1 442d f0f8Package : pgdg-redhat-repo-42.0-35PGDG.noarch (installed)From : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Running transaction check
Running transaction test
Transaction test succeeded
Running transactionInstalling : postgresql15-libs-15.5-1PGDG.rhel7.x86_64 1/3 Installing : postgresql15-15.5-1PGDG.rhel7.x86_64 2/3 Installing : postgresql15-server-15.5-1PGDG.rhel7.x86_64 3/3 Verifying : postgresql15-15.5-1PGDG.rhel7.x86_64 1/3 Verifying : postgresql15-server-15.5-1PGDG.rhel7.x86_64 2/3 Verifying : postgresql15-libs-15.5-1PGDG.rhel7.x86_64 3/3 Installed:postgresql15-server.x86_64 0:15.5-1PGDG.rhel7 Dependency Installed:postgresql15.x86_64 0:15.5-1PGDG.rhel7 postgresql15-libs.x86_64 0:15.5-1PGDG.rhel7 Complete!
3.3 初始化数据库
执行yum install -y postgresql15-server安装数据库,可以查看到数据库的相关命令在/usr/pgsql-15/bin目录下。
[root@host19c-node1 pgsql-15]# pwd
/usr/pgsql-15
[root@host19c-node1 pgsql-15]# ls -lrt
total 12
drwxr-xr-x 2 root root 4096 Dec 27 16:03 bin
drwxr-xr-x 3 root root 4096 Dec 27 16:03 lib
drwxr-xr-x 7 root root 4096 Dec 27 16:03 share
接下来来初始化数据库,操作命令如下:
# 使用root用户执行/usr/pgsql-15/bin/postgresql-15-setup initdb
[root@host19c-node1 ~]# sudo /usr/pgsql-15/bin/postgresql-15-setup initdb
-- 上述命令执行结果如下:
Initializing database ... OK# 可以进行如下配置设置服务器重启后数据库自启动。# 使用root用户执行systemctl enable postgresql-15
[root@host19c-node1 ~]# sudo systemctl enable postgresql-15
Created symlink from /etc/systemd/system/multi-user.target.wants/postgresql-15.service to /usr/lib/systemd/system/postgresql-15.service.# 使用root用户执行systemctl start postgresql-15启动数据库
[root@host19c-node1 ~]# sudo systemctl start postgresql-15# 使用systemctl status postgresql-15命令查看数据库启动状态
[root@host19c-node1 ~]# sudo systemctl status postgresql-15
● postgresql-15.service - PostgreSQL 15 database serverLoaded: loaded (/usr/lib/systemd/system/postgresql-15.service; enabled; vendor preset: disabled)Active: active (running) since Wed 2023-12-27 16:07:39 CST; 8s agoDocs: https://www.postgresql.org/docs/15/static/Process: 35602 ExecStartPre=/usr/pgsql-15/bin/postgresql-15-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)Main PID: 35609 (postmaster)Tasks: 7Memory: 15.0MCGroup: /system.slice/postgresql-15.service├─35609 /usr/pgsql-15/bin/postmaster -D /var/lib/pgsql/15/data/├─35610 postgres: logger ├─35611 postgres: checkpointer ├─35612 postgres: background writer ├─35614 postgres: walwriter ├─35615 postgres: autovacuum launcher └─35616 postgres: logical replication launcher Dec 27 16:07:39 host19c-node1 systemd[1]: Starting PostgreSQL 15 database server...
Dec 27 16:07:39 host19c-node1 postmaster[35609]: 2023-12-27 16:07:39.363 CST [35609] LOG: redirecting log output to logging collector process
Dec 27 16:07:39 host19c-node1 postmaster[35609]: 2023-12-27 16:07:39.363 CST [35609] HINT: Future log output will appear in directory "log".
Dec 27 16:07:39 host19c-node1 systemd[1]: Started PostgreSQL 15 database server.
数据库初始并启动后,可以查看到数据库的默认安装路径在/var/lib/pgsql/15/目录下,相关信息如下:
[root@host19c-node1 ~]# cd /var/lib/pgsql/15/
[root@host19c-node1 15]# ll
total 8
drwx------ 2 postgres postgres 6 Nov 9 04:34 backups
drwx------ 20 postgres postgres 4096 Dec 27 16:07 data
-rw------- 1 postgres postgres 921 Dec 27 16:06 initdb.log
[root@host19c-node1 15]# ls -lrt ./data/
total 68
-rw------- 1 postgres postgres 3 Dec 27 16:06 PG_VERSION
drwx------ 2 postgres postgres 6 Dec 27 16:06 pg_twophase
drwx------ 2 postgres postgres 6 Dec 27 16:06 pg_tblspc
drwx------ 2 postgres postgres 6 Dec 27 16:06 pg_stat_tmp
drwx------ 2 postgres postgres 6 Dec 27 16:06 pg_snapshots
drwx------ 2 postgres postgres 6 Dec 27 16:06 pg_serial
drwx------ 2 postgres postgres 6 Dec 27 16:06 pg_replslot
drwx------ 2 postgres postgres 6 Dec 27 16:06 pg_notify
drwx------ 4 postgres postgres 36 Dec 27 16:06 pg_multixact
drwx------ 2 postgres postgres 6 Dec 27 16:06 pg_dynshmem
drwx------ 2 postgres postgres 6 Dec 27 16:06 pg_commit_ts
-rw------- 1 postgres postgres 29460 Dec 27 16:06 postgresql.conf
-rw------- 1 postgres postgres 88 Dec 27 16:06 postgresql.auto.conf
-rw------- 1 postgres postgres 1636 Dec 27 16:06 pg_ident.conf
-rw------- 1 postgres postgres 4577 Dec 27 16:06 pg_hba.conf
drwx------ 3 postgres postgres 60 Dec 27 16:06 pg_wal
drwx------ 2 postgres postgres 18 Dec 27 16:06 pg_xact
drwx------ 2 postgres postgres 18 Dec 27 16:06 pg_subtrans
drwx------ 5 postgres postgres 33 Dec 27 16:06 base
drwx------ 2 postgres postgres 32 Dec 27 16:07 log
-rw------- 1 postgres postgres 30 Dec 27 16:07 current_logfiles
-rw------- 1 postgres postgres 58 Dec 27 16:07 postmaster.opts
drwx------ 2 postgres postgres 6 Dec 27 16:07 pg_stat
-rw------- 1 postgres postgres 104 Dec 27 16:07 postmaster.pid
drwx------ 2 postgres postgres 4096 Dec 27 16:08 global
drwx------ 4 postgres postgres 68 Dec 27 16:12 pg_logical
四、验证测试
数据库安装后,我们来进行简单的验证测试。
使用yum安装数据库后,默认会创建postgres用户。
# 切换到postgres用户
[root@host19c-node1 ~]# su - postgres
Last login: Wed Dec 27 16:09:13 CST 2023 on pts/5
-bash-4.2$ psql
psql (15.5)
Type "help" for help.# 查看初始化后的数据库默认库和用户
postgres=# \d
Did not find any relations.
postgres=# \lList of databasesName | Owner | Encoding | Collate | Ctype | ICU Locale | Locale Provider | Access privileges
-----------+----------+----------+-------------+-------------+------------+-----------------+-----------------------postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | libc | template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | libc | =c/postgres +| | | | | | | postgres=CTc/postgrestemplate1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | libc | =c/postgres +| | | | | | | postgres=CTc/postgres
(3 rows)# 创建一个测试库
postgres=# CREATE DATABASE pg15;CREATE DATABASE
postgres=#
postgres=# \c pg15;
You are now connected to database "pg15" as user "postgres".
pg15=# CREATE TABLE pgtb (
pg15(# id SERIAL PRIMARY KEY,
pg15(# username VARCHAR(50) NOT NULL,
pg15(# email VARCHAR(100) NOT NULL UNIQUE,
pg15(# created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
pg15(# );
CREATE TABLE
pg15=#
pg15=# INSERT INTO pgtb (username, email) VALUES
pg15-# ('user1', 'user1@example.com'),
pg15-# ('user2', 'user2@example.com');INSERT 0 2
pg15=#
pg15=# select * from pgtb;id | username | email | created_at
----+----------+-------------------+----------------------------1 | user1 | user1@example.com | 2023-12-27 16:37:16.2188112 | user2 | user2@example.com | 2023-12-27 16:37:16.218811
(2 rows)pg15=#
万里长征已开启第一步,现在你已拥有了一个PG数据库,请开启你的PG学习之旅吧。
五、卸载数据库
卸载使用YUM安装的数据库也比较简单,可以采用yum remove postgresql15-server卸载安装的数据库。
[root@host19c-node1 ~]# yum remove postgresql15-server
Resolving Dependencies
--> Running transaction check
---> Package postgresql15-server.x86_64 0:15.5-1PGDG.rhel7 will be erased
--> Processing Dependency: postgresql15-server(x86-64) = 15.5-1PGDG.rhel7 for package: postgresql15-contrib-15.5-1PGDG.rhel7.x86_64
--> Running transaction check
---> Package postgresql15-contrib.x86_64 0:15.5-1PGDG.rhel7 will be erased
--> Finished Dependency ResolutionDependencies Resolved=============================================================================================================================================================================================================================================Package Arch Version Repository Size
=============================================================================================================================================================================================================================================
Removing:postgresql15-server x86_64 15.5-1PGDG.rhel7 @pgdg15 24 M
Removing for dependencies:postgresql15-contrib x86_64 15.5-1PGDG.rhel7 @pgdg15 2.5 MTransaction Summary
=============================================================================================================================================================================================================================================
Remove 1 Package (+1 Dependent package)Installed size: 27 M
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transactionErasing : postgresql15-contrib-15.5-1PGDG.rhel7.x86_64 1/2 Erasing : postgresql15-server-15.5-1PGDG.rhel7.x86_64 2/2 Verifying : postgresql15-contrib-15.5-1PGDG.rhel7.x86_64 1/2 Verifying : postgresql15-server-15.5-1PGDG.rhel7.x86_64 2/2 Removed:postgresql15-server.x86_64 0:15.5-1PGDG.rhel7 Dependency Removed:postgresql15-contrib.x86_64 0:15.5-1PGDG.rhel7 Complete!
相关文章:

PostgreSQL 安装部署系列:使用YUM 方式在Centos 7.9 安装指定 PostgreSQL -15版本数据库
一、前言 千里之行始于足下,想学习一门数据库,首先要从安装部署开始,先拥有一套属于自己的学习测试库。为了更好的学习该数据库,可以选择一个在企业界使用率比较普及的操作系统,选择稳定版本的操作系统;如果…...

知识图谱8:深度学习各种小模型
1、知识图谱的展示有很多工具 Neo4j Browser - - - - 浏览器版本 Neo4j Desktop - - - - 桌面版本 graphX - - - - 可以集成到Neo4j Desktop Neo4j 提供的 Neo4j Bloom 是用户友好的可视化工具,适合非技术用户直观地浏览图数据。Cypher 是其核心查询语言…...
为什么 JavaScript 中的 `new` 运算符报错?
在 JavaScript 中,new 运算符通常用于创建一个新对象并调用构造函数来初始化对象。然而,new 运算符可能会引发一些错误,通常是由于以下原因导致的: 构造函数没有正确的定义: 如果使用 new 运算符调用的函数没有正确地定…...

Tomcat,javaweb, servlet , springBoot
在server.xml里配置服务器 <scope>provided</scope>打包的时候,这个jar包不会被打进去,因为tomcat已将封装了这个jar包,没必要要这个...

使用Kimi开发自己的问答应用
概述 Kimi是大家常用的一个人工智能助手,本文使用Kimi开发文档,以node作为后端,开发与一个问答系统 实现效果 Kimi简介 Kimi是由Moonshot AI开发的人工智能助手,擅长中文和英文对话。目标是帮助用户解决问题、提供信息和执行任…...

TypeScript进阶
Typescript进阶 基础知识 JavaScript 的核心特点就是灵活,但随着项目规模的增大,灵活反而增加开发者的心智负担。例如在代码中一个变量可以被赋予字符串、布尔、数字、甚至是函数,这样就充满了不确定性。而且这些不确定性可能需要在代码运行…...

jenkins邮件的配置详解
Jenkins邮件的配置涉及多个步骤和细节,以下是详细的配置指南: 一、前期准备 确定邮件服务:明确Jenkins将要使用的邮件服务,如QQ邮箱、163邮箱、公司邮箱(基于Microsoft 365或Exchange Server)等。获取SMTP配置信息:根据邮件服务类型,获取相应的SMTP服务器地址、端口号…...

小皮面板(PHPSTUDY)配置多个域名或IP
问题描述 小皮面板默认采用nginx的静态部署,按照使用nginx的习惯只需要额外添加一个server即可,但是会发现直接往配置文件里添加新的server是不生效的,小皮的官网论坛几乎已经停止维护,因此资料较少,原本也没有仔细使…...

【大语言模型】LangChain LCEL 表达式语言
【大语言模型】LangChain LCEL 表达式语言 一、简介二、LCEL的优势三、LCEL 的基本使用1、Runnable 对象 四、实战实例 一、简介 LangChain LCEL 的全称为 LangChain Expression Language 即可直译为 LangChain 表达式。 为了构造更复杂的 LLM 应用并且更为简便快捷的构造 LLM…...
Leetcode 3382. Maximum Area Rectangle With Point Constraints II
Leetcode 3382. Maximum Area Rectangle With Point Constraints II 1. 解题思路2. 代码实现 题目链接:3382. Maximum Area Rectangle With Point Constraints II 1. 解题思路 这一题是题目3380. Maximum Area Rectangle With Point Constraints I的进阶版&#…...

MitelMiCollab 身份绕过导致任意文件读取漏洞复现(CVE-2024-41713)
0x01 产品描述: Mitel MiCollab 是一个企业协作平台,它将各种通信工具整合到一个应用程序中,提供语音和视频通话、消息传递、状态信息、音频会议、移动支持和团队协作功能。0x02 漏洞描述: Mitel MiCollab 的 NuPoint 统一消息 (NPM) 组件中存在身份验证绕过漏洞,由于输入…...

DVWA 靶场 SQL 注入报错 Illegal mix of collations for operation ‘UNION‘ 的解决方案
在 dvwa 靶场进行联合 SQL 注入时,遇到报错 Illegal mix of collations for operation UNION报错如下图: 解决办法: 找到文件MySQL.php 大致位置在dvwaincludesDBMS 目录下 使用编辑器打开 检索$create_db 第一个就是 在{$_DVWA[ ‘db_d…...
京准电钟分享:医院网络内NTP时间同步服务器作用是什么?
京准电钟分享:医院网络内NTP时间同步服务器作用是什么? 京准电钟分享:医院网络内NTP时间同步服务器作用是什么? 时间同步技术必定将是整个大数据处理系统的重要支撑和保障。时间同步技术使数据产生与处理系统的所有节点具有全局…...
HTML DOM API
HTMLInputElement HTMLInputElement 接口提供了特定的属性和方法,用于管理 <input> 元素的选项、布局和外观。 HTMLInputElement 和 <input> 之间的关系可以理解为接口与具体元素的关系: <input> 元素: <input> 是…...

java时间处理SimpleDateFormat详解
文章目录 常用构造函数日期格式模式常见用法1. 格式化日期2. 解析日期字符串 注意事项示例扩展:指定区域和时区 SimpleDateFormat 是 Java 中用于日期和时间格式化的类,属于 java.text 包。它允许开发者将日期对象格式化为字符串,或者将字符…...
redis-stack redisSearch环境安装搭建
RedisSearch在redis许可证变更之后显得是redis中的一大特色,闲来无事学习记录一下。 尝试通过源码编译redisSearch,貌似非常费劲,所以建议使用docker或者Linux的发行包进行安装redis-stack。redis-stack是基于redis的模块化机制进行一个扩展…...
go返回多个errors
起因 有时候大家可能需要返回多个errors的场景,所以这个时候可能就会考虑如何实现、怎么实现比较好 实现 package mainimport ("errors""fmt" )func main() {errs : retErrors("hello,world")fmt.Println(errs) }func retErrors(t…...
Monkey结合appium模拟操作特定界面
目录 1. 使用 Monkey 操作特定界面(通过UI标识来限制) 2. 结合 uiautomator 或 appium 定位特定元素 步骤: 3. 使用 Monkey Appium 控制特定界面点击 4. 如何结合 Appium 与 Monkey 5. 限制 Monkey 只点击固定界面上的元素 使用 --pc…...

Ubuntu22.04深度学习环境安装【cuda+cudnn】
为了复现一篇深度学习论文,特意安装了Linux系统。前一天已经安装Linux显卡驱动,现在需要安装cuda、cudnn等。 论文代码 论文PDF 确定包版本: 根据论文提供的代码。在requirements.txt中发现cuda版本为11.7,cudnn为8.5.0,python没…...

go语言的sdk项目搭建与git 操作标签tag并推送至远程仓库
在搭建 SDK 项目并结合 Git 操作标签(Tag)时,通常会涉及项目初始化、版本管理、Git 标签的创建与管理等内容。以下是一个完整的步骤指南,帮助您搭建 SDK 项目并学习如何使用 Git 标签。 ### 1. **搭建 SDK 项目** 首先ÿ…...

STM32F4基本定时器使用和原理详解
STM32F4基本定时器使用和原理详解 前言如何确定定时器挂载在哪条时钟线上配置及使用方法参数配置PrescalerCounter ModeCounter Periodauto-reload preloadTrigger Event Selection 中断配置生成的代码及使用方法初始化代码基本定时器触发DCA或者ADC的代码讲解中断代码定时启动…...

DIY|Mac 搭建 ESP-IDF 开发环境及编译小智 AI
前一阵子在百度 AI 开发者大会上,看到基于小智 AI DIY 玩具的演示,感觉有点意思,想着自己也来试试。 如果只是想烧录现成的固件,乐鑫官方除了提供了 Windows 版本的 Flash 下载工具 之外,还提供了基于网页版的 ESP LA…...
Linux云原生安全:零信任架构与机密计算
Linux云原生安全:零信任架构与机密计算 构建坚不可摧的云原生防御体系 引言:云原生安全的范式革命 随着云原生技术的普及,安全边界正在从传统的网络边界向工作负载内部转移。Gartner预测,到2025年,零信任架构将成为超…...

【配置 YOLOX 用于按目录分类的图片数据集】
现在的图标点选越来越多,如何一步解决,采用 YOLOX 目标检测模式则可以轻松解决 要在 YOLOX 中使用按目录分类的图片数据集(每个目录代表一个类别,目录下是该类别的所有图片),你需要进行以下配置步骤&#x…...
解决本地部署 SmolVLM2 大语言模型运行 flash-attn 报错
出现的问题 安装 flash-attn 会一直卡在 build 那一步或者运行报错 解决办法 是因为你安装的 flash-attn 版本没有对应上,所以报错,到 https://github.com/Dao-AILab/flash-attention/releases 下载对应版本,cu、torch、cp 的版本一定要对…...
爬虫基础学习day2
# 爬虫设计领域 工商:企查查、天眼查短视频:抖音、快手、西瓜 ---> 飞瓜电商:京东、淘宝、聚美优品、亚马逊 ---> 分析店铺经营决策标题、排名航空:抓取所有航空公司价格 ---> 去哪儿自媒体:采集自媒体数据进…...
Java 二维码
Java 二维码 **技术:**谷歌 ZXing 实现 首先添加依赖 <!-- 二维码依赖 --><dependency><groupId>com.google.zxing</groupId><artifactId>core</artifactId><version>3.5.1</version></dependency><de…...

听写流程自动化实践,轻量级教育辅助
随着智能教育工具的发展,越来越多的传统学习方式正在被数字化、自动化所优化。听写作为语文、英语等学科中重要的基础训练形式,也迎来了更高效的解决方案。 这是一款轻量但功能强大的听写辅助工具。它是基于本地词库与可选在线语音引擎构建,…...

Kafka入门-生产者
生产者 生产者发送流程: 延迟时间为0ms时,也就意味着每当有数据就会直接发送 异步发送API 异步发送和同步发送的不同在于:异步发送不需要等待结果,同步发送必须等待结果才能进行下一步发送。 普通异步发送 首先导入所需的k…...
Git常用命令完全指南:从入门到精通
Git常用命令完全指南:从入门到精通 一、基础配置命令 1. 用户信息配置 # 设置全局用户名 git config --global user.name "你的名字"# 设置全局邮箱 git config --global user.email "你的邮箱example.com"# 查看所有配置 git config --list…...