2023/08/22 桜井耕造
UbuntuにPleasanter 1.3.37をインストール
本日は、Pleasanterといノーコード、ローコードのOSSを紹介します。何かデータを纏める時にExcelを活用するかと思いますが、複数人でデータの更新したり、他のExcelのデータと連携したいとなったら、Webシステム化すると便利になってきます。そんな時にPleasanterを使うと簡単にWebシステムに出来るようになります。Plesanterとは、どんなツールかは以下のURLでご確認下さい。
ここでは、Pleasanterのインストールの方法を紹介します。
インストール環境は、以下となります。
Ubuntu 22.04 LTS
PostgreSQL 14.7
Nginx 1.18
Pleasanter 1.3.37
(1).Netパッケージの削除
# apt upgrade # apt remove 'dotnet*' 'aspnet*' 'netstandard*' # vi /etc/apt/preferences --- Package: dotnet* aspnet* netstandard* Pin: origin "packages.microsoft.com" Pin-Priority: -10 ---
(2).NETをスクリプトでインストール
# wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh # chmod +x ./dotnet-install.sh # ./dotnet-install.sh -i /usr/local/bin
(3)GDI+のインストール
# apt install -y libgdiplus
(4)PostgreSQLのインストール
# apt -y install vim bash-completion # wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add # echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" |sudo tee /etc/apt/sources.list.d/pgdg.list # apt install -y postgresql-14 postgresql-client-14 # cd /etc/postgresql/14/main/ PostgreSQLの認証方式の設定 # cp -ip pg_hba.conf pg_hba.conf.20230509 # vi pg_hba.conf METHODの設定を以下のように修正する。 ---- # IPv4 local connections: host all all 127.0.0.1/32 scram-sha-256→md5 # IPv6 local connections: host all all ::1/128 scram-sha-256→md5 # Allow replication connections from localhost, by a user with the # replication privilege. local replication all peer host replication all 127.0.0.1/32 scram-sha-256→md5 host replication all ::1/128 scram-sha-256→md5 ---- PostgreSQLのログ出力設定 # cp -ip postgresql.conf postgresql.conf.20230509 # vi postgresql.conf 以下のように修正する。 ----- log_destination = 'stderr' logging_collector = on log_line_prefix = '[%t]%u %d %p[%l]' ----- PostgreSQLのサービス再起動、サービス化 # systemctl restart postgresql # systemctl enable postgresql Synchronizing state of postgresql.service with SysV service script with /lib/systemd/systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install enable postgresql PostgreSQLユーザの設定 PostgreSQL管理用のユーザー"postgres"(OSのユーザー)にパスワードを設定します。 # passwd postgres New password: ←パスワード Retype new password: ←パスワード passwd: password updated successfully # su – postgres $ psql -U postgres psql (14.3 (Ubuntu 14.3-0ubuntu0.22.04.1)) Type "help" for help. postgres=# PostgreSQLの管理ユーザー "postgres" のパスワードを設定 postgres=# alter role postgres with password 'パスワード'; ALTER ROLE プリザンター用のデータベース "Implem.Pleasanter" を作成します。 postgres=# create database "Implem.Pleasanter"; CREATE DATABASE 以下のコマンドで作成したDBの確認を行います。 postgres=# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges -------------------+----------+----------+-------------+-------------+----------------------- Implem.Pleasanter | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres (4 rows) 全文検索用モジュール(pg_trgm)のインストール テキストの全⽂検索に必要なモジュール(pg_trgm)をインストールします。 postgres=# \c "Implem.Pleasanter" Implem.Pleasanter=# create extension pg_trgm;
(5)Pleasanter1.3.37をインストール
# wget https://github.com/Implem/Implem.Pleasanter/releases/download/Pleasanter_1.3.37.3/Pleasanter_1.3.37.3.zip # apt install -y unzip # unzip Pleasanter_1.3.37.3.zip # mkdir /web # mv pleasanter/ /web/. # cd /web/pleasanter/Implem.Pleasanter/App_Data/Parameters # cp -ip Rds.json Rds.json.20230509 # vi Rds.json 以下を修正する。 --- { "Dbms": "PostgreSQL", "Provider": "Local", "TimeZoneInfo": "Asia/Tokyo", ←追記 "SaConnectionString": "Server=localhost;Database=postgres;UID=postgres;PWD=パスワード", ←修正 "OwnerConnectionString": "Server=localhost;Database=#ServiceName#;UID=#ServiceName#_Owner;PWD=SetAdminsPWD", "UserConnectionString": "Server=localhost;Database=#ServiceName#;UID=#ServiceName#_User;PWD=SetUsersPWD", "SqlCommandTimeOut": 600, ←修正 "MinimumTime": 3, "DeadlockRetryCount": 4, "DeadlockRetryInterval": 1000, "DisableIndexChangeDetection": true } ---
(6)CodeDefinerの実行
# cd /web/pleasanter/Implem.CodeDefiner # dotnet Implem.CodeDefiner.dll _rds <INFO>が多数表示され、最後に以下が標準出力されることを確認する。 <SUCCESS> Starter.ConfigureDatabase: Database configuration has been completed. <SUCCESS> Starter.Main: All of the processes have been completed.
(7)Pleasnterの起動確認
# cd /web/pleasanter/Implem.Pleasanter # dotnet Implem.Pleasanter.dll 以下のコマンドで動作確認したら、「Ctrl+C」で終了します。 別のターミナルで以下のコマンドを実行し、プリザンターが起動していることを確認します。 # curl -v http://localhost:5000/ * Trying 127.0.0.1:5000... * Connected to localhost (127.0.0.1) port 5000 (#0) > GET / HTTP/1.1 > Host: localhost:5000 > User-Agent: curl/7.81.0 > Accept: */* > * Mark bundle as not supporting multiuse < HTTP/1.1 302 Found < Content-Length: 0 < Date: Tue, 07 Jun 2022 04:59:38 GMT < Server: Kestrel < Location: http://localhost:5000/users/login?ReturnUrl=%2F < X-Frame-Options: SAMEORIGIN < X-XSS-Protection: 1; mode=block < X-Content-Type-Options: nosniff < * Connection #0 to host localhost left intact
(8)Pleasanterサービス用スクリプトの作成
/etc/systemd/system/pleasanter.service を以下の内容で新規作成します。 # vi /etc/systemd/system/pleasanter.service --- [Unit] Description = Pleasanter Documentation = Wants=network.target After=network.target [Service] ExecStart = /usr/bin/dotnet Implem.Pleasanter.dll WorkingDirectory = /web/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 ---
(9)サービスとして登録・サービスの起動
# systemctl daemon-reload # systemctl enable pleasanter Created symlink /etc/systemd/system/multi-user.target.wants/pleasanter.service → /etc/systemd/system/pleasanter.service. # systemctl start pleasanter
(10)リバースプロキシ(NginX)のセットアップ
# apt install -y nginx # systemctl enable nginx # vi /etc/nginx/conf.d/pleasanter.conf --- server { listen 80; server_name 192.168.X.X; client_max_body_size 100M; 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; } } --- # systemctl restart nginx
(11)Pleasanterにログイン
以下のURLからログインします。
http://XX.XX.X.X/users/login
ID: Administrator
PW: pleasanter(初期パスワード)
参考URL; https://pleasanter.org/manual/getting-started-pleasanter-ubuntu