Redmine 是一个网页界面的项目管理与缺陷跟踪管理系统的自由及开放源代码软件工具,可以同时处理多个项目。它集成了项目管理所需的各项功能,包括日历、燃尽图和甘特图以协助可视化表现项目与时间限制,问题跟踪和版本控制。本篇介绍如何安装 Redmine,以 Bitnami Redmine + Debian 10 为例,所有命令以普通用户 jinzhongxu 运行,但需要 sudo 权限。
下载安装 Redmine
这里提供两个版本,均是 bitnami 官网版本:
- bitnami-redmine-3.4.6-5-linux-x64-installer.run
- bitnami-redmine-4.2.1-3-linux-x64-installer.run
本篇以 4.2.1-3 为例,并使用 nginx 作为反向代理。需要注意的是,需要开放个别端口:
- 3690:svnserve
- 3306:mysqld
- 8443:httpd
- 8080:redmine
- 80,443:nginx
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
wget https://downloads.bitnami.com/files/stacks/redmine/4.2.1-3/bitnami-redmine-4.2.1-3-linux-x64-installer.run chmod 755 bitnami-redmine-4.2.1-3-linux-x64-installer.run
sudo apt update sudo apt install -y libncurses5 perl htop nginx
sudo mkdir -p /usr/local/redmine sudo chown -R jinzhongxu /usr/local/redmine
./bitnami-redmine-4.2.1-3-linux-x64-installer.run
|
假设服务器 IP 地址是:1.1.0.x,安装后,打开 http://1.1.0.x:8080 即可访问 redmine
配置 Nginx
假设已经购买了域名: www.redmine-test.com,并指向 IP 地址: 1.1.0.x
申请证书
下面代码以 root 身份运行
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| curl https://get.acme.sh | sh -s email=xxx@yyy.com
systemctl stop nginx
~/.acme.sh/acme.sh --issue --standalone -d www.redmine-test.com -k ec-256 --ecc
mkdir -p /etc/nginx/cert
~/.acme.sh/acme.sh --installcert -d www.redmine-test.com --ecc \ --key-file /etc/nginx/cert/private.key \ --fullchain-file /etc/nginx/cert/fullchain.cer
|
配置 nginx
1
| sudo vim /etc/nginx/nginx.conf
|
添加如下内容
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| user root; worker_processes 1; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; keepalive_timeout 120; client_max_body_size 20m; server { listen 80; listen [::]:80; server_name www.redmine-test.com; return 301 https://$server_name$request_uri; } server { listen 443 ssl; server_name www.redmine-test.com; ssl_certificate /etc/nginx/cert/fullchain.cer; ssl_certificate_key /etc/nginx/cert/private.key; ssl_session_timeout 5m; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; ssl_prefer_server_ciphers on; location /redmine { proxy_pass http://127.0.0.1:8080/redmine; proxy_set_header Host $host; proxy_set_header X-Real-Scheme $scheme; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_http_version 1.1; proxy_read_timeout 120s; proxy_next_upstream error; } } }
|
重启 nginx
1
| sudo systemctl restart nginx.service
|
现在可以使用 https 协议访问 redmine,地址:https://www.redmine-test.com/redmine/
redmine 开关
查看运行状态
1 2 3 4 5
| cd /usr/local/redmine $ ./ctlscript.sh status subversion already running apache already running mysql already running
|
关闭
开启
更多配置将去如下地址查看,包括数据库登录名和密码(database.yml):/usr/local/redmine/apps/redmine/htdocs/config
把 MySQL 地址添加到环境变量,可直接在命令行运行 MySQL
1 2 3
| cd echo 'PATH=/usr/local/redmine/mysql/bin:$PATH' >> .bashrc source .bashrc
|
参考文献
- Redmine安装神器:Bitnami redmine 的安装指导(Linux的安装方法)