How to Install Redmine 603 on Debian 124 (MySQL) » History » Version 3
Blanka Bou, 2025-03-10 11:37
1 | 3 | Blanka Bou | h1. Install Redmine 6.0.3 on Debian 12.4 (MySQL) |
---|---|---|---|
2 | 1 | Blanka Bou | |
3 | |||
4 | h2. Step 1: System Preparation |
||
5 | |||
6 | You need root privileges. |
||
7 | |||
8 | # Ensure all existing packages are up-to-date |
||
9 | <pre> |
||
10 | apt update |
||
11 | apt upgrade |
||
12 | </pre> |
||
13 | # install vim |
||
14 | <pre> |
||
15 | apt install vim |
||
16 | </pre> |
||
17 | # install sudo |
||
18 | <pre> |
||
19 | apt install sudo |
||
20 | </pre> |
||
21 | # Create user redmine - # set 17 random characters password |
||
22 | <pre> |
||
23 | adduser redmine |
||
24 | </pre> |
||
25 | # make redmine to have sudo priviledges |
||
26 | <pre> |
||
27 | usermod -aG sudo redmine |
||
28 | </pre> |
||
29 | # switch to redmine |
||
30 | <pre> |
||
31 | su - redmine |
||
32 | </pre> |
||
33 | # Install required dependencies |
||
34 | <pre> |
||
35 | sudo apt install build-essential libyaml-dev default-mysql-server default-mysql-client ruby ruby-dev libmariadb-dev-compat libmariadb-dev imagemagick libmagickwand-dev apache2 libapache2-mod-passenger curl -y |
||
36 | </pre> |
||
37 | |||
38 | |||
39 | h2. Step 2: Install and configure MySQL |
||
40 | |||
41 | # Secure the MySQL installation - be ready for many questions |
||
42 | <pre> |
||
43 | sudo mysql_secure_installation |
||
44 | </pre> |
||
45 | # Create a database and user for Redmine - prepare <password> |
||
46 | <pre> |
||
47 | sudo mysql -u root -p |
||
48 | </pre> |
||
49 | <pre> |
||
50 | > CREATE DATABASE redmine CHARACTER SET utf8mb4; |
||
51 | > CREATE USER 'redmine'@'localhost' IDENTIFIED BY '<password>'; |
||
52 | > GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost'; |
||
53 | > FLUSH PRIVILEGES; |
||
54 | > EXIT; |
||
55 | </pre> |
||
56 | # Check users |
||
57 | <pre> |
||
58 | sudo mysql -u root -p |
||
59 | </pre> |
||
60 | <pre> |
||
61 | > SELECT User, Host FROM mysql.user; |
||
62 | > SELECT * FROM mysql.user where User='redmine'\G; |
||
63 | > EXIT; |
||
64 | </pre> |
||
65 | |||
66 | |||
67 | h2. Step 3: Install Redmine |
||
68 | |||
69 | # Download and extract the latest stable Redmine version |
||
70 | <pre> |
||
71 | cd /opt |
||
72 | sudo wget https://www.redmine.org/releases/redmine-6.0.3.tar.gz |
||
73 | sudo tar -xzf redmine-6.0.3.tar.gz |
||
74 | sudo rm redmine-6.0.3.tar.gz |
||
75 | sudo mv redmine-6.0.3 redmine |
||
76 | </pre> |
||
77 | |||
78 | |||
79 | h2. Step 4: File Permissions |
||
80 | |||
81 | <pre> |
||
82 | sudo chown -R www-data:www-data /opt/redmine |
||
83 | sudo chmod -R 755 /opt/redmine |
||
84 | sudo mkdir -p /opt/redmine/tmp /opt/redmine/tmp/pdf /opt/redmine/public/plugin_assets |
||
85 | sudo chown -R www-data:www-data /opt/redmine/tmp /opt/redmine/public/plugin_assets |
||
86 | sudo chmod -R 755 /opt/redmine/tmp /opt/redmine/public/plugin_assets |
||
87 | </pre> |
||
88 | |||
89 | |||
90 | h2. Step 5: Configure Redmine |
||
91 | |||
92 | # Ensure all existing packages are up-to-date |
||
93 | <pre> |
||
94 | sudo apt update |
||
95 | sudo apt upgrade |
||
96 | </pre> |
||
97 | # Create the database configuration |
||
98 | <pre> |
||
99 | cd /opt/redmine |
||
100 | sudo cp config/database.yml.example config/database.yml |
||
101 | sudo vim config/database.yml |
||
102 | </pre> |
||
103 | # Add the following configuration (adjust as needed): |
||
104 | <pre> |
||
105 | production: |
||
106 | adapter: mysql2 |
||
107 | database: redmine |
||
108 | host: localhost |
||
109 | username: redmine |
||
110 | password: <your_password> |
||
111 | encoding: utf8mb4 |
||
112 | tx_isolation: 'READ-COMMITTED' |
||
113 | </pre> |
||
114 | # Install Bundler |
||
115 | <pre> |
||
116 | sudo gem install bundler |
||
117 | </pre> |
||
118 | # Install required gems |
||
119 | <pre> |
||
120 | sudo bundle install --without development test |
||
121 | </pre> |
||
122 | # Generate the secret token |
||
123 | <pre> |
||
124 | cd /opt/redmine |
||
125 | sudo bundle exec rake generate_secret_token |
||
126 | </pre> |
||
127 | # Set up the database |
||
128 | <pre> |
||
129 | cd /opt/redmine |
||
130 | sudo RAILS_ENV=production bundle exec rake db:migrate |
||
131 | sudo RAILS_ENV=production bundle exec rake redmine:load_default_data |
||
132 | </pre> |
||
133 | |||
134 | |||
135 | h2. Step 6: Configure Apache |
||
136 | |||
137 | # Create an Apache virtual host configuration |
||
138 | <pre> |
||
139 | sudo vim /etc/apache2/sites-available/redmine.conf |
||
140 | </pre> |
||
141 | # Add the following configuration |
||
142 | <pre> |
||
143 | <VirtualHost *:80> |
||
144 | ServerName <your.domain.com> |
||
145 | ServerAdmin <admin_email> |
||
146 | DocumentRoot /opt/redmine/public |
||
147 | |||
148 | <Directory "/opt/redmine/public"> |
||
149 | Allow from all |
||
150 | Require all granted |
||
151 | Options -MultiViews |
||
152 | </Directory> |
||
153 | |||
154 | ErrorLog ${APACHE_LOG_DIR}/redmine_error.log |
||
155 | CustomLog ${APACHE_LOG_DIR}/redmine_access.log combined |
||
156 | |||
157 | PassengerRuby /usr/bin/ruby |
||
158 | </VirtualHost> |
||
159 | </pre> |
||
160 | # check the syntax of your Apache configuration |
||
161 | <pre> |
||
162 | sudo apache2ctl configtest |
||
163 | </pre> |
||
164 | # Enable the site and required modules |
||
165 | <pre> |
||
166 | sudo a2enmod passenger |
||
167 | sudo a2ensite redmine |
||
168 | sudo systemctl restart apache2 |
||
169 | </pre> |
||
170 | # check status |
||
171 | <pre> |
||
172 | sudo systemctl status apache2.service |
||
173 | sudo journalctl -xeu apache2.service |
||
174 | </pre> |
||
175 | |||
176 | |||
177 | h2. Step 7: Final Configuration |
||
178 | |||
179 | # Access Redmine through your web browser at http://your.domain.com |
||
180 | # If you see Apache2 Debian Default Page - Check the default Apache site is conflicting with your Redmine site |
||
181 | <pre> |
||
182 | sudo a2dissite 000-default |
||
183 | sudo systemctl reload apache2 |
||
184 | </pre> |
||
185 | # Log in with default credentials: |
||
186 | - Username: admin |
||
187 | - Password: admin |
||
188 | # Change the admin password immediately after the first login! |
||
189 | |||
190 | *DONE.* |