94 lines
2.4 KiB
Markdown
94 lines
2.4 KiB
Markdown
# Ubuntu 18.04 安装和配置 Redmine
|
||
|
||
TODO: 该方式尚未成功
|
||
|
||
## 安装基本环境
|
||
|
||
```bash
|
||
apt install vim apache2 libapache2-mod-passenger mysql-server mysql-client ruby ruby-dev
|
||
# 开启相关服务
|
||
service apache2 start
|
||
service mysql start
|
||
```
|
||
|
||
## 配置 MySQL
|
||
|
||
```bash
|
||
# 配置 MySQL
|
||
$ mysql_secure_installation
|
||
Enter current password for root (enter for none):[password]
|
||
Remove anonymous users? [Y/n] Y
|
||
Disallow root login remotely? [Y/n] n
|
||
Remove test database and access to it? [Y/n] n
|
||
Reload privilege tables now? [Y/n] Y
|
||
# 创建 Redmine 用户和表
|
||
# mysql -u root -p
|
||
# mysql> create database redmine;
|
||
# mysql> create user 'redmine'@'%' identified by 'password';
|
||
# mysql> grant all on redmine.* to 'redmine'@'%' identified by 'password' with grant option;
|
||
# mysql> flush privileges;
|
||
# mysql> quit;
|
||
# 重启 MySQL 服务
|
||
$ service mysql restart
|
||
```
|
||
|
||
## 安装和配置 Redmine
|
||
|
||
```bash
|
||
apt install redmine redmine-mysql
|
||
```
|
||
|
||
在安装过程中,系统将要求配置 Redmine,选择 YES,然后继续。数据库选择 MYSQL;接下来为 Redmine 实例添加数据库访问密码,为上面创建的数据库 redmine 用户密码。
|
||
|
||
## 更新和配置 Ruby
|
||
|
||
```bash
|
||
cd /usr/share/redmine
|
||
gem update
|
||
gem install bundler
|
||
bundle install --without development test --path vendor/bundle
|
||
```
|
||
|
||
## 配置 Apache2
|
||
|
||
```bash
|
||
ln -s /usr/share/redmine/public /var/www/html/redmine
|
||
```
|
||
|
||
修改 /etc/apache2/mods-available/passenger.conf 文件如下:
|
||
|
||
```bash
|
||
<IfModule mod_passenger.c>
|
||
PassengerDefaultUser www-data
|
||
PassengerRoot /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini
|
||
PassengerDefaultRuby /usr/bin/ruby
|
||
</IfModule>
|
||
```
|
||
|
||
为 Redmine 配置 Apache2 站点配置文件。该文件将控制用户访问 Redmine 内容的方式。运行以下命令以创建一个名为 redmine.conf 的新配置文件:
|
||
|
||
```bash
|
||
vim /etc/apache2/sites-available/redmine.conf
|
||
|
||
<VirtualHost *:80>
|
||
ServerAdmin redmime@xiem.com
|
||
DocumentRoot /var/www/html/redmine
|
||
ServerName xiem.com
|
||
ServerAlias redmine.xiem.com
|
||
|
||
<Directory /var/www/html/redmine>
|
||
RailsBaseURI /redmine
|
||
PassengerResolveSymlinksInDocumentRoot on
|
||
</Directory>
|
||
|
||
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
||
</VirtualHost>
|
||
|
||
a2ensite redmine.conf
|
||
```
|
||
|
||
## 外部参考资料
|
||
|
||
1. [Redmine HowTos](https://redmine.org/projects/redmine/wiki/HowTos)
|