安装包为海钛瑞OA办公自动化系统Linux平台免费版,目前可以在centos7或以上版本安装。
一、安装PostgreSQL13.4
系统版本为Centos7.9通过源码编译安装PostgreSQL13.4
yum install -y gcc-c++ gcc cmake ncurses-devel perl zlib*
1、postgresql下载
官网下载地址:https://www.postgresql.org/ftp/source/v13.4/
免费OA办公系统下载地址:http://www.hitai.com/oa/download/download38.html
2、创建用户和组
[root@localhost1 ~]# mkdir /hitai/postgresql/
[root@localhost1 mytmp]# useradd postgres
3、指定安装路径
[root@localhost1 mytmpl]# ll
-rw-r--r-- 1 root root 27687091 5月 17 09:14 postgresql-13.4.tar.gz
[root@localhost1 mytmp]# tar -zxvf postgresql-13.4.tar.gz
[root@localhost1 mytmp]# cd postgresql-13.4
[root@localhost] postgresql-13.4]# ./configure --prefix=/hitai/postgresql
//这里可能会报错configure: error: readline library not found
//执行即可解决问题:
[root@localhost1 postgresql-13.4]# yum install -y readline-devel
//成功再次编译安装路径./configure --prefix=/hitai/postgresql
[root@localhost1 postgresql-13.4]# make && make install
//创建数据库文件目录
[root@localhost1 postgresql-13.4]# mkdir /hitai/postgresql/data
[root@localhost1 postgresql-13.4]# chown postgres /hitai/postgresql/data/
[root@localhost1 postgresql-13.4]# chgrp postgres /hitai/postgresql/data/
//切换用户
[root@localhost1 postgresql-13.4]# su - postgres
上一次登录:三 5月 25 17:50:35 CST 2022pts/1 上
[postgres@localhost1 ~]$
4、初始化数据库
[postgres@localhost1 ~]$ /hitai/postgresql/bin/initdb -D /hitai/postgresql/data/
5、修改配置
[postgres@localhost1 ~]$ vim /hitai/postgresql/data/pg_hba.conf //添加host all all 0.0.0.0/0 md5
# replication privilege.
host all all 0.0.0.0/0 md5
[postgres@localhost1 ~]$ vim /hitai/postgresql/data/postgresql.conf //去掉listen_addresses和port注释,将localhost改为*
# - Connection Settings -
listen_addresses = '*' # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to 'localhost'; use '*' for all
# (change requires restart)
port = 5432 # (change requires restart)
max_connections = 100 # (change requires restart)
#superuser_reserved_connections = 3 # (change requires restart)
#unix_socket_directories = '/tmp' # comma-separated list of directories
# (change requires restart)
6、启动数据库服务
[postgres@localhost1 ~]$ /hitai/postgresql/bin/pg_ctl -D /hitai/postgresql/data -l /home/postgres/startup.log start
//修改密码
[postgres@localhost1 ~]$ /hitai/postgresql/bin/psql
psql (13.4)
Type "help" for help.
postgres=# \password postgres #设置密码
#创建数据库新用户
postgres=#CREATE USER goofficeuser WITH PASSWORD 'masterkey';
#创建用户数据库
postgres=#CREATE DATABASE goofficedb OWNER goofficeuser;
postgres=# \c - goofficeuser;
postgres=> create table test(a1 varchar(100),a2 int);
postgres=> insert into test(a1,a2) values('test1',1);
postgres=> select * from test;
a1 | a2
-------+----
test1 | 1
(1 row)
postgres=> drop table test;
postgres=> exit;
登录即可正常使用了
停止服务
[postgres@localhost1 ~]$ /hitai/postgresql/bin/pg_ctl stop -D /hitai/postgresql/data
7. 修改环境变量
vi ~/.bash_profile
--PATH添加 /hitai/postgresql/bin
--添加PGDATA= /hitai/postgresql/data
PATH=$PATH:$HOME/.local/bin:$HOME/bin:/hitai/postgresql/bin
PGDATA=/hitai/postgresql/data
export PGDATA
export PATH
--生效 source ~/.bash_profile
切换回root
[postgres@localhost1 ~]$ exit
8.设置为系统服务
#vi /usr/lib/systemd/system/postgresql-13.service
[Unit]
Description=PostgreSQL database server
After=network.target
[Service]
Type=forking
User=postgres
Group=postgres
# Port number for server to listen on
#Environment=PGPORT=5432
# Location of database directory
Environment=PGDATA=/hitai/postgresql/data
# Where to send early-startup messages from the server (before the logging
# options of postgresql.conf take effect)
# This is normally controlled by the global default set by systemd
# StandardOutput=syslog
# Disable OOM kill on the postmaster
OOMScoreAdjust=-1000
ExecStart=/hitai/postgresql/bin/pg_ctl start -D ${PGDATA} -l /home/postgres/startup.log
ExecStop=/hitai/postgresql/bin/pg_ctl stop -D ${PGDATA}
ExecReload=/hitai/postgresql/bin/pg_ctl reload -D ${PGDATA}
# Give a reasonable amount of time for the server to start up/shut down
TimeoutSec=300
[Install]
WantedBy=multi-user.target
9.服务运行
启动 PostgreSQL 服务systemctl start postgresql-13
停止 PostgreSQL 服务systemctl stop postgresql-13
重启 PostgreSQL 服务systemctl restart postgresql-13
开启 PostgreSQL 服务开机自启动systemctl enable postgresql-13
关闭 PostgreSQL 服务开机自启动syatemctl disable postgresql-13
查看 PostgreSQL 服务是否正常启动systemctl status postgresql-13
二、安装免费OA办公系统
1.下载本安装包
2.解压缩tar -xzvf gooffice64_4.22.tar.gz -C /mytmp
3.需要切换为root身份
4.在[root@localhost mytmp]# sh installgoofficepg.sh -path /hitai/gooffice
installing gooffice
GoOffice 4.22-0.amd64 Installation
Press Enter to start installation or ^C to abort
Extracting install data
Please enter current password for DBA user: masterkey
Install completed
注意DBA user请输入posgres的密码
5:通过http://localhost:8080登录系统