Redmine 是一个免费的开源项目管理 Web 应用程序,可让您跟踪问题、错误和任务,以及管理团队的时间和资源。凭借其可定制的仪表板和易于使用的界面,Redmine 是任何希望优化其工作流程的团队的完美解决方案。
在 Ubuntu 22.04 LTS Jammy Jellyfish 上安装 Redmine
第 1 步。首先,通过在终端中运行以下命令,确保所有系统软件包都是最新的。apt
<span class="pln">sudo apt update sudo apt upgrade sudo apt install libxml2</span><span class="pun">-</span><span class="pln">dev libxslt1</span><span class="pun">-</span><span class="pln">dev zlib1g</span><span class="pun">-</span><span class="pln">dev imagemagick libmagickwand</span><span class="pun">-</span><span class="pln">dev libmysqlclient</span><span class="pun">-</span><span class="pln">dev apache2</span><span class="pun">-</span><span class="pln">dev build</span><span class="pun">-</span><span class="pln">essential libcurl4</span><span class="pun">-</span><span class="pln">openssl</span><span class="pun">-</span><span class="pln">dev</span>
第 2 步。安装 Apache HTTP 服务器。
默认情况下,Apache 在 Ubuntu 22.04 基础存储库上可用。现在运行以下命令,将最新版本的 Apache 安装到您的 Ubuntu 系统中:
<span class="pln">sudo apt install apache2</span>
成功安装后,启用 Apache(在系统启动时自动启动)、启动并使用以下命令验证状态:
<span class="pln">sudo systemctl enable apache2 sudo systemctl start apache2 sudo systemctl status apache2</span>
您可以使用以下命令确认 Apache2 版本:
<span class="pln">apache2 </span><span class="pun">-</span><span class="pln">v</span>
现在我们使用Apache设置了一个简单防火墙(UFW),以允许在HTTP和HTTPS的默认Web端口上进行公共访问:
<span class="pln">sudo ufw allow </span><span class="str">'Apache Full'</span><span class="pln"> sudo ufw allow </span><span class="lit">3000</span><span class="pln"> sudo ufw enable</span>
有关安装 Apache 的其他资源,请阅读下面的帖子:
- 如何在 Ubuntu Linux √ 上安装 Apache。
第 3 步。安装 MySQL 数据库。
默认情况下,MySQL 在 Ubuntu 22.04 基础存储库上可用。现在运行以下命令,将最新版本的 MySQL 8 安装到您的 Ubuntu 系统中:
<span class="pln">sudo apt install mysql</span><span class="pun">-</span><span class="pln">server</span>
成功安装后,启用MySQL(在系统启动时自动启动),启动并使用以下命令验证状态:
<span class="pln">sudo systemctl enable mysql sudo systemctl start mysql sudo systemctl status mysql</span>
您可以通过执行以下命令来验证安装的 MySQL 版本:
<span class="pln">mysql </span><span class="pun">-</span><span class="pln">V</span>
默认情况下,MySQL 不会强化。您可以使用脚本保护 MySQL。您应该仔细阅读并在每个步骤下方仔细阅读,这将设置root密码,删除匿名用户,禁止远程root登录,并删除测试数据库和对安全MySQL的访问权限:mysql_secure_installation
<span class="pln">mysql_secure_installation</span>
像这样配置它:
<span class="pun">-</span> <span class="typ">Set</span><span class="pln"> root password</span><span class="pun">?</span> <span class="pun">[</span><span class="pln">Y</span><span class="pun">/</span><span class="pln">n</span><span class="pun">]</span><span class="pln"> y </span><span class="pun">-</span> <span class="typ">Remove</span><span class="pln"> anonymous users</span><span class="pun">?</span> <span class="pun">[</span><span class="pln">Y</span><span class="pun">/</span><span class="pln">n</span><span class="pun">]</span><span class="pln"> y </span><span class="pun">-</span> <span class="typ">Disallow</span><span class="pln"> root login remotely</span><span class="pun">?</span> <span class="pun">[</span><span class="pln">Y</span><span class="pun">/</span><span class="pln">n</span><span class="pun">]</span><span class="pln"> y </span><span class="pun">-</span> <span class="typ">Remove</span><span class="pln"> test database </span><span class="kwd">and</span><span class="pln"> access to it</span><span class="pun">?</span> <span class="pun">[</span><span class="pln">Y</span><span class="pun">/</span><span class="pln">n</span><span class="pun">]</span><span class="pln"> y </span><span class="pun">-</span> <span class="typ">Reload</span><span class="pln"> privilege tables now</span><span class="pun">?</span> <span class="pun">[</span><span class="pln">Y</span><span class="pun">/</span><span class="pln">n</span><span class="pun">]</span><span class="pln"> y</span>
使用 MySQL 根用户和您在安装过程中设置的密码登录到 MySQL 数据库服务器:
<span class="pln">mysql </span><span class="pun">-</span><span class="pln">u root </span><span class="pun">-</span><span class="pln">p</span>
登录后,现在创建一个用于 Redmine 安装的数据库:
<span class="pln">mysql</span><span class="pun">></span><span class="pln"> CREATE USER </span><span class="str">'redmine'</span><span class="pun">@</span><span class="str">'localhost'</span><span class="pln"> IDENTIFIED BY </span><span class="str">'Your-Strong-Passwd'</span><span class="pun">;</span><span class="pln"> mysql</span><span class="pun">></span><span class="pln"> CREATE DATABASE redmine CHARACTER SET utf8mb4</span><span class="pun">;</span><span class="pln"> mysql</span><span class="pun">></span><span class="pln"> GRANT ALL PRIVILEGES ON redmine</span><span class="pun">.*</span><span class="pln"> TO </span><span class="str">'redmine'</span><span class="pun">@</span><span class="str">'localhost'</span><span class="pun">;</span><span class="pln"> mysql</span><span class="pun">></span> <span class="kwd">exit</span>
有关安装 MySQL 的其他资源,请阅读下面的帖子:
- 如何在 Ubuntu Linux √ 上安装 MySQL
第 4 步。安装 Ruby。
Redmine 是用 Ruby on Rails 编写的,所以我们需要在我们的系统上安装 Ruby。首先,我们使用以下命令安装 RVM 的 GPG 密钥:
<span class="pln">gpg2 </span><span class="pun">--</span><span class="pln">keyserver keyserver</span><span class="pun">.</span><span class="pln">ubuntu</span><span class="pun">.</span><span class="pln">com </span><span class="pun">--</span><span class="pln">recv</span><span class="pun">-</span><span class="pln">keys </span><span class="lit">409B6B1796C275462A1703113804BB82D39DC0E3</span> <span class="lit">7D2BAF1CF37B13E2069D6956105BD0E739499BDB</span>
接下来,使用以下命令安装 RVM:
<span class="pln">curl </span><span class="pun">-</span><span class="pln">sSL https</span><span class="pun">:</span><span class="com">//get.rvm.io | bash -s stable</span><span class="pln"> source </span><span class="pun">~</span><span class="str">/.rvm/</span><span class="pln">scripts</span><span class="pun">/</span><span class="pln">rvm</span>
最后,使用以下命令安装 Ruby:
<span class="pln">rvm install ruby</span><span class="pun">-</span><span class="lit">3.1</span><span class="pun">.</span><span class="lit">3</span>
第5步。在 Ubuntu 22.04 上安装 Redmine。
现在你已经安装了所需的依赖项和Ruby on Rails,你可以继续安装Redmine。首先,从官网下载最新版本的Redmine:
<span class="pln">wget https</span><span class="pun">:</span><span class="com">//www.redmine.org/releases/redmine-5.0.5.tar.gz --no-check-certificate</span>
接下来,解压缩文件并将其移动到目录:/var/www/redmine
<span class="pln">tar xfz redmine</span><span class="pun">-</span><span class="lit">5.0</span><span class="pun">.</span><span class="lit">5.tar</span><span class="pun">.</span><span class="pln">gz mv redmine</span><span class="pun">-</span><span class="lit">5.0</span><span class="pun">.</span><span class="lit">5</span> <span class="pun">/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">www</span><span class="pun">/</span><span class="pln">redmine cd </span><span class="pun">/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">www</span><span class="pun">/</span><span class="pln">redmine</span>
之后,使用提供的示例文件创建 Redmine 配置文件:
<span class="pln">cp config</span><span class="pun">/</span><span class="pln">configuration</span><span class="pun">.</span><span class="pln">yml</span><span class="pun">.</span><span class="pln">example config</span><span class="pun">/</span><span class="pln">configuration</span><span class="pun">.</span><span class="pln">yml cp config</span><span class="pun">/</span><span class="pln">database</span><span class="pun">.</span><span class="pln">yml</span><span class="pun">.</span><span class="pln">example config</span><span class="pun">/</span><span class="pln">database</span><span class="pun">.</span><span class="pln">yml cp </span><span class="kwd">public</span><span class="pun">/</span><span class="pln">dispatch</span><span class="pun">.</span><span class="pln">fcgi</span><span class="pun">.</span><span class="pln">example </span><span class="kwd">public</span><span class="pun">/</span><span class="pln">dispatch</span><span class="pun">.</span><span class="pln">fcgi</span>
然后,打开文件进行编辑:database.yml
<span class="pln">nano config</span><span class="pun">/</span><span class="pln">database</span><span class="pun">.</span><span class="pln">yml</span>
在以下部分下查找并配置数据库设置:
<span class="pln">production</span><span class="pun">:</span><span class="pln"> adapter</span><span class="pun">:</span><span class="pln"> mysql2 database</span><span class="pun">:</span><span class="pln"> redmine host</span><span class="pun">:</span><span class="pln"> localhost username</span><span class="pun">:</span><span class="pln"> redmine password</span><span class="pun">:</span> <span class="str">"Your-Strong-Passwd"</span> <span class="com"># Use "utf8" instead of "utfmb4" for MySQL prior to 5.7.7</span><span class="pln"> encoding</span><span class="pun">:</span><span class="pln"> utf8mb4</span>
保存并关闭文件,然后安装捆绑器以管理 Ruby gem 依赖项:
<span class="pln">gem install bundler bundle config </span><span class="kwd">set</span> <span class="pun">--</span><span class="kwd">local</span><span class="pln"> without </span><span class="str">'development test'</span><span class="pln"> bundle install gem pristine </span><span class="pun">--</span><span class="pln">all bundle </span><span class="kwd">add</span><span class="pln"> webrick</span>
生成随机密钥以防止篡改用于存储会话数据的 cookie:
<span class="pln">bundle </span><span class="kwd">exec</span><span class="pln"> rake generate_secret_token</span>
接下来,创建数据库结构:
<span class="pln">RAILS_ENV</span><span class="pun">=</span><span class="pln">production bundle </span><span class="kwd">exec</span><span class="pln"> rake db</span><span class="pun">:</span><span class="pln">migrate</span>
将数据插入 MySQL 数据库:
<span class="pln">RAILS_ENV</span><span class="pun">=</span><span class="pln">production REDMINE_LANG</span><span class="pun">=</span><span class="pln">en bundle </span><span class="kwd">exec</span><span class="pln"> rake redmine</span><span class="pun">:</span><span class="pln">load_default_data</span>
创建必要的目录并设置文件权限:
<span class="pln">mkdir </span><span class="pun">-</span><span class="pln">p tmp</span><span class="pun">/</span><span class="pln">pdf mkdir </span><span class="pun">-</span><span class="pln">p </span><span class="kwd">public</span><span class="pun">/</span><span class="pln">plugin_assets chown </span><span class="pun">-</span><span class="pln">R $USER</span><span class="pun">:</span><span class="pln">$USER files log tmp </span><span class="kwd">public</span><span class="pun">/</span><span class="pln">plugin_assets chmod </span><span class="pun">-</span><span class="pln">R </span><span class="lit">755</span> <span class="pun">/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">www</span><span class="pun">/</span><span class="pln">redmine</span><span class="pun">/</span>
最后,运行以下命令以启动 Rails 服务器实例:
<span class="pln">bundle </span><span class="kwd">exec</span><span class="pln"> rails server </span><span class="pun">-</span><span class="pln">u webrick </span><span class="pun">-</span><span class="pln">e production</span>
第8步。访问红矿网络界面。
成功安装后,现在打开您的网络浏览器并使用 URL 访问 Redmine Web UI .您将被重定向到以下页面:https://your-IP-address:3000
感谢您使用本教程在 Ubuntu 22.04 LTS Jammy Jellyfish 系统上安装 Redmine 项目管理 Web 应用程序。如需其他帮助或有用信息,我们建议您查看 Redmine 官方网站。