Ubuntu安装桌面环境

在命令环境下运行如下命令:

  apt-get update //更新软件库

  apt-get upgrade //升级软件

  apt-get install ubuntu-desktop //安装Ubuntu桌面系统

    安装时间有点长,需要耐心等待。
    
    reboot重启后发现桌面环境不能使用root账户登录.

    重启然后使用Ctrl + Alt + F1 进入命令行使用root登陆

    运行命令

    sudo vi /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf     //打开50-ubuntu.conf

    在末尾添加

        greeter-show-manual-login=true      //允许切换用户登陆
    
        allow-guest=false    //禁用Guest   

完整代码

    [Seat:*]
    user-session=ubuntu
    greeter-show-manual-login=true
    allow-guest=false

保存重启(在VI模式下编辑完成后使用Esc键切换到末行模式,然后输入:wq退出编辑)发现root用户登陆后还是有警告

修改/root/.profile文件 (图形界面下修改请勾选显示隐藏文件)
    
将mesg n 替换为 tty -s && mesg n

完整代码

# ~/.profile: executed by Bourne-compatible login shells.
if [ "$BASH" ]; then
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
fi
tty -s && mesg n || true

保存后重启即可完美在桌面环境登陆root

posted @ 2018-03-29 17:29  SpringCore  阅读(28522)  评论(2编辑  收藏  举报