安装Präsentor(.NetCore3.1/PostgreSQL版)在Ubuntu 20.04上

我打算在Ubuntu上安装.NET Core 3.1版的Pretender,但由于官方页面上只有RHEL/CentOS的安装方法,所以我尝试了一下。

总结来说,一切都正常运行。

将Pleasanter与PostgreSQL安装在RHEL8/CentOS8上更加愉快。
https://pleasanter.net/fs/publishes/1490231/edit

安装.NET Core 3.1

$ wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
$ sudo dpkg -i packages-microsoft-prod.deb

$ sudo apt update
$ sudo apt install -y apt-transport-https
$ sudo apt update
$ sudo apt install -y dotnet-sdk-3.1

$ sudo apt install -y libgdiplus

安装PostgreSQL12

$ curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
$ sudo apt-add-repository 'deb http://apt.postgresql.org/pub/repos/apt focal-pgdg main'

$ sudo vi /etc/apt/sources.list

deb http://apt.postgresql.org/pub/repos/apt focal-pgdg main
↓
deb [arch=amd64] http://apt.postgresql.org/pub/repos/apt focal-pgdg main

$ sudo apt update
$ sudo apt install postgresql-12 pgadmin4 postgresql-contrib

# 成功しました。以下のようにしてデータベースサーバを起動することができます:
# 
#     pg_ctlcluster 12 main start
# 
# Ver Cluster Port Status Owner    Data directory              Log file
# 12  main    5432 down   postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log

日志输出设置

我們將進行以下設置。

$ sudo vi /etc/postgresql/12/main/postgresql.conf

log_destination = 'stderr'
logging_collector = on
log_line_prefix = '[%t]%u %d %p[%l]'

用户设置和数据库创建

设定密码后,启动PostgreSQL。

$ sudo passwd postgres

$ su - postgres
$ psql -U postgres

postgres=# alter role postgres with password 'パスワード';

# DB作成
postgres=# create database "Implem.Pleasanter";

安装用于全文搜索的模块(pg_trgm)。

postgres=# \c "Implem.Pleasanter";
Implem.Pleasanter=# CREATE EXTENSION pg_trgm;

引入發言者

请下载Pleasanter并解压缩。

$ unzip Pleasanter.NetCore_1.1.5.1.zip

数据库的结构

请按照以下方式设置 pleasanter/Implem.Pleasanter/App_Data/Parameters/Rds.json。

{
       "Dbms": "PostgreSQL",
       "Provider": "Local",
       "TimeZoneInfo": "Tokyo Standard Time",
       "SaConnectionString":"Server=localhost;Port=5432;Database=postgres;UID=postgres;PWD=<設定したパスワード>",
       "OwnerConnectionString":"Server=localhost;Port=5432;Database=#ServiceName#;UID=#ServiceName#_Owner;PWD=SetAdminsPWD",
       "UserConnectionString":"Server=localhost;Port=5432;Database=#ServiceName#;UID=#ServiceName#_User;PWD=SetUsersPWD",
       "SqlCommandTimeOut": 600,
       "MinimumTime": 3,
       "DeadlockRetryCount": 4,
       "DeadlockRetryInterval": 1000
}

移动到Implem.CodeDefiner文件夹并运行CodeDefiner。

$ cd pleasanter/Implem.CodeDefiner
$ dotnet Implem.CodeDefiner.NetCore.dll _rds

请使用以下命令运行Pleasnter,并进行启动确认。

$ cd ../Implem.Pleasanter
$ dotnet Implem.Pleasanter.NetCore.dll

在另一个终端上访问”http://localhost:5000/”,并确认是否返回正常响应。

$ curl -v http://localhost:5000/

* About to connect() to localhost port 5000 (#0)
*   Trying ::1...
* Connected to localhost (::1) port 5000 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: localhost:5000
> Accept: */*
>
< HTTP/1.1 302 Found
< Date: Mon, 25 May 2020 15:13:08 GMT
< Server: Kestrel
< Content-Length: 0
< Location: http://localhost:5000/users/login?ReturnUrl=%2F
確認できたらCtrl+Cで終了します。

创建更愉快的服务脚本

$ sudo vi /etc/systemd/system/pleasanter.service

[Unit]
Description = Pleasanter
Documentation =
Wants=network.target
After=network.target

[Service]
ExecStart = /usr/bin/dotnet Implem.Pleasanter.NetCore.dll
WorkingDirectory = /home/hogehoge/pleasanter/Implem.Pleasanter
Restart = always
RestartSec = 10
KillSignal=SIGINT
SyslogIdentifier=dotnet-pleasanter
User = root
Group = root
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false

[Install]
WantedBy = multi-user.target

注册和启动作为服务

$ sudo systemctl daemon-reload
$ sudo systemctl enable pleasanter
$ sudo systemctl start pleasanter

安装Nginx(Web服务器)。

$ sudo apt install nginx-extras
$ sudo systemctl start nginx
$ sudo systemctl enable nginx
$ sudo addgroup ユーザー名 www-data

反向代理服务器的配置

请使用以下内容创建 /etc/nginx/conf.d/pleasanter.conf 文件。

server {
    listen  80;
    server_name   192.168.0.200;
    location / {
       proxy_pass         http://localhost:5000;
       proxy_http_version 1.1;
       proxy_set_header   Upgrade $http_upgrade;
       proxy_set_header   Connection keep-alive;
       proxy_set_header   Host $host;
       proxy_cache_bypass $http_upgrade;
       proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header   X-Forwarded-Proto $scheme;
    }
}

$ sudo systemctl restart nginx

如果能做到这一点,请访问以下网址:
http://192.168.0.200/

请提供上述内容的中文原生语版本,仅需要一种选项。

在RHEL8/CentOS8上安装Pleasanter with PostgreSQL
请访问https://pleasanter.net/fs/publishes/1490231/edit

在Ubuntu 20.04上安装.NET Core SDK 3.1。
链接:https://qiita.com/tabizou/items/d9af326ede9d35d03c68

在安装了Ubuntu 20.04和Posgtgres12之后,尝试使用C#+Npgsql进行访问。

在Ubuntu 20.04上安装PostgreSQL [快速入门]
https://www.digitalocean.com/community/tutorials/how-to-install-postgresql-on-ubuntu-20-04-quickstart

在Ubuntu上安装PostgreSQL 12,并创建数据库和表定义。

广告
将在 10 秒后关闭
bannerAds