HowTo Install Redmine 50x on Ubuntu 2004 with Apache2 » History » Version 10
Pedro Gutierrez, 2022-10-06 11:14
1 | 1 | Marc Morocutti | h1. HowTo Install Redmine 5.0.x on Ubuntu 20.04 with Apache2 |
---|---|---|---|
2 | |||
3 | 8 | Marc Morocutti | Based on [[RedmineInstall]] but limited to Ubuntu & MySQL, this will take on an empty Ubuntu 20.04 VM, this will install Redmine 5.0.1 with Apache2 and local MySQL database. For any questions or feedback, feel free to write to redmine@ion.lu |
4 | 7 | Marc Morocutti | |
5 | 1 | Marc Morocutti | h2. Installing dependencies |
6 | |||
7 | <pre> |
||
8 | # update & upgrade |
||
9 | sudo apt-get update && sudo apt-get upgrade -y |
||
10 | |||
11 | # install required packages |
||
12 | 2 | Marc Morocutti | sudo apt install -y apache2 ruby ruby-dev build-essential libapache2-mod-passenger libmysqlclient-dev |
13 | 1 | Marc Morocutti | |
14 | # if you want to install mysql server locally |
||
15 | sudo apt install -y mysql-server |
||
16 | </pre> |
||
17 | |||
18 | 2 | Marc Morocutti | h2. Download & Extract Redmine |
19 | |||
20 | Go grab the latest version from [[Download|here]]. For this example it will be 5.0.1 |
||
21 | <pre> |
||
22 | # download and extract |
||
23 | cd |
||
24 | wget https://redmine.org/releases/redmine-5.0.1.tar.gz |
||
25 | cd /opt |
||
26 | sudo tar -xvzf ~/redmine-5.0.1.tar.gz |
||
27 | |||
28 | # symlink to remove version reference |
||
29 | sudo ln -s redmine-5.0.1 redmine |
||
30 | </pre> |
||
31 | |||
32 | h2. Configure database |
||
33 | |||
34 | Create a database and create a user for redmine. Example for localhost installation below: |
||
35 | <pre> |
||
36 | sudo mysql |
||
37 | |||
38 | 6 | Marc Morocutti | mysql> |
39 | CREATE DATABASE redmine CHARACTER SET utf8mb4; |
||
40 | CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'secretPassword'; |
||
41 | GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost'; |
||
42 | FLUSH PRIVILEGES; |
||
43 | 3 | Marc Morocutti | </pre> |
44 | 2 | Marc Morocutti | |
45 | 3 | Marc Morocutti | h2. Edit database configuration file |
46 | |||
47 | <pre> |
||
48 | # copy the example file |
||
49 | cd /opt/redmine |
||
50 | cp config/database.yml.example config/database.yml |
||
51 | |||
52 | # edit config file with your editor of choice (mine is vi) |
||
53 | vi config/database.yml |
||
54 | </pre> |
||
55 | |||
56 | Replace or update the production: block with your configuration. One example based on the mysql config above. |
||
57 | |||
58 | <pre> |
||
59 | production: |
||
60 | adapter: mysql2 |
||
61 | database: redmine |
||
62 | host: localhost |
||
63 | username: redmine |
||
64 | password: "secretPassword" |
||
65 | # Use "utf8" instead of "utfmb4" for MySQL prior to 5.7.7 |
||
66 | encoding: utf8mb4 |
||
67 | 2 | Marc Morocutti | </pre> |
68 | 4 | Marc Morocutti | |
69 | 7 | Marc Morocutti | h2. Install Ruby dependencies |
70 | 10 | Pedro Gutierrez | |
71 | 9 | 拉哨 哈 | in redmine path |
72 | 7 | Marc Morocutti | <pre> |
73 | # install bundler |
||
74 | sudo gem install bundler |
||
75 | |||
76 | # install redmine bundle (give sudo password when prompted) |
||
77 | bundle install |
||
78 | </pre> |
||
79 | |||
80 | 4 | Marc Morocutti | h2. Run Redmine scripts |
81 | |||
82 | 7 | Marc Morocutti | <pre> |
83 | 4 | Marc Morocutti | # generate secret token |
84 | bundle exec rake generate_secret_token |
||
85 | |||
86 | # migrate database |
||
87 | RAILS_ENV=production bundle exec rake db:migrate |
||
88 | |||
89 | # load default data |
||
90 | RAILS_ENV=production bundle exec rake redmine:load_default_data |
||
91 | 7 | Marc Morocutti | </pre> |
92 | 4 | Marc Morocutti | |
93 | h2. Configure Apache |
||
94 | |||
95 | Create an apache configuration file in /etc/apache2/sites-available (e.g. redmine.conf) with the following content: |
||
96 | <pre> |
||
97 | 1 | Marc Morocutti | <VirtualHost *:80> |
98 | 7 | Marc Morocutti | ServerName redmine.example.com |
99 | 4 | Marc Morocutti | RailsEnv production |
100 | DocumentRoot /opt/redmine/public |
||
101 | |||
102 | <Directory "/opt/redmine/public"> |
||
103 | Allow from all |
||
104 | Require all granted |
||
105 | </Directory> |
||
106 | |||
107 | ErrorLog ${APACHE_LOG_DIR}/redmine_error.log |
||
108 | 5 | Marc Morocutti | CustomLog ${APACHE_LOG_DIR}/redmine_access.log combined |
109 | </VirtualHost> |
||
110 | </pre> |
||
111 | |||
112 | If this is a new standalone installation, it will have created a default apache site. Disable it and enable the redmine config created above. |
||
113 | |||
114 | 1 | Marc Morocutti | <pre> |
115 | 5 | Marc Morocutti | # disable default apache sites |
116 | 7 | Marc Morocutti | sudo a2dissite 000-default.conf |
117 | 5 | Marc Morocutti | |
118 | 1 | Marc Morocutti | # enable redmine |
119 | 7 | Marc Morocutti | sudo a2ensite redmine.conf |
120 | 5 | Marc Morocutti | |
121 | # reload apache |
||
122 | 7 | Marc Morocutti | sudo systemctl reload apache2 |
123 | 5 | Marc Morocutti | </pre> |
124 | |||
125 | h2. Test Redmine |
||
126 | |||
127 | Point your browser to the IP/DNS Name of the server and it should show the default Redmine screen. |
||
128 | Login with admin/admin |
||
129 | |||
130 | #party |