Proyecto

General

Perfil

Wiki » Histórico » Versión 1

Redmine Admin, 2025-12-30 01:21

1 1 Redmine Admin
# Wiki
2
3
4
# Comandos Completos - Instalación Redmine AWS
5
## Todos los Comandos Ejecutados en Orden
6
7
**IMPORTANTE:** Ejecutar estos comandos EN ORDEN, uno por uno.
8
9
---
10
11
## FASE 1: Preparación del Sistema
12
13
### Conectarse a la Instancia
14
```bash
15
# Via AWS Console: EC2 → Connect → EC2 Instance Connect
16
# O via SSH con PuTTY/terminal
17
```
18
19
### Actualizar Sistema
20
```bash
21
sudo apt update
22
sudo apt upgrade -y
23
```
24
25
### Instalar Dependencias
26
```bash
27
sudo apt install -y build-essential ruby-full ruby-dev libmysqlclient-dev \
28
mysql-server imagemagick libmagickwand-dev git curl libyaml-dev
29
```
30
31
### Verificar Instalaciones
32
```bash
33
ruby -v
34
mysql --version
35
git --version
36
```
37
38
---
39
40
## FASE 2: Configurar SWAP
41
42
```bash
43
# Crear archivo SWAP de 2GB
44
sudo fallocate -l 2G /swapfile
45
46
# Permisos
47
sudo chmod 600 /swapfile
48
49
# Formatear como swap
50
sudo mkswap /swapfile
51
52
# Activar
53
sudo swapon /swapfile
54
55
# Verificar
56
free -h
57
58
# Hacer permanente
59
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
60
```
61
62
---
63
64
## FASE 3: Configurar MySQL
65
66
```bash
67
# Acceder a MySQL
68
sudo mysql
69
70
# Dentro de MySQL, ejecutar:
71
CREATE DATABASE redmine CHARACTER SET utf8mb4;
72
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'redmine_password_2024';
73
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';
74
FLUSH PRIVILEGES;
75
EXIT;
76
```
77
78
---
79
80
## FASE 4: Instalar Bundler
81
82
```bash
83
sudo gem install bundler
84
bundle --version
85
```
86
87
---
88
89
## FASE 5: Descargar Redmine
90
91
```bash
92
cd /tmp
93
sudo git clone https://github.com/redmine/redmine.git /opt/redmine
94
cd /opt/redmine
95
ls -la
96
```
97
98
---
99
100
## FASE 6: Configurar Base de Datos
101
102
```bash
103
# Crear archivo de configuración
104
nano config/database.yml
105
```
106
107
**Contenido del archivo:**
108
```yaml
109
production:
110
  adapter: mysql2
111
  database: redmine
112
  host: localhost
113
  username: redmine
114
  password: "redmine_password_2024"
115
  encoding: utf8mb4
116
```
117
118
**Guardar:** Ctrl+O, Enter, Ctrl+X
119
120
---
121
122
## FASE 7: Configurar Permisos
123
124
```bash
125
sudo chown -R ubuntu:ubuntu /opt/redmine
126
sudo chmod -R 755 /opt/redmine
127
sudo mkdir -p /opt/redmine/tmp/pdf /opt/redmine/public/plugin_assets
128
sudo chmod -R 755 /opt/redmine/files /opt/redmine/log /opt/redmine/tmp /opt/redmine/public/plugin_assets
129
```
130
131
---
132
133
## FASE 8: Instalar Gemas
134
135
```bash
136
cd /opt/redmine
137
138
# Configurar bundler
139
bundle config set --local path 'vendor/bundle'
140
bundle config set --local without 'development test'
141
142
# Instalar (tardará 10-15 minutos)
143
bundle install
144
```
145
146
---
147
148
## FASE 9: Generar Secret Token
149
150
```bash
151
# Generar clave
152
openssl rand -hex 64
153
154
# Crear archivo (copiar la clave generada)
155
nano config/secrets.yml
156
```
157
158
**Contenido (reemplazar con tu clave):**
159
```yaml
160
production:
161
  secret_key_base: TU_CLAVE_GENERADA_AQUI
162
```
163
164
**Guardar:** Ctrl+O, Enter, Ctrl+X
165
166
---
167
168
## FASE 10: Crear Tablas de BD
169
170
```bash
171
cd /opt/redmine
172
RAILS_ENV=production bundle exec rake db:migrate
173
```
174
175
---
176
177
## FASE 11: Cargar Datos Iniciales
178
179
```bash
180
RAILS_ENV=production REDMINE_LANG=es bundle exec rake redmine:load_default_data
181
```
182
183
**Cuando pregunte idioma:** escribir `es` y Enter
184
185
---
186
187
## FASE 12: Configurar Servicio Systemd
188
189
```bash
190
# Crear archivo de servicio
191
sudo nano /etc/systemd/system/redmine.service
192
```
193
194
**Contenido:**
195
```ini
196
[Unit]
197
Description=Redmine Project Management
198
After=network.target mysql.service
199
200
[Service]
201
Type=simple
202
User=ubuntu
203
WorkingDirectory=/opt/redmine
204
Environment="RAILS_ENV=production"
205
Environment="RAILS_SERVE_STATIC_FILES=true"
206
ExecStart=/usr/local/bin/bundle exec rails server -e production -b 0.0.0.0 -p 3000
207
Restart=always
208
RestartSec=10
209
210
[Install]
211
WantedBy=multi-user.target
212
```
213
214
**Guardar:** Ctrl+O, Enter, Ctrl+X
215
216
```bash
217
# Recargar systemd
218
sudo systemctl daemon-reload
219
220
# Habilitar inicio automático
221
sudo systemctl enable redmine
222
223
# Iniciar servicio
224
sudo systemctl start redmine
225
226
# Verificar
227
sudo systemctl status redmine
228
```
229
230
---
231
232
## FASE 13: Instalar Nginx
233
234
```bash
235
sudo apt update
236
sudo apt install -y nginx
237
238
# Verificar
239
sudo systemctl status nginx
240
```
241
242
---
243
244
## FASE 14: Configurar Nginx
245
246
```bash
247
# Crear configuración
248
sudo nano /etc/nginx/sites-available/redmine
249
```
250
251
**Contenido (reemplazar con tu dominio):**
252
```nginx
253
server {
254
    listen 80;
255
    server_name dvera-redmine.duckdns.org;
256
257
    location / {
258
        proxy_pass http://localhost:3000;
259
        proxy_set_header Host $host;
260
        proxy_set_header X-Real-IP $remote_addr;
261
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
262
        proxy_set_header X-Forwarded-Proto $scheme;
263
    }
264
}
265
```
266
267
**Guardar:** Ctrl+O, Enter, Ctrl+X
268
269
```bash
270
# Habilitar configuración
271
sudo ln -s /etc/nginx/sites-available/redmine /etc/nginx/sites-enabled/
272
273
# Verificar sintaxis
274
sudo nginx -t
275
276
# Reiniciar
277
sudo systemctl restart nginx
278
```
279
280
---
281
282
## FASE 15: Instalar Certbot
283
284
```bash
285
sudo apt install -y certbot python3-certbot-nginx
286
```
287
288
---
289
290
## FASE 16: Obtener Certificado SSL
291
292
```bash
293
# Reemplazar con tu dominio
294
sudo certbot --nginx -d dvera-redmine.duckdns.org
295
```
296
297
**Responder:**
298
1. Email: tu@email.com
299
2. Terms: Y
300
3. Share email: N
301
4. Redirect: 2 (Yes, redirect)
302
303
---
304
305
## FASE 17: Verificar Renovación
306
307
```bash
308
sudo certbot renew --dry-run
309
```
310
311
---
312
313
## ✅ ¡COMPLETADO!
314
315
Ahora accede a:
316
```
317
https://dvera-redmine.duckdns.org
318
```
319
320
---
321
322
## Comandos de Mantenimiento
323
324
### Ver Logs
325
```bash
326
sudo journalctl -u redmine -f
327
sudo journalctl -u nginx -f
328
tail -f /var/log/nginx/error.log
329
```
330
331
### Reiniciar Servicios
332
```bash
333
sudo systemctl restart redmine
334
sudo systemctl restart nginx
335
sudo systemctl restart mysql
336
```
337
338
### Backup Base de Datos
339
```bash
340
mysqldump -u redmine -p redmine > backup_$(date +%Y%m%d).sql
341
```
342
343
### Verificar Recursos
344
```bash
345
free -h
346
df -h
347
top
348
```
349
350
### Verificar Certificado
351
```bash
352
sudo certbot certificates
353
```
354
355
### Renovar Certificado
356
```bash
357
sudo certbot renew
358
sudo systemctl restart nginx
359
```
360
361
---
362
363
**Fin de los Comandos**