Want to migrate from Kunena3 to Discourse? Great! Let’s get started.
What data can be imported?
- Topics & Posts
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 bundle install
- Create MySQL user, grants and table.
MYSQLPASSWD=mysqlpassword mysql -u root -p$MYSQLPASSWD <<EOF CREATE USER 'kunena'@'localhost' IDENTIFIED BY 'kunena'; CREATE DATABASE kunena; GRANT ALL PRIVILEGES ON kunena . * TO 'kunena'@'localhost'; FLUSH PRIVILEGES; EOF
- 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 DB_HOST="localhost" export DB_NAME="kunena" export DB_USER="kunena" export DB_PW="kunena" export KUNENA_PREFIX="jos_" # "iff_" sometimes export IMAGE_PREFIX="http://EXAMPLE.com/media/kunena/attachments" export PARENT_FIELD="parent_id" # "parent" in some versions
Use and and to edit the
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
iff_. If that fails too, you will need to inspect the database tables to see what prefix yours uses. This
grepcommand 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_idfield of the category table was
parent. If you get an error about an “unknown column”, change the
This is really going to happen!
Make sure that neither Discourse nor Sidekiq are running.
Clear existing data from your local Discourse instance:
cd ~/discourse 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 localand change
download remote images max days oldto 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!