pkg_add -r xorg install browser
pkg_add -r gnome2 install desktop
pkg_add -r gnome-panel install desktop menu
After installing the desktop, you can only log in with a user other than root. Configure environment variables before logging in
echo "/usr/local/bin/gnome-session" > ~/.xinitrc
Reprinted in: https://www.cnblogs.com/kungfupanda/archive/2010/12/15/1904761.html