NotePublic/Software/Applications/Redmine/Ubuntu_18.04_安装和配置_Redmine.md

96 lines
2.6 KiB
Markdown
Raw Normal View History

# Ubuntu 18.04 安装和配置 Redmine
## Docker 方式安装
```bash
# Run Redmine with SQLite3
docker run -d -p 9001:3000 --name some-redmine redmine
# Run Redmine with a Database Container
docker run -d --name redminedb -e MYSQL_USER=redmine -e MYSQL_PASSWORD=<password> -e MYSQL_DATABASE=redmine -e MYSQL_ROOT_PASSWORD=<password> mariadb:latest
docker run -d --name redmine --link redminedb:mysql -p 9001:3000 -e REDMINE_DB_MYSQL=redminedb -e REDMINE_DB_USERNAME=redmine -e REDMINE_DB_PASSWORD=<password> redmine
```
## 安装基本环境
```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
gem update
gem install bundler
```
## 配置 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
```