1.首先命令行安装汉语语言包
sudo apt-get install language-pack-zh-hans
执行该命令后,系统就会自动安装所需要的汉语语言包
![](https://img-blog.csdnimg.cn/08c8414d047c4a2eacf174e6e0d06af7.png)
2.然后命令行安装谷歌拼音输入法
sudo apt-get install fcitx-googlepinyin
执行该命令后,系统就会自动安装 fcitx 和 goolgepinyin 程序,也同时会安装一些配置 fcitx 的工具
![](https://img-blog.csdnimg.cn/cab3b91cec4d49009169a100d8e60baf.png)
3.安装Fcitx输入法软件,输入如下命令。
sudo apt-get install fcitx
![](https://img-blog.csdnimg.cn/63cb4c81e9ad4559a4d2f0b3c0effbc3.png)
4.配置fcitx。
im-config
![](https://img-blog.csdnimg.cn/428d99d723814c8abc1a667766d90de1.png)
![](https://img-blog.csdnimg.cn/6da6e3309dc24575b5c237ee78e055e1.png)
![](https://img-blog.csdnimg.cn/b08457ca45ef4f588fc281a58e7047b8.png)
![](https://img-blog.csdnimg.cn/1ee45263ee434da2b905d91f3c83ecad.png)
5.重启虚拟机ubuntu系统或者注销用户(建议重启ubuntu系统)。进入界面后可以看到fcitx输入法框架已经运行,系统状态栏的输入法图标已经改变。
6.打开终端,配置googlepinyin输入法,在如图界面进行输入法配置。
fcitx-config-gtk3
![](https://img-blog.csdnimg.cn/414d5d165514472dab9a2c9442ca165e.png)
如图增加谷歌拼音输入法。
![](https://img-blog.csdnimg.cn/c20e83470c034f2e9d7136266c54e93f.png)
7.通过快捷键,ctrl+空格键或左侧shift键进行中文与英文的切换。
![](https://img-blog.csdnimg.cn/75eb2e63041f4c5e890168d9d96b28f7.png)
![](https://img-blog.csdnimg.cn/90ea84b351984663ab9a9ab3e9ec843f.png)