如何在CentOS 8上安装Kanboard项目管理软件
如何在CentOS 8上安装Kanboard项目管理软件
Kanboard是一个开源项目管理软件,可帮助您管理项目并可视化工作流程。它使用看板方法,是专为专注于简约和简单的小型团队而设计的。看板提供了一个简单易用的Web界面,使您可以通过Web浏览器管理项目。您还可以使用插件将看板集成到外部服务中。
本教程显示了如何使用Nginx和Let’s Encrypt SSL在CentOS 8上安装看板。
先决条件
- 运行CentOS的服务器8。
- 指向服务器IP的有效域名。
- 根密码是在服务器上设置的。
安装LEMP服务器
首先,您需要在服务器上安装Nginx,MariaDB,PHP和其他PHP扩展。您可以使用以下命令将它们全部安装:
dnf install nginx mariadb-server php php-fpm php-mbstring php-cli php-json php-opcache php-zip php-xml php-gd php-ldap php-mysqli php-sqlite3 php-json php-dom -y
安装完所有软件包后,请启动Nginx,PHP-FPM和MariaDB服务,以便您可以使用以下命令在系统重新引导时启动它们:
systemctl start mariadbsystemctl enable mariadbsystemctl start nginxsystemctl start php-fpmsystemctl enable nginxsystemctl enable php-fpm
然后编辑PHP-FPM配置文件,并将用户和组从apache更改为nginx。
nano /etc/php-fpm.d/www.conf
更改以下行。
user = nginx group = nginx
保存并关闭文件,然后重新启动PHP-FPM服务以应用更改。
systemctl restart php-fpm
完成后,您可以继续下一步。
创建看板数据库
看板使用SQLite和MariaDB作为数据库后端。因此,您需要创建一个看板数据库和用户。
首先,使用以下命令连接到MariaDB:
mysql
连接后,使用以下命令创建数据库和用户。
MariaDB [(none)]> CREATE DATABASE kanboard CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;MariaDB [(none)]> GRANT ALL PRIVILEGES ON kanboard.* TO 'kanboard'@'localhost' IDENTIFIED BY 'password';
然后刷新特权并使用以下命令退出MariaDB:
MariaDB [(none)]> FLUSH PRIVILEGES;MariaDB [(none)]> EXIT;
创建数据库和用户后,您可以继续执行下一步。
下载看板
首先,您需要从GitHub存储库下载最新版本的看板。您可以使用以下命令下载它。
wget https://github.com/kanboard/kanboard/archive/v1.2.18.tar.gz
下载完成后,使用以下命令提取下载的文件。
tar -xvzf v1.2.18.tar.gz
然后使用以下命令将提取的目录移动到Nginx Web根目录。
mv kanboard-1.2.18 /var/www/html/kanboard
然后将目录更改为Nginx Web根目录,并复制示例配置文件。
cd /var/www/html/kanboardcp config.default.php config.php
然后编辑配置文件以定义数据库设置。
nano config.php
根据数据库修改以下几行:
define('DB_DRIVER', 'mysql'); // Mysql/Postgres username define('DB_USERNAME', 'kanboard'); // Mysql/Postgres password define('DB_PASSWORD', 'password'); // Mysql/Postgres hostname define('DB_HOSTNAME', 'localhost'); // Mysql/Postgres database name define('DB_NAME', 'kanboard');
完成后,保存文件并关闭它。然后使用以下命令设置所有权和权限:广告
chown -R nginx:nginx /var/www/html/kanboardchmod -R 775 /var/www/html/kanboard
完成后,您可以继续下一步。
为看板配置Nginx
接下来,您需要创建一个Nginx虚拟主机配置文件来托管看板。您可以使用以下命令创建它。
nano /etc/nginx/conf.d/kanboard.conf
添加以下行。
server { listen 80; server_name kanboard.example.com; index index.php; root /var/www/html/kanboard; client_max_body_size 32M; location / { try_files $uri $uri/ /index.php$is_args$args; } location ~ .php$ { try_files $uri =404; fastcgi_split_path_info ^(.+.php)(/.+)$; fastcgi_pass unix:/run/php-fpm/www.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_index index.php; include fastcgi_params; } location ~* ^.+.(log|sqlite)$ { return 404; } location ~ /.ht { return 404; } location ~* ^.+.(ico|jpg|gif|png|css|js|svg|eot|ttf|woff|woff2|otf)$ { log_not_found off; expires 7d; etag on; } gzip on; gzip_comp_level 3; gzip_disable "msie6"; gzip_vary on; gzip_types text/javascript application/javascript application/json text/xml application/xml application/rss+xml text/css text/plain; }
完成后,保存文件并关闭它。然后使用以下命令检查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已配置为提供看板。现在,您可以继续访问看板仪表板。
配置SELinux和防火墙
默认情况下,CentOS 8上启用了SELinux,因此您需要为看板配置SELinux上下文。可以使用以下命令进行配置:
setsebool httpd_can_network_connect on -Pchcon -R -u system_u -t httpd_sys_rw_content_t -r object_r /var/www/html/kanban
然后,使用以下命令允许端口80和443通过Firewalld。
firewall-cmd --permanent --add-service=httpfirewall-cmd --permanent --add-service=httpsfirewall-cmd --reload
完成后,您可以继续下一步。
访问看板仪表板
然后打开Web浏览器并使用URL访问看板仪表板。 http://kanban.example.com..你将会
您将被重定向到看板管理员登录页面:
输入默认的用户名和密码admin / admin,然后单击。 登录 按钮。看板仪表板显示在下一页上。广告
使用SSL加密保护看板
接下来,您需要在系统上安装Certbot实用程序,才能为Let’s Chat域下载并安装Let’s Encrypt SSL。
您可以使用以下命令安装Certbot客户端:
wget https://dl.eff.org/certbot-automv certbot-auto /usr/local/bin/certbot-autochown root /usr/local/bin/certbot-autochmod 0755 /usr/local/bin/certbot-auto
然后使用以下命令获取并安装let域的SSL证书。
certbot-auto --nginx -d kanban.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): [email protected] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 kanban.example.com Waiting for verification... Cleaning up challenges Deploying Certificate to VirtualHost /etc/nginx/conf.d/kanban.conf
然后选择是否将HTTP流量重定向到HTTPS,如下所示。
Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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/kanban.conf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Congratulations! You have successfully enabled https://kanban.example.com You should test your configuration at: https://www.ssllabs.com/ssltest/analyze.html?d=kanban.example.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/kanban.example.com/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/kanban.example.com/privkey.pem Your cert will expire on 2021-04-2. To obtain a new or tweaked version of this certificate in the future, simply run certbot-auto again with the "certonly" option. To non-interactively renew *all* of your certificates, run "certbot-auto renew" - 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
您现在可以使用URL安全访问看板 https://kanban.example.com..
结论
恭喜!使用Nginx和Let’s Encrypt SSL,看板现已成功安装在CentOS 8上。现在,您可以在开发环境中实施看板并开始协作。如有任何疑问,请随时与我们联系。