Install fcitx:

then put the following lines at the end of ~./bashrc:

export LC_CTYPE=”zh_CN.utf8″
export XMODIFIERS=”@im=fcitx”
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx

open a new bash shell and test if it works:
killall fcitx
fcitx &

for autostarting fcitx, copy /usr/share/applications/fcitx.desktop to ~/.config/autostart/, under KDE, GNOME, XFCE, , LXDE, or any other XDG compatible environment.

see also this: