How do I change default keyboard layout (not input method) in Ubuntu 16.04?

When I installed 16.04, I mistakenly chose the German keyboard layout. My computer is a Japanese computer with Japanese keys, but I regularly use several languages. How can I change the default system layout for all of my languages without reinstalling the OS? I cannot for the life of me find a GUI or CLI way to do this. Many thanks for your help.


Solution 1:

In a shell:

sudo dpkg-reconfigure keyboard-configuration

Solution 2:

I'm not able to reproduce the problem you have mentioned in comments, i.e. that enabling a Japanese keyboard layout wouldn't make a difference. I added Japanese, and the resulting keyboard layout looks like this:

Japanese keyboard layout

Then I opened gedit, switched to "Ja" via the input source indicator, and the expected characters according to the image above appeared when I typed.

Solution 3:

Install "Japanese iBus MOZC" Keyboard:

sudo apt-get install ibus-mozc mozc-server mozc-utils-gui

Re-login (this is important!) and find mozc in System Settings -> Text Entry when you click the + button.

If "your" Japanese is not listed, enter this command in shell

im-config 

After that you should have these Japanese keyboard input sources in Text Entry when you click the + button: Japanese (Dvorak), Japanese (Kana), Japanese (Kana 86), Japanese (Macintosh), Japanese (Mozc)(IBus), Japanese (OADG 109A), Japanese (PC-98xx Series)