Linux VNC安装
cat /etc/centos-release
CentOS Linux release 7.4.1708 (Core)
uname -r
3.10.0-693.el7.x86_64
VNC下载:https://www.realvnc.com/en/connect/
#!/bin/bash
set -x
set -e
yum groups -y install "X Window System"
yum -y install gnome-classic-session gnome-terminal nautilus-open-terminal control-center liberation-mono-fonts kde-l10n-Chinese ibus-libpinyin
systemctl set-default graphical.target
yum -y install tigervnc-server
cp /lib/systemd/system/vncserver\@.service /etc/systemd/system/vncserver@:1.service
sed -i "s/<USER>/root/g" /etc/systemd/system/vncserver@:1.service
echo "VNCSERVERS=\"1:root\"">> /etc/sysconfig/vncservers
echo "VNCSERVERARGS[1]=\"-geometry 1366x768 -nolisten tcp\"" >> /etc/sysconfig/vncservers
vim /etc/systemd/system/vncserver\@\:1.service
将原来的 Type=forking 改成 Type=simple #该步就手动做吧 没来得及写自动替换
cp /etc/locale.conf /etc/locale.conf.bak
sed -i "s/^LANG=/#LANG=/" /etc/locale.conf
echo "LANGUAGE=\"zh_CN.UTF-8:zh_CN.GB2312:zh_CN\"" >> /etc/locale.conf
echo "SUPPORTED=\"zh_CN.UTF-8:zh_CN:en_US.UTF-8:en_US:en\"" >> /etc/locale.conf
echo "SYSFONT=\"lat0-sun16\"" >> /etc/locale.conf
yum -y install epel-release
yum -y groupinstall xfce
yum -y install ibus ibus-libpinyin ibus-gtk2 ibus-gtk3 im-chooser gtk2-immodule-xim gtk3-immodule-xim
vncpasswd <<EOF
123456
123456
y
123456
123456
EOF
if [ $? -eq 0 ];then
systemctl daemon-reload
systemctl start vncserver@:1.service
vncserver >> ~/1.txt 2>&1
a=`cat ~/1.txt|grep ^New|awk -F ':' '{print $2}'|awk -F ' ' '{print $1}'`
echo -e "\033\31m在win端的vnc上连接方式为: ip地址:$a \033[0m"
else
echo -e "\033[31m设置密码未成功,故vnc没重加载和启动\033[0m"
fi
新版本rpm方式安装:
wget https://www.realvnc.com/download/file/vnc.files/VNC-Server-6.4.1-Linux-x86.rpm
yum -y install VNC-Server-6.4.1-Linux-x86.rpm
欢迎加入QQ群一起讨论Linux、开源等技术