项目

常规

个人资料

操作

如何在Ubuntu 20.04/22.04上使用Apache2安装Redmine 5.0.x

基于 RedmineInstall,但仅限于Ubuntu和MySQL,这将在一个空的Ubuntu 20.04虚拟机上运行,此操作将安装Redmine 5.0.1和Apache2以及本地MySQL数据库。如有任何问题或反馈,请随时发送邮件至

安装依赖项

# update & upgrade 
sudo apt-get update && sudo apt-get upgrade -y

# install required packages
sudo apt install -y apache2 ruby ruby-dev build-essential libapache2-mod-passenger libmysqlclient-dev

# if you want to install mysql server locally
sudo apt install -y mysql-server

下载并提取Redmine

从这里获取最新版本 这里。对于此示例,将是5.0.1

# download and extract
cd
wget https://redmine.org/releases/redmine-5.0.1.tar.gz
cd /opt
sudo tar -xvzf ~/redmine-5.0.1.tar.gz

# symlink to remove version reference
sudo ln -s redmine-5.0.1 redmine

配置数据库

创建一个数据库并为redmine创建一个用户。以下是一个本地安装的示例

sudo mysql

mysql> 
CREATE DATABASE redmine CHARACTER SET utf8mb4;
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'secretPassword';
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';
FLUSH PRIVILEGES;

编辑数据库配置文件

# copy the example file
cd /opt/redmine
cp config/database.yml.example config/database.yml

# edit config file with your editor of choice (mine is vi)
vi config/database.yml

用您的配置替换或更新生产:块。以下是一个基于上述mysql配置的示例。

production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: "secretPassword" 
  # Use "utf8" instead of "utfmb4" for MySQL prior to 5.7.7
  encoding: utf8mb4

安装Ruby依赖项

在redmine路径下

# install bundler
sudo gem install bundler

# install redmine bundle (give sudo password when prompted)
bundle install # installation of 22.04 seems to require this to be executed as sudo

运行Redmine脚本

# generate secret token
bundle exec rake generate_secret_token

# migrate database
RAILS_ENV=production bundle exec rake db:migrate

# load default data
RAILS_ENV=production bundle exec rake redmine:load_default_data

配置Apache

在 /etc/apache2/sites-available 中创建一个Apache配置文件(例如 redmine.conf),内容如下

<VirtualHost *:80>
    ServerName redmine.example.com
    RailsEnv production
    DocumentRoot /opt/redmine/public

    <Directory "/opt/redmine/public">
            Allow from all
            Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/redmine_error.log
        CustomLog ${APACHE_LOG_DIR}/redmine_access.log combined
</VirtualHost>

如果这是一个新的独立安装,它将创建一个默认的Apache站点。禁用它并启用上面创建的redmine配置。

# disable default apache sites
sudo a2dissite 000-default.conf

# enable redmine
sudo a2ensite redmine.conf

# reload apache
sudo systemctl reload apache2

测试Redmine

将您的浏览器指向服务器的IP/DNS名称,它应该显示默认的Redmine屏幕。
使用admin/admin登录

#party

Marc Morocutti 更新 约1年前 · 11次修订