您好,登录后才能下订单哦!
密码登录
登录注册
点击 登录注册 即表示同意《亿速云用户服务条款》
# Linux下如何安装Redmine
Redmine是一款基于Ruby on Rails开发的开源项目管理工具,支持多项目管理、问题跟踪、文档管理等功能。本文将详细介绍在Linux系统(以Ubuntu 20.04为例)上安装Redmine的完整流程。
## 一、环境准备
### 1. 系统要求
- Linux操作系统(本文以Ubuntu 20.04为例)
- 至少2GB内存(生产环境建议4GB以上)
- 10GB可用磁盘空间
- Ruby 2.6+(Redmine 4.2+要求)
- MySQL 5.7+或MariaDB 10.3+
- Apache/Nginx(可选)
### 2. 更新系统
```bash
sudo apt update && sudo apt upgrade -y
sudo apt install -y build-essential zlib1g-dev libssl-dev libreadline-dev \
libyaml-dev libcurl4-openssl-dev libffi-dev libxml2-dev \
libxslt1-dev libmagickwand-dev imagemagick git curl
sudo apt install -y mysql-server mysql-client libmysqlclient-dev
sudo mysql_secure_installation
sudo apt install -y mariadb-server mariadb-client libmariadb-dev
sudo mysql_secure_installation
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
source ~/.bashrc
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
rbenv install 2.7.6 # 根据Redmine版本要求选择
rbenv global 2.7.6
ruby -v # 应显示2.7.6或更高版本
gem -v
wget https://www.redmine.org/releases/redmine-4.2.3.tar.gz
tar xvf redmine-4.2.3.tar.gz
sudo mv redmine-4.2.3 /opt/redmine
CREATE DATABASE redmine CHARACTER SET utf8mb4;
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';
FLUSH PRIVILEGES;
编辑/opt/redmine/config/database.yml
:
production:
adapter: mysql2
database: redmine
host: localhost
username: redmine
password: "your_password"
encoding: utf8mb4
cd /opt/redmine
gem install bundler
bundle config set --local without 'development test'
bundle install
bundle exec rake generate_secret_token
RLS_ENV=production bundle exec rake db:migrate
RLS_ENV=production bundle exec rake redmine:load_default_data
# 选择语言时输入zh(中文)
gem install puma
bundle exec puma -e production -d
sudo apt install -y dirmngr gnupg apt-transport-https ca-certificates
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7
sudo sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger focal main > /etc/apt/sources.list.d/passenger.list'
sudo apt update
sudo apt install -y nginx libnginx-mod-http-passenger
/etc/nginx/sites-available/redmine.conf
:server {
listen 80;
server_name your_domain.com;
root /opt/redmine/public;
passenger_enabled on;
passenger_ruby /home/your_user/.rbenv/shims/ruby;
client_max_body_size 10m;
location ~ ^/(assets|system|attachments) {
expires max;
break;
}
}
sudo ln -s /etc/nginx/sites-available/redmine.conf /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx
编辑/opt/redmine/config/configuration.yml
:
production:
email_delivery:
delivery_method: :smtp
smtp_settings:
address: "smtp.yourmail.com"
port: 587
domain: "yourdomain.com"
authentication: :plain
user_name: "your_email@example.com"
password: "your_password"
enable_starttls_auto: true
crontab -e
*/5 * * * * cd /opt/redmine && bundle exec rake redmine:send_reminders RLS_ENV=production
0 2 * * * cd /opt/redmine && bundle exec rake redmine:fetch_changesets RLS_ENV=production
sudo chown -R www-data:www-data /opt/redmine
sudo chmod -R 755 /opt/redmine/files
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable
# 使用rbenv时不需要sudo
bundle install --path vendor/bundle
检查日志:
tail -f /opt/redmine/log/production.log
测试邮件配置:
RLS_ENV=production bundle exec rails console
>> ActionMailer::Base.mail(from: "test@example.com", to: "your@email.com", subject: "Test", body: "Test").deliver_now
通过以上步骤,您已成功在Linux系统上安装配置了Redmine。建议初次登录后: 1. 修改管理员密码(默认admin/admin) 2. 配置项目跟踪和工作流程 3. 安装需要的插件(如Agile、CRM等)
Redmine的灵活性和可扩展性使其成为团队协作的优秀工具,合理配置后可以显著提升项目管理效率。 “`
注:实际安装时请根据您的Redmine版本调整Ruby和数据库版本要求,生产环境建议使用备份策略并定期更新系统补丁。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。