Introduction
We have been running Redmine, an issue tracking system, on a Virtual Machine running Ubuntu. The Ubuntu OS is near end of life for support, and the Redmine version is also very old. So we wanted to upgrade both the OS and Redmine to the latest versions.
The following article describes the steps we took to upgrade the OS and Redmine.
As an option, you can upgrade only Redmine to run in a docker container, and that will simplify the data backup part of the task, because you can copy the existing data to a new location on the same server.
Convention
When you see code blocks:
- Lines that start with $ are commands to be typed (or copy-pasted), without the $, into the terminal window
- Lines that start with # are helpful comments for you
Turn off the Old Web Server
$ sudo nano /etc/apache2/ports.conf
Old Port New Port 80 8080 443 8443
Press CTRL+S
and CTRL+X
to save and exit
2. Turn off the old web server
$ sudo systemctl stop apache2 $ sudo systemctl status apache2 ● apache2.service - The Apache HTTP Server Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled) Drop-In: /lib/systemd/system/apache2.service.d └─apache2-systemd.conf Active: inactive (dead) since Fri 2023-09-01 15:31:52 PDT; 8s ago Process: 39951 ExecStop=/usr/sbin/apachectl stop (code=exited, status=0/SUCCESS) Process: 36201 ExecReload=/usr/sbin/apachectl graceful (code=exited, status=0/SUCCESS) Process: 5395 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS) Main PID: 765 (code=exited, status=0/SUCCESS)
Prepare Redmine for Upgrade
Backup the Redmine Database
Backup the Redmine Data
# Create downloads folder $ cd ~ $ mkdir downloads # remove .gz file sin the downloads folder $ rm -f downloads/*.gz # Move into the old redmine installation folder for backing up its files $ cd www/redmine # Backup config files $ sudo tar -czf ~/downloads/redmine-config.gz ./config # Backup plugins $ sudo tar -czf ~/downloads/redmine-plugins.gz ./plugins # Backup themes $ sudo tar -czf ~/downloads/redmine-themes.gz ./public/themes # Backup all uploaded files for issues (it can be several GB) $ sudo tar -czf ~/downloads/redmine-files.gz ./files # If needed, backup newer uploaded files for issues for August 2023 after the 7th $ sudo tar -newer=2023-10-07 -czf ~/downloads/redmine-files_after_1007.gz ./files/2023/10
Copy backup files to another computer
- Login to another PC at 192.168.1.100 (use your own backup computer's IP here)
- Start the command prompt
- Do the following commands:
> REM Go to home directory > CD %HOMEPATH% > REM Go to Downloads folder > CD Downloads > REM Copy all .gz files from the Redmine server to the current diretory > scp yourlogin@192.168.1.100:downloads/*.gz ./ > REM OR Copy individual .gz file from the Redmine server to the current diretory > REM These files are not too big, and they will not take too long transfer > scp yourlogin@192.168.1.100:downloads/redmine-config.gz ./ > scp yourlogin@192.168.1.100:downloads/redmine-plugins.gz ./ > scp yourlogin@192.168.1.100:downloads/redmine-themes.gz ./ > REM This file is huge, and it will take an hour or so to transfer > scp yourlogin@192.168.1.100:downloads/redmine-files.gz ./ > REM This newer uploads file is smaller, and it will not take as long transfer > scp yourlogin@192.168.1.100:downloads/redmine-files_after_1007.gz ./
Un-install obsolete or unused Redmine plugins
Turn on the old web server
$ sudo systemctl start apache2 $ sudo systemctl status apache2
For our case, we need to un-install these obsolete plugins from Redmine:
- clipboard_image_paste
- redmine_agile
- redmine_custom_css
- redmine_emojibutton
- redmine_lightbox2
$ cd $REDMINE_ROOT # Un-install the plugins in Redmine $ bundle exec rake redmine:plugins:migrate NAME=clipboard_image_paste VERSION=0 RAILS_ENV=production $ bundle exec rake redmine:plugins:migrate NAME=redmine_agile VERSION=0 RAILS_ENV=production $ bundle exec rake redmine:plugins:migrate NAME=redmine_custom_css VERSION=0 RAILS_ENV=production $ bundle exec rake redmine:plugins:migrate NAME=redmine_emojibutton VERSION=0 RAILS_ENV=production $ bundle exec rake redmine:plugins:migrate NAME=redmine_lightbox2 VERSION=0 RAILS_ENV=production # If you are doing and in-place upgrade of Redmine, remove the # plugin folders for the plugins that were un-installed above $ rm -rf plugins/clipboard_image_paste $ rm -rf plugins/redmine_agile $ rm -rf plugins/redmine_custom_css $ rm -rf plugins/redmine_emojibutton $ rm -rf plugins/redmine_lightbox2
Turn off and disable the old web server for good
$ sudo systemctl stop apache2 $ sudo systemctl status apache2 ● apache2.service - The Apache HTTP Server Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled) Drop-In: /lib/systemd/system/apache2.service.d └─apache2-systemd.conf Active: inactive (dead) since Fri 2023-09-01 15:31:52 PDT; 8s ago Process: 39951 ExecStop=/usr/sbin/apachectl stop (code=exited, status=0/SUCCESS) Process: 36201 ExecReload=/usr/sbin/apachectl graceful (code=exited, status=0/SUCCESS) Process: 5395 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS) Main PID: 765 (code=exited, status=0/SUCCESS) $ sudo systemctl disable apache2 $ sudo systemctl status apache2 ● apache2.service - The Apache HTTP Server Loaded: loaded (/lib/systemd/system/apache2.service; disabled; vendor preset: enabled) Drop-In: /lib/systemd/system/apache2.service.d └─apache2-systemd.conf Active: inactive (dead) since Fri 2023-09-01 15:31:52 PDT; 7min ago Main PID: 765 (code=exited, status=0/SUCCESS)
No comments:
Post a Comment