如何在 Ubuntu 22.04 上安装焦点板如何在 Ubuntu 22.04 上安装焦点板如何在 Ubuntu 22.04 上安装焦点板如何在 Ubuntu 22.04 上安装焦点板
  • 文章
  • 正则表达式
    • 工具
  • 登录
找到的结果: {phrase} (显示: {results_count} 共: {results_count_total})
显示: {results_count} 共: {results_count_total}

加载更多搜索结果...

搜索范围
模糊匹配
搜索标题
搜索内容
发表 admin at 2025年2月28日
类别
  • 未分类
标签

如何在 Ubuntu 22.04 上安装焦点板

本教程适用于这些操作系统版本

  • Ubuntu 22.04(Jammy Jellyfish)
  • Ubuntu 20.04(Focal Fossa)

在此页

  1. 先决条件
  2. 安装和配置 PostgreSQL
  3. 安装和配置焦点板
  4. 为焦点板创建系统服务文件
  5. 将 Nginx 配置为反向代理
  6. 访问焦点板网络界面
  7. 在焦点板上启用 SSL
  8. 结论

Focalboard 是一种开源和自托管的项目管理工具。它是多语言的,是 Asana、Trello 和 Notion 的替代品,开发人员可以使用它来跟踪和管理跨团队的工作。它基于看板,可用于台式机和服务器。它可以用作测试和开发的独立个人服务器。 Focalboard 帮助开发人员保持一致以完成任务、达到里程碑并实现他们的目标。

在这篇文章中,我们将向您展示如何在 Ubuntu 22.04 上使用 Nginx 作为反向代理安装 Focalboard。

先决条件

  • 一台运行 Ubuntu 22.04 的服务器。
  • 用您的服务器 IP 指向的有效域名。
  • 在服务器上配置了根密码。

安装和配置 PostgreSQL

Focalboard 使用 PostgreSQL 来存储其数据。因此必须在您的系统上安装 PostgreSQL 数据库服务器。

如果未安装,您可以使用以下命令将其与其他软件包一起安装:

apt-get install curl wget gnupg2 -y
apt-get install postgresql postgresql-contrib -y

安装 PostgreSQL 后,使用以下命令连接到 PostgreSQL:

su - postgres
psql

接下来,使用以下命令为 PostgreSQL 创建数据库和用户:

CREATE DATABASE focaldb;
CREATE USER focaluser WITH PASSWORD 'password';

接下来,使用以下命令退出 PostgreSQL shell:

\q
exit

完成后,您可以继续下一步。

安装和配置焦点板

首先,访问 Focalboard Git Hub 下载页面并使用以下命令下载最新版本的 Focalboard:

