CentOs7 安装KDE桌面 VNC SERVER CHROME

2018/11/12 17:48 下午 posted in  CentOs

安装KDE桌面

yum groupinstall "KDE Plasma Workspaces"
yum install ibus-table-chinese.noarch kde-l10n-Chinese.noarch
yum install ibus-libpinyin

设置启动进入KDE

# 查询默认终端命令 multi-user.target 相当于以前的 level 3,也就是命令行终端;而 graphical.target 相当于以前的 level 5,也就是图形界面
systemctl get-defaul

# 设置默认启动图型界面
systemctl set-default graphical.target

安装VNC

yum install tigervnc
yum install tigervnc-server

配置VNC SERVER

# 配置窗口一
tee /usr/lib/systemd/system/vncserver@:1.service <<-'EOF'
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target
[Service]
Type=forking
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/sbin/runuser -l root -c "/usr/bin/vncserver %i"
PIDFile=/root/.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
[Install]
WantedBy=multi-user.target
EOF

# 加载配置
systemctl daemon-reload

启用配置文件

# 设置密码
vncpasswd

# 启动服务
systemctl start vncserver@:1.service

# 查看服务状态
systemctl status vncserver@:1.service

# 开机自启动
systemctl enable vncserver@:1.service

如Type=forking报错 上面配置文件改为Type=simple

[Service]
Type=simple

vnc viewer客户端连接黑屏

chmod 777 /root/.vnc/xstartup

加入防火墙

# 开启防火墙
systemctl start firewalld
# 自启动防火墙
systemctl enable firewalld
# 添加窗口一用的5901端口
firewall-cmd --add-port=5901/tcp --permanent
# 重载防火墙
sudo firewall-cmd --reload

安装CHROME

CentOS/RedHat 7以上安装google-chrome可以完全参考https://intoli.com/blog/installing-google-chrome-on-centos/

# This installs Chrome on any RHEL/CentOS/Amazon Linux variant.
curl https://intoli.com/install-google-chrome.sh | bash

安装完成会显示 Successfully installed Google Chrome!

检查是否还缺乏依赖

ldd /opt/google/chrome/chrome | grep "not found"

返回为空,说明CentOS下chrome依赖问题基本解决。

不允许ROOT权限启动

修改/usr/bin/google-chrome文件 最下面

# Note: exec -a below is a bashism.
exec -a "$0" "$HERE/chrome"  "$@" 
# Note: exec -a below is a bashism.
exec -a "$0" "$HERE/chrome" "$@" --no-sandbox --user-data-dir