I recently installed Ubuntu and started using it as an Android development environment, but I was a little troubled because I didn't know how to enable Japanese input with a US keyboard, so I'll write it here as a memorandum.
First, install an input method framework called Fcitx. Open Ubuntu Software, search for and install Fcitx in the upper left.
If this is the case, fcitx cannot be used, so open Setting to enable it. Select Manage Installed Language in Regions & Language in Setting.
When you open this screen, you may be asked to install Language Support, but you cannot change the settings as it is, so install it. You can change the settings, so you can enable Fcitx by changing the Keyboard input method system to fcitx.
This time, I will use Mozc developed by Google as IME. Install Mozc with the following command:
$ sudo apt-get install fcitx-mozc
In this state, Mozc cannot be used, so open Fcitx Configuration and enable Mozc. Select + at the bottom left to start adding the Input Method.
Uncheck Only Show Current Language and enter Mozc to search. Then Mozc will appear, select it and OK. If Mozc doesn't come out, please restart Ubuntu, I didn't get it, but it came out after rebooting.
When you press OK, Mozc is added like this and you can input Japanese.
After that, change the key to switch Japanese input with Trigger Input Method of Global Config if you like.
Fcitx makes it easy to input Japanese with the US keyboard layout. In other articles, there is a method using iBus, but it was difficult because the keyboard layout became Japanese layout. Installation with Fcitx is easy, and if you want to set up any environment, I'd probably use Fcitx.