VER=$(curl -s https://api.github.com/repos/mattermost/focalboard/releases/latest|grep tag_name | cut -d '"' -f 4)
wget https://github.com/mattermost/focalboard/releases/download/${VER}/focalboard-server-linux-amd64.tar.gz

下载完成后,使用以下命令解压缩下载的文件:

tar -xvzf focalboard-server-linux-amd64.tar.gz

接下来,使用以下命令将焦点板移动到 /opt 目录:

mv focalboard /opt

接下来,编辑 Focalboard 配置文件:

nano /opt/focalboard/config.json

更改与您的数据库匹配的以下行,如下所示:

"dbtype": "postgres",
"dbconfig": "postgres://focaluser:/focaldb?sslmode=disable&connect_timeout=10",

完成后保存并关闭文件。

为焦点板创建系统服务文件

使用 systemd 启动和管理 Focalboard 是个好主意。为此,您需要为 Focalboard 创建一个 systemd 服务文件:

nano /lib/systemd/system/focalboard.service

添加以下行:

[Unit]
Description=Focalboard server

[Service]
Type=simple
Restart=always
RestartSec=5s
ExecStart=/opt/focalboard/bin/focalboard-server
WorkingDirectory=/opt/focalboard

[Install]
WantedBy=multi-user.target

保存并关闭文件,然后重新加载 systemd 守护进程以应用更改:

systemctl daemon-reload

接下来,使用以下命令启动并启用 Focalboard 服务:

systemctl start focalboard
systemctl enable focalboard

您现在可以使用以下命令检查焦点板的状态:

systemctl status focalboard

您将获得以下输出:

? focalboard.service - Focalboard server
     Loaded: loaded (/lib/systemd/system/focalboard.service; disabled; vendor preset: enabled)
     Active: active (running) since Sun 2022-08-21 11:22:22 UTC; 8s ago
   Main PID: 4347 (focalboard-serv)
      Tasks: 4 (limit: 2242)
     Memory: 18.1M
        CPU: 1.977s
     CGroup: /system.slice/focalboard.service
             ??4347 /opt/focalboard/bin/focalboard-server

Aug 21 11:22:23 ubuntu2204 focalboard-server[4347]: debug [2022-08-21 11:22:23.507 Z] listener(s) for blockID                  caller="ws/ser>
Aug 21 11:22:23 ubuntu2204 focalboard-server[4347]: debug [2022-08-21 11:22:23.507 Z] listener(s) for blockID                  caller="ws/ser>
Aug 21 11:22:23 ubuntu2204 focalboard-server[4347]: debug [2022-08-21 11:22:23.510 Z] listener(s) for workspaceID              caller="ws/ser>
Aug 21 11:22:23 ubuntu2204 focalboard-server[4347]: debug [2022-08-21 11:22:23.510 Z] listener(s) for blockID                  caller="ws/ser>
Aug 21 11:22:23 ubuntu2204 focalboard-server[4347]: debug [2022-08-21 11:22:23.510 Z] listener(s) for blockID                  caller="ws/ser>
Aug 21 11:22:24 ubuntu2204 focalboard-server[4347]: debug [2022-08-21 11:22:24.928 Z] import archive - done                    caller="app/im>
Aug 21 11:22:24 ubuntu2204 focalboard-server[4347]: info  [2022-08-21 11:22:24.937 Z] initialized workspace                    caller="app/wo>
Aug 21 11:22:24 ubuntu2204 focalboard-server[4347]: info  [2022-08-21 11:22:24.941 Z] Server.Start                             caller="server>
Aug 21 11:22:24 ubuntu2204 focalboard-server[4347]: info  [2022-08-21 11:22:24.941 Z] http server started                      caller="web/we>
Aug 21 11:22:24 ubuntu2204 focalboard-server[4347]: info  [2022-08-21 11:22:24.947 Z] Starting unix socket server              caller="server>

此时Focalboard已经启动并监听8000端口,可以使用以下命令查看其监听端口:

ss -antpl | grep focalboard

您将获得以下输出:

LISTEN 0      4096               *:8000            *:*    users:(("focalboard-serv",pid=4347,fd=9))
LISTEN 0      4096               *:9092            *:*    users:(("focalboard-serv",pid=4347,fd=8))

完成后,您可以继续下一步。

配置 Nginx 作为反向代理

接下来,最好安装并配置 Nginx 作为反向代理以通过端口 80 访问 Focalboard。首先,使用以下命令安装 Nginx 服务器:

apt-get install nginx -y

安装 Nginx 服务器后,创建 Nginx 虚拟主机配置文件:

nano /etc/nginx/conf.d/focalboard.conf

添加以下行:

upstream focalboard {
   server localhost:8000;
   keepalive 32;
}

server {
   listen 80;

   server_name focalboard.example.com;

   location ~ /ws/* {
       proxy_set_header Upgrade $http_upgrade;
       proxy_set_header Connection "upgrade";
       client_max_body_size 50M;
       proxy_set_header Host $http_host;
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header X-Forwarded-Proto $scheme;
       proxy_set_header X-Frame-Options SAMEORIGIN;
       proxy_buffers 256 16k;
       proxy_buffer_size 16k;
       client_body_timeout 60;
       send_timeout 300;
       lingering_timeout 5;
       proxy_connect_timeout 1d;
       proxy_send_timeout 1d;
       proxy_read_timeout 1d;
       proxy_pass http://focalboard;
   }

   location / {
       client_max_body_size 50M;
       proxy_set_header Connection "";
       proxy_set_header Host $http_host;
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header X-Forwarded-Proto $scheme;
       proxy_set_header X-Frame-Options SAMEORIGIN;
       proxy_buffers 256 16k;
       proxy_buffer_size 16k;
       proxy_read_timeout 600s;
       proxy_cache_revalidate on;
       proxy_cache_min_uses 2;
       proxy_cache_use_stale timeout;
       proxy_cache_lock on;
       proxy_http_version 1.1;
       proxy_pass http://focalboard;
   }
}

完成后保存并关闭文件,然后使用以下命令验证 Nginx 是否存在任何语法配置错误:

nginx -t

您将获得以下输出:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

接下来,重新启动 Nginx 服务以应用配置更改:

systemctl restart nginx

您还可以使用以下命令检查 Nginx 状态:

systemctl status nginx

您应该看到以下输出:

? nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2022-08-21 11:24:08 UTC; 7s ago
       Docs: man:nginx(8)
    Process: 5017 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
    Process: 5018 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
   Main PID: 5019 (nginx)
      Tasks: 2 (limit: 2242)
     Memory: 2.6M
        CPU: 35ms
     CGroup: /system.slice/nginx.service
             ??5019 "nginx: master process /usr/sbin/nginx -g daemon on; master_process on;"
             ??5020 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""

Aug 21 11:24:08 ubuntu2204 systemd[1]: Starting A high performance web server and a reverse proxy server...
Aug 21 11:24:08 ubuntu2204 systemd[1]: Started A high performance web server and a reverse proxy server.

访问焦点板 Web 界面

现在,打开您的 Web 浏览器并输入 URL http://focalboard.example.com/login 以访问 Focalboard。您将被重定向到 Focalboard 登录页面:

单击创建帐户按钮。您应该会看到 Focalboard 帐户创建页面:

提供您的电子邮件地址、管理员用户名、密码,然后单击“注册”按钮。您应该在以下页面上看到 Focalboard 仪表板:

在焦点板上启用 SSL

出于安全原因,最好使用 Lets Encrypt SSL 保护 Focalboard。接下来,您需要安装 Certbot 客户端包来安装和管理 Lets Encrypt SSL。

首先,使用以下命令安装 Certbot:

apt-get install python3-certbot-nginx -y

安装完成后,运行以下命令在您的网站上安装 Lets Encrypt SSL:

certbot --nginx -d focalboard.example.com

系统会要求您提供有效的电子邮件地址并接受服务条款,如下所示:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for focalboard.example.com
Waiting for verification...
Cleaning up challenges
Deploying Certificate to VirtualHost /etc/nginx/conf.d/focalboard.conf

接下来,选择是否将 HTTP 流量重定向到 HTTPS,如下所示:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2

键入 2 并按 Enter 键以完成安装。您应该看到以下输出:

Redirecting all traffic on port 80 to ssl in /etc/nginx/conf.d/focalboard.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://focalboard.example.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=focalboard.example.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/focalboard.example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/focalboard.example.com/privkey.pem
   Your cert will expire on 2022-11-21. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the "certonly" option. To non-interactively renew *all* of
   your certificates, run "certbot renew"
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

 - We were unable to subscribe you the EFF mailing list because your
   e-mail address appears to be invalid. You can try again later by
   visiting https://act.eff.org.

结论

恭喜!您已经在 Ubuntu 22.04 上成功安装了带有 Nginx 作为反向代理的 Focalboard。您现在可以在您的组织中部署 Focalboard,并开始从 Web 浏览器轻松管理和跟踪您的项目。如果您有任何问题,请随时问我。

©2015-2025 艾丽卡 support@alaica.com