安装操作系统 |
Kylin Linux Advanced Server release V10 (Tercel) Kernel: 4.19.90-17.ky10.aarch64 |
Java环境 |
java version "1.8.0_261" |
cpu型号 |
Phytium,FT-2000+/64 |
内存 |
256G |
磁盘 |
240G(ssd盘) |
在root用户下执行:useradd antdb进行antdb用户的创建。
执行:passwd antdb修改antdb用户密码
[root@db3 ~]# cat /etc/security/limits.conf
# /etc/security/limits.conf
antdb soft nproc 65536
antdb hard nproc 65536
antdb soft nofile 278528
antdb hard nofile 278528
antdb soft stack unlimited
antdb soft core unlimited
antdb hard core unlimited
antdb soft memlock 250000000
antdb hard memlock 250000000
保存文件后,执行su - antdb切换到antdb用户,执行ulimit -a检查是否生效。
在安全允许的条件下,建议给antdb用户加上sudo权限。
root用户执行visudo进行编辑界面,找到Allow root to run any commands anywhere所在行,在行下面添加:
antdb ALL=(ALL) ALL
保存文件退出。
su - antdb切换到antdb用户,执行sudo id,预期会提示输入用户密码,输出为:
uid=0(root) gid=0(root) groups=0(root)
表示sudo权限添加成功。
如果是离线环境,建议在主机上通过操作系统的镜像文件搭建本地yum源,方便依赖的安装。
配置本地yum源:
[root@db3 ~]# cat /etc/yum.repos.d/kylin_aarch64.repo
###Kylin Linux Advanced Server 10 - os repo###
[ks10-adv-os]
name = Kylin Linux Advanced Server 10 - Os
baseurl = file:///mnt
enabled=1
gpgcheck = 0
#mount -o loop /home/soft/Kylin-Server-10-SP1-Release-Build04-20200711-arm64.iso /mnt/
yum install -y perl-ExtUtils-Embed
yum install -y flex
yum install -y bison
yum install -y readline-devel
yum install -y zlib-devel
yum install -y openssl-devel
yum install -y pam-devel
yum install -y libxml2-devel
yum install -y libxslt-devel
yum install -y openldap-devel
yum install -y python-devel
yum install -y gcc-c++
yum install -y libssh2-devel
安装单机版本,创建相关目录:
mkdir -p /app/antdb/{data,tools,app,soft_src}
chown -R antdb:antdb /app/antdb
chmod -R 755 /app/antdb
创建好后续需要用到的目录:
data:AntDB的数据目录。
tools:存放相关工具
app:程序目录
soft_src: AntDB以及其他工具的源码目录
[antdb@db3 ~]$ cat .bash_profile
# Source /root/.bashrc if user has one
[ -f ~/.bashrc ] && . ~/.bashrc
export ADB_HOME=/app/antdb/app/antdb
export PATH=${ADB_HOME}/bin:$PATH
export LD_LIBRARY_PATH=${ADB_HOME}/lib:$LD_LIBRARY_PATH
export PGPORT=5432
export PGDATABASE=postgres
执行source ~/.bashrc使环境变量生效
#cd /data/antdb/soft_src
[antdb@db3 soft_src]$ sudo rpm -Uvh /home/soft/antdb-alone-5.0.90978501-ky10.aarch64.rpm --relocate=/opt/app/antdb=$ADB_HOME
Verifying...################################# [100%]
准备中...################################# [100%]
正在升级/安装...
1:antdb-5.0.90978501-10.ky10.ky10################################# [100%]
[antdb@db3 soft_src]$ sudo chown -R antdb:antdb $ADB_HOME
[sudo] antdb的密码:
[antdb@db3 soft_src]$ sudo chmod -R 755 $ADB_HOME
[antdb@db3 soft_src]$which postgres
/app/antdb/app/antdb/bin/postgres
[antdb@db3 soft_src]$ postgres -V
postgres (5.0.0 90978501a6 based on PostgreSQL) 11.6
[antdb@db3 soft_src]$ initdb -D /app/antdb/data/
The files belonging to this database system will be owned by user "antdb".
This user must also own the server process.
The database cluster will be initialized with locale "zh_CN.UTF-8".
The default database encoding has accordingly been set to "UTF8".
initdb: could not find suitable text search configuration for locale "zh_CN.UTF-8"
The default text search configuration will be set to "simple".
Data page checksums are disabled.
fixing permissions on existing directory /app/antdb/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default timezone ... Asia/Shanghai
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... 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:
pg_ctl -D /app/antdb/data/ -l logfile start
初始化完成后,在/data/antdb/data目录下会生成一系列文件和目录,大致目录结构如下
默认端口为5432 ,如果需要修改端口,则在postgresql.conf文件最后追加即可
[antdb@db3 soft_src]$ pg_ctl -D /app/antdb/data/ -l logfile start
waiting for server to start.... done
server started
登录数据库:
[antdb@db3 soft_src]$ psql -p 5432
psql (11.6)
Type "help" for help.
postgres=#
[antdb@db3 soft_src]$ pg_ctl stop -D /app/antdb/data/
waiting for server to shut down.... done
server stopped
作者:苏献君