Chris Hoag's picture

Very limited Linux experience.

Inherited a very old system. Webmin 1.490 on redmine (Ubuntu Linux 8.04.3). Need to upgrade/move/or replace to get in line with a security audit. I found the upgrade all button in the web interface, but it errors out .

Here's a few of the errors.

Err http://archive.ubuntu.com hardy-updates/main Packages
  404 Not Found [IP: 91.189.88.31 80]
Err http://archive.ubuntu.com hardy-updates/universe Packages
  404 Not Found [IP: 91.189.88.31 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/hardy-security/main/binary-i386/Packages.gz  404 Not Found [IP: 91.189.88.31 80]

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/hardy-security/universe/binary-i386/Packages.gz  404 Not Found [IP: 91.189.88.31 80]

I'm thinking since it's so old I'll need to build a new one then export/import the data? Seeking advice on where to find documention. (step by step). If possible.

Forum: 
Jeremy Davis's picture

Yeah that's a really old one; at least 10 years old...

I'm not 100% sure, but I think it shipped with Redmine v0.8. Unfortunately, I'm not super familiar with Redmine, but I've done a few successful upgrade (although none from a version so old) so hopefully I'll be able to assist.

Another unfortunate factor is your timing... I'm just about to take a bit of time off (today is my last day) and I've got a fair few loose ends to tie up, so I don't have time to write up an exhaustive step-by-step for you. I've tried to capture everything but I don't have a system that old to test on and I'm a bit pressed for time anyway. So please consider this more of a rough overview rather than a proper "tutorial". I may log in while I'm away though, so if you hit any issues or anything is too vague or unclear, please post back and perhaps you'll get lucky. Otherwise I'll be back (with a little more time available) on Mon 6th Jan.

Assumptions, context and overview

You didn't note where this particular TurnKey Redmine server is running, but let's assume that it's a local VM (if it's not, it shouldn't matter too much where it's running, but please let me know as perhaps there are some additional considerations?).

Considering the age of this server, I would suggest that the best (and probably least painful) way forward is to migrate the data, rather than trying to update this particular server.

Essentially the process will go something like this (it doesn't neccessarily need to be done in this order, but it's a reasonable order to do them in):

  1. Launch a new TurnKey Redmine server.
  2. (Optional) update to latest Redmine.
  3. Bundle up data from current server.
  4. Transfer data to new server, copy in file, load DB.
  5. Run required commands to update DB, etc.
  6. Celebrate new server!

One additional thing of note is that in this post, I note transferring plugins. Considering the age of your old Redmine, it's highly likely that any plugins you have will not be compatible with the newer version (and will either require you to get a newer version of the plugin or adjust them to be compatible). Regarldess, I'll leave the relevant lines in tact, if you don't have plugins, or want to avoid the risk of the complications that may occur with plugins, it might be better to skip any/all lines that refer to plugins.

Getting set up

The first thing to do is to set yourself up with the required tools. If you're on Windows, make sure that you have an SSH client installed. PuTTY is a good option if you don't already have a preference). If you're on OSX (or Linux - which seems unlikely considering your note about lack of Linux experience) then the built in terminal SSH client should be fine.

FWIW, you could log into the terminal directly (e.g. via the VirtualBox window) or via Webshell (pre-installed on TurnKey), but I strongly recommend use of a proper SSH client. IMO it will give you a much better experience (FYI you can copy text in the PuTTY window via simply selecting it; right click will paste from the system "clipboard" into PuTTY).

The only other thing you'll want is the current version of the TurnKey Redmine appliance (please download the latest version in the appropriate format). Please note that it currently has Redmine v4.0.3 (the latest is v4.0.5). You may wish to also upgrade Redmine while you're at it. If it's publicly accessible (and especially if you allow unknown users to log in), I highly recommend that you do update to the latest version. As you'll be running an upgrade with your old data anyway, we can cheat a bit when it comes to upgrading from v4.0.3 to the latest version.

Set up new v15.x TurnKey Redmine VM

Install TurnKey Linux Redmine to a new VM. It should be fairly straight forward and self explanatory. There is a VirtualBox tutorial on how to do that which may be of some assistance if you're not sure (if you're using some other VM platform, it'll obviously be different, but should still be relevant enough to point you in the right direction). If you have troubles, please post back with details.

Update Redmine on your new server (cheats way) and drop DB

As you'll be running the required upgrade scripts to update your old data anyway, all we really need to do is to download the latest files and put them in place. That will save duplication of steps. There is no need to run a backup, as there isn't any data you need there yet. So log in via SSH as root and download the latest version and unpack to the relevant location:

systemctl stop apache2
mv /var/www/redmine /var/www/redmine.orig
wget https://www.redmine.org/releases/redmine-4.0.5.tar.gz
tar -zxf redmine-4.0.5.tar.gz /var/www
mv /var/www/redmine-4.0.5 /var/www/redmine

Then the last stage of prep is to dump the existing Redmine DB (you'll migrate your old one in later):

for i in test development production; do
    mysql -e "DROP DATABASE IF EXISTS redmine_$i;"
done

Collect data from old server

You'll want to collect your current data from the old server. I'll assume that you're logged in as root. First up, make a directory to dump all the data in:

mkdir ~/redmine-data

Then dump the DB:

mysqldump -u root -p --databases redmine --add-drop-database > ~/redmine-data/redmine.sql

Now tar up attachments/uploaded files (and plugin files if relevant):

tar -czf ~/redmine-data/redmine_files.tar.gz -C /var/www/redmine/files .
tar -czf ~/redmine-data/redmine_plugins..tar.gz -C /var/www/redmine/vendor/plugins .

And assuming that you have some code repos as well:

tar -czf ~/redmine-data/repos.tar.gz  -C /srv/repos .

My reading suggests that you shouldn't need anything else from this old server now, but I would not do anything destructive to it until you are 100% sure that everything is working on the new server. And even then, it may be worth hanging onto it for a few weeks, just in case (even if you stop it; I recommend not destroying it until the new system is bedded in and you are completely sure that everything is as it should be).

Move data to new server

All of these files (i.e. contents of ~/redmine-data/) now need to be be copied to the new server. There are a myriad of ways to do that, but if can access the new server via network, then possibly the easiest is to use scp. Log into your new server via SSH and run:

mkdir ~/redmine-data
scp -r root@OLD_SERVER_IP:~redmine-data/ ~/redmine-data/

Restore data and run upgrades

So now you just need to restore your data and run the Redmine upgrade scripts and hopefully (fingers crossed) you'll be all good.

Restore the DB:

mysql -u root 

Restore the attachments/uploaded files:

tar -xzf ~/redmine-data/redmine_files.tar.gz -C /var/www/redmine/files

Run the DB migration script:

cd /var/www/redmine
bundle exec rake db:migrate RAILS_ENV=production

Optional - Restore the plugin files (if relevant):

tar -xzkf ~/redmine-data/redmine_plugins..tar.gz -C /var/www/redmine/plugins
bundle exec rake redmine:plugins:migrate RAILS_ENV=production

Double check that all dependencies are installed and up to date:

bundle install --without development test

Clean the cache:

bundle exec rake tmp:cache:clear RAILS_ENV=production

Reset the permissions as per default so they're as they should be:

chown -R root:www-data /var/www/redmine
chown -R www-data:www-data /var/www/redmine/tmp
chown -R www-data:www-data /var/log/redmine/
chown -R www-data:www-data /var/www/redmine/files
chown -R www-data:www-data /var/www/redmine/public/plugin_assets

Finally, start up Apache again and fingers crossed, you should be all good! :)

systemctl start apache2

Troubleshooting

TBH, I won't at all be surprised if it isn't that simple, and there are some issues. But I'm hoping...

If it doesn't just work, please share any error messages you get (please give exact, verbatim test of the message) and try to clarify at which step they occur. If you don't get any error messages during the process, but it just doesn't work, please provide the last few lines (perhaps 10-20) of both the Redmine log and the Apache log. This should give me what I'm after (last 20 lines of both files):

tail -20 /var/log/redmine/production.log
tail -20 /var/log/apache2/error.log

Good luck and fingers crossed...

Chris Hoag's picture

Hi Jeremy.

Thanks for the response. No worries on the timing. Enjoy your time off!

To answer your question. It is a VM running in an ESXi environment. I just got tasked with this so it is not very hot right now, so I have some time. You have given me very good info to get started and I hope it goes as smoothly as you you suspect.

Thanks again for the response.

Chris

Add new comment