Project

General

Profile

Migrating to another server

Added by Olivier Moreau about 8 years ago

I reinstalled Redmine and migrated data. I documented the process for the benefit of other users.

Follow these steps :
1- Create a new server (this procedure is based on Ubuntu)
Note the IP address (IPREDMINE)

2- Login

3- Change Password
sudo passwd

4- Install Text editor
sudo apt install joe

5- Network config
sudo joe /etc/hosts

127.0.0.1 YOURSERVER

6- Protect System
sudo systemctl mask ctrl-alt-del.target
sudo systemctl daemon-reload
sudo apt update
sudo apt install unattended-upgrades

7- Create a user account
sudo adduser USER
cut -d: -f1 /etc/passwd
sudo ls -la /home/USER

8- Install and config FTP server
sudo apt install vsftpd
sudo joe /etc/vsftpd.conf
local_enable=YES
write_enable=YES (suppess #)
local_umask=022 (suppess #)
sudo /etc/init.d/vsftpd reload

9- Install Redmine prerequisite
sudo apt install wget
sudo apt install ruby-dev
sudo apt install make g++ gcc libssl-dev

9- Install Redmine with Bitnami
BE VERY CAREFUL AND LOAD SAME VERSION AS OLD SERVER !!!

For instance if the link under the download button on the web page is :
https://bitnami.com/redirect/to/135646/bitnami-dolibarr-4.0.2-0-linux-x64-installer.run
Starting from the link I replace :
redirect/to/135646/bitnami-dolibarr-4.0.2-0
by
files/stacks/dolibarr/3.9.1-2/bitnami-dolibarr-3.9.1-2

More generally
redirect/to/9999999/bitnami-APP-1.2.3-0
by
files/stacks/APP/1.2.3-0/bitnami-APP-1.2.3-0

sudo wget https://downloads.bitnami.com/files/stacks/redmine/3.2.1-2/bitnami-redmine-3.2.1-2-linux-x64-installer.run
sudo chmod +x bitnami-redmine-3.2.1-2-linux-x64-installer.run
./bitnami-redmine-3.2.1-2-linux-x64-installer.run

11- Config Redmine
Select :
-- Folder : redmine (to facilite navigation)
-- Real name : ADMIN
-- Email :
-- Login : ADMIN
Wait 10mn
Connect to : http://IPREDMINE:8080

12- Manual start and stop
/home/ubuntu/redmine/ctlscript.sh stop
/home/ubuntu/redmine/ctlscript.sh start
/home/ubuntu/redmine/ctlscript.sh restart

13- Automatic start
Creat a file with 2 lines in it :
sudo joe /etc/init.d/bitnami-redmine

#!/bin/bash
 sudo ubuntu -c "/home/ubuntu/redmine/ctlscript.sh $@"@
sudo chmod +x /etc/init.d/bitnami-redmine
Edit a file to add stuff
sudo joe /home/ubuntu/redmine/ctlscript.sh

 #!/bin/bash  (Keep on top)
 #
 ### BEGIN INIT INFO
 # Provides:          bitnami-redmine
 # Required-Start:    $remote_fs $syslog
 # Required-Stop:     $remote_fs $syslog
 # Default-Start:     2 3 4 5
 # Default-Stop:      0 1 6
 # Short-Description: Start daemon at boot time
 # Description:       Enable services provided by daemon.
 ### END INIT INFO@

sudo update-rc.d -f bitnami-redmine defaults
sudo update-rc.d -f bitnami-redmine enable
ls -l /etc/rc2.d
sudo reboot

14- Check and note the config (database password) :
cd /home/ubuntu/redmine/apps/redmine/htdocs/config
cat database.yml

15- Migrate data
15.1- To be able to rollback type :
cd /home/ubuntu/redmine/mysql
cp data data-empty -r
cd /home/ubuntu/redmine/apps/redmine/htdocs
cp files files-empty -r
cd /home/ubuntu/redmine/apps/redmine/htdocs/config
cp database.yml database-empty.yml -r

15.2- Export (let’s say from Windows)
dir C:\Bitnami\redmine\apps\redmine\htdocs\files
cd c:\bitnami\redmine\mysql\bin
mysqldump bitnami_redmine > dump99.sql --user=bitnami --password

15.3- Import files
Upload the files and the dump99.sql on new server thru FTP
Copy them to the good directory
cd /home/ubuntu/redmine/apps/redmine/htdocs
sudo cp /home/USER/files . -r
sudo chown ubuntu:ubuntu files -R
sudo chmod 664 files -R

15.4- Import database
cd /home/ubuntu/redmine/mysql
cp /home/adminom/dump99.sql .
mysql bitnami_redmine < dump99.sql --socket /home/ubuntu/redmine/mysql/tmp/mysql.sock --user bitnami --password