Want to migrate from Kunena3 to Discourse? Great! Let's get started.
Note: @tarek's fine work on this topic was replaced wholesale after @pfaffman made considerable changes to the importer. Do not blame @tarek for mistakes!
What data can be imported?
- Topics & Posts
Set up Discourse development environment on OS X, Ubuntu or Windows.
Install MySQL or MariaDB
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install mariadb-server libmysqlclient-dev
sudo gem install mysql2
- Add MySQL to the Gemfile and install it
echo "gem 'mysql2'" >> Gemfile
- Create MySQL user, grants and table.
mysql -u root -p$MYSQLPASSWD <<EOF
CREATE USER 'kunena'@'localhost' IDENTIFIED BY 'kunena';
CREATE DATABASE kunena;
GRANT ALL PRIVILEGES ON kunena . * TO 'kunena'@'localhost';
- Import your Kunena / Joomla installation
mysql -u kunena -pkunena < mykunena.sql
Readying the Script for the import
Copy and paste these lines into your shell:
export KUNENA_PREFIX="jos_" # "iff_" sometimes
export PARENT_FIELD="parent_id" # "parent" in some versions
Use and and to edit the
DB variables appropriately.
The Kunena tables are prefixed with
jos_ in some cases, and with
iff_ in others. If the import script fails for you with an error like "unknown column", hit the and change the
KUNENA_PREFIX variable to
iff_. If that fails too, you will need to inspect the database tables to see what prefix yours uses. This
grep command will give you a list of tables in the database:
grep "CREATE TABLE" mykunena.sql
Kunena3 attachments have a URL like this:
Edit that variable too.
- Parent field. In some versions, the
parent_id field of the category table was
parent. If you get an error about an "unknown column", change the
PARENT_FIELD to "parent".
This is really going to happen!
Make sure that neither Discourse nor Sidekiq are running.
Clear existing data from your local Discourse instance:
rake db:drop db:create db:migrate
Run the import script:
Wait until the import is done. You can restart the process if it slows down to a crawl.
Start your Discourse instance:
RAILS_ENV=development bundle exec rails server
Start Sidekiq and let it do its work:
bundle exec sidekiq -q critical,4 -q default,2 -q low
Depending on your forum size this can take a long time. You can monitor the progress at http://localhost:3000/sidekiq
If you want Discourse to copy the images to its own database, in your Discourse settings, enable
download remote images to local and change
download remote images max days old to a sufficiently large value, then
Take backup of the data and upload it to on your production site by following this howto.
@tarek's known issues (2016-05-05)
If, like us, you had a very old Kunena installation that spanned several generations, then you may run into two problems:
- Users are not properly imported for very old posts
- BBCode makes its way into the posts.
It was very time-consuming, but I hand-fixed these. There is some code in the PHPBB import scripts that addresses BBCode -> MD conversion, but I didn't spend much time on it.
Congratulations! You have successfully migrated your site from Kunena3 to Discourse!