Answering my own question:
Instead of the original command, the following command works:
sudo bundle exec /usr/bin/rake db:migrate RAILS_ENV=production
This led to the following error:
rake aborted!
Gem::LoadError: Specified 'mysql2' for database adapter, but the gem is not loaded. Add `gem 'mysql2'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).
To resolve this:
sudo apt-get install mysql-client libmysqlclient-dev ruby-dev libgmp-dev build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libxml2-dev autoconf libc6-dev ncurses-dev automake libtool
sudo gem install mysql2
I also updated /usr/share/redmine/GemFile and added this line below the initial gem declarations:
gem "mysql2"
Also, when you install redmine it gives you an option to configure a database. Select 'No'. If you chose, 'Yes' then you need to delete the database that redmine created during install process and create a database manually. The following lines assume that you created a backup of your old database and the dumpfile is called /home/ubuntu/redmine
mysql -u root -p
mysql> create database redmine2 DEFAULT CHARACTER SET utf8;
grant all on redmine2.* TO 'redmine'@'%' IDENTIFIED BY 'password';
mysql> connect redmine2
mysql> source /home/ubuntu/redmine
After this you will need to modify /etc/redmine/default/database.yml to update the name of the database/username/password
After all this, I started getting passenger errors while trying to access redmine URL. I had to undo the change in /usr/share/redmine/GemFile. There were some file permission issues as well. Hope this helps someone.