CentOS 安装 Redmine
时间: 2023-03-29 15:01:46 浏览: 265
你可以参考以下步骤来安装 Redmine:
1. 首先,确保你已经安装了 CentOS 操作系统。
2. 安装必要的软件包:
```
sudo yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel sqlite-devel
```
3. 安装 Ruby:
```
cd /usr/local/src
sudo wget https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.3.tar.gz
sudo tar zxvf ruby-2.6.3.tar.gz
cd ruby-2.6.3
sudo ./configure --disable-install-doc
sudo make
sudo make install
```
4. 安装 Redmine:
```
cd /usr/local/src
sudo wget https://www.redmine.org/releases/redmine-4.1.1.tar.gz
sudo tar zxvf redmine-4.1.1.tar.gz
sudo mv redmine-4.1.1 /var/www/redmine
cd /var/www/redmine
sudo gem install bundler
sudo bundle install --without development test
```
5. 配置数据库:
```
sudo yum install -y mariadb-server mariadb-devel
sudo systemctl start mariadb
sudo systemctl enable mariadb
sudo mysql_secure_installation
sudo mysql -u root -p
CREATE DATABASE redmine CHARACTER SET utf8mb4;
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';
FLUSH PRIVILEGES;
exit
```
6. 配置 Redmine:
```
cd /var/www/redmine
sudo cp config/configuration.yml.example config/configuration.yml
sudo vi config/configuration.yml
修改数据库配置:
production:
adapter: mysql2
database: redmine
host: localhost
username: redmine
password: "password"
encoding: utf8mb4
sudo cp config/database.yml.example config/database.yml
sudo vi config/database.yml
修改数据库配置:
production:
adapter: mysql2
database: redmine
host: localhost
username: redmine
password: "password"
encoding: utf8mb4
sudo bundle exec rake generate_secret_token
sudo RAILS_ENV=production bundle exec rake db:migrate
sudo RAILS_ENV=production REDMINE_LANG=zh bundle exec rake redmine:load_default_data
sudo chown -R apache:apache files log tmp public/plugin_assets
sudo chmod -R 755 files log tmp public/plugin_assets
```
7. 配置 Apache:
```
sudo yum install -y httpd
sudo systemctl start httpd
sudo systemctl enable httpd
sudo vi /etc/httpd/conf.d/redmine.conf
添加以下内容:
<VirtualHost *:80>
ServerName redmine.example.com
DocumentRoot /var/www/redmine/public
<Directory /var/www/redmine/public>
AllowOverride all
Require all granted
</Directory>
</VirtualHost>
sudo systemctl restart httpd
```
8. 访问 Redmine:
在浏览器中输入 http://redmine.example.com,即可访问 Redmine。
希望这些步骤能够帮助你成功安装 Redmine。
阅读全文