操作系统菜鸟程序员

linux安装vnc连接图形化界面及安装谷歌浏览器

2019-06-24  本文已影响0人  Freeasthew_a098

一、在CentOS 7.2上安装 VNC Server

注:源链接地址--https://help.aliyun.com/knowledge_detail/41530.html?spm=a2c4g.11186623.4.1.30586c09URxLqF
1.远程连接Linux实例
2.运行以下命令安装GNOME桌面。
yum groupinstall GNOME Desktop Environment -y
3.运行以下命令安装VNC Server。
yum install tigervnc-server -y
4.按以下步骤修改VNC Server配置文件,设置用户名(如本示例中的root):
vim /lib/systemd/system/vncserver@.service
将User=<User>、ExecStart和PIDFile的内容替换为以下内容。
User=root
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=-/usr/bin/vncserver -kill %i
ExecStart=/sbin/runuser -l root -c "/usr/bin/vncserver %i"
PIDFile=/root/.vnc/%H%i.pid
5.运行以下命令,将 /lib/systemd/system/vncserver@.service 改为 /lib/systemd/system/vncserver@:1.service。
mv /lib/systemd/system/vncserver@.service /lib/systemd/system/vncserver@:1.service
6.运行以下命令重启systemd。
systemctl daemon-reload
7.运行命令 vncpasswd,并按界面提示设置VNC Server连接密码。
8.(可选)ECS不允许开启SELinux服务和NetworkManager服务。如果您开启了这些服务,运行以下命令修改配置。
vi /etc/selinux/config    # 检查SELinux服务。如果SELINUX对应的值不是disabled,必须改为disabled。
chkconfig --del NetworkManager    # 关闭NetworkManager服务
9.运行以下命令设置开机启动VNC Server。
systemctl enable vncserver@:1.service
10.运行以下命令启动VNC Server。
systemctl start vncserver@:1.service
11.运行命令 ps -ef | grep vnc 确认服务是否已经启动。如果返回以下类似结果,说明服务已经启动。
12.(可选)如果您的实例上开启了防火墙,需要设置防火墙允许VNC访问。
firewall-cmd --permanent --add-service vnc-server #允许VNC访问
systemctl restart firewalld.service # 重启firewalld
13.  登录 [ECS管理控制台](https://ecs.console.aliyun.com/#/home),在实例所在安全组中 [添加安全组规则](https://help.aliyun.com/document_detail/25471.html),放行TCP 5901端口。
14.  在本地机的VNC Viewer上连接实例。具体操作步骤,请参考 [在 Linux 实例上自动安装并运行 VNC Server](https://help.aliyun.com/document_detail/41181.html) 的描述。如果出现如下图所示的界面,说明您已经成功安装VNC Server实现了图形化访问。

二、安装chrome浏览器

1.首先进入根目录,然后进入etc/yum.repos.d目录下,创建google-chrome.repo文件
cd /
cd etc/yum.repos.d
vim google-chrome.repo
2.在文件中添加:
[google-chrome] 
name=google-chrome 
baseurl=http://dl.google.com/linux/chrome/rpm/stable/$basearch 
enabled=1
gpgcheck=1 
gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub
3.加入谷歌的源之后
yum -y install google-chrome-stable --nogpgcheck
安装完成。
在应用程序的互联网中就可以找到 谷歌浏览器了。
4.这个时候有可能打不开谷歌浏览器   确切的说启动过程中会自动关闭,如果出现这种情况,请参考以下办法:
[root@localhost bin]# /usr/bin/google-chrome
[8239:8239:1230/172329.621009:ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
(1)ssh命令行
所以想办法在启动中去除sandbox即可
root@localhost bin]# google-chrome --no-sandbox
(google-chrome:8256): Gtk-WARNING **: 17:23:48.733: cannot open display: 
[1230/172348.742570:ERROR:nacl_helper_linux.cc(310)] NaCl helper process running without a sandbox!
Most likely you need to configure your SUID sandbox correctly
上段提示,没有display,原因是我们执行ssh,不就是gui
(2)GUI里
在快捷方式属性里,后面加上 --no-sandbox就行了
(3)如果使用robotframework执行机、远程selenium server 上的chrome,则会需要改chrome的启动参数
启动文件位置:/opt/google/chrome/google-chrome
翻到最后,修改如下:
#exec -a "$0" "$HERE/chrome" "$@"
exec -a "$0" "$HERE/chrome"  "$@" --no-sandbox $HOME
这样就能远程调用chrome的执行机了
原文:https://www.cnblogs.com/sxdcgaq8080/p/7517357.html
原文:https://blog.csdn.net/weixin_41357300/article/details/85398441 


上一篇下一篇

猜你喜欢

热点阅读