Complete CentOS7 configuration VNC Server+openbox in 4 minutes

Preface

Why use openbox as a desktop? Because it is short and capable!
Didn't understand the article? Let's take a look at how the video works!
Station B:
https://www.bilibili.com/video/BV1Mh411C71D/

One-click installation and configuration

Root executes the following commands, and just copy and paste them into the terminal as a whole (do not copy line by line)

#图形界面必备`X Window System`
yum -y groupinstall "X Window System"
#安装epel源
yum -y install epel-release
#安装VNC+图形需要的软件
yum -y install tigervnc-server openbox xfce4-terminal tint2 cjkuni-ukai-fonts network-manager-applet
#自动修改/etc/xdg/openbox/autostart配置文件
echo 'if which dbus-launch >/dev/null && test -z "$DBUS_SESSION_BUS_ADDRESS"; then' > /etc/xdg/openbox/autostart
echo '       eval `dbus-launch --sh-syntax --exit-with-session`' >> /etc/xdg/openbox/autostart
echo 'fi' >> /etc/xdg/openbox/autostart
echo 'tint2 &' >> /etc/xdg/openbox/autostart
echo 'nm-applet  &' >> /etc/xdg/openbox/autostart
echo 'xfce4-terminal &' >> /etc/xdg/openbox/autostart
echo ' ' >> /etc/xdg/openbox/autostart
#防火墙放行VNC端口
firewall-cmd --add-port=5901/tcp
firewall-cmd --add-port=5901/tcp --permanent

Create user

For safety reasons, it is not recommended to use root as the vnc user. It is safer to create a user separately.
Here I use oracle as the user name, so I can modify it by myself. Why is it called oracle? Because I only use VNC graphical operations when installing oracle.

Root executes the following commands, and just copy and paste them into the terminal as a whole (do not copy line by line)

#创建database用户组
groupadd database
#创建oracle用户并放入database组中
useradd oracle -g database
#设置oracle密码
passwd oracle 

The password I set isdatabase@2021

Turn on VNC service

Switch to oracle user

su oracle
#首次运行,生成~/.vnc/xstartup等配置文件
vncserver :1 -geometry 1024x768

The password I set here is for the vnc@2021
oracle user to execute the following command, and just copy and paste it into the terminal as a whole (do not copy line by line).

#配置VNC默认启动openbox
echo "openbox-session &" > ~/.vnc/xstartup
# 停止服务
vncserver -kill :1
#重新开启vnc服务
vncserver :1 -geometry 1024x768

Client connects to VNC to realize remote control

Just connect with your VNC client, so skip it if you will.
What I use is: VNC Viewer click to download
My address is as follows:

172.16.184.5:5901

Insert picture description here
Then enter the connection password set above. The password I set here isvnc@2021

If you find that there is no interface when you connect, and there is only one mouse with a black screen, then you can restart the VNC service and try.
Switch to the oracle user su oracle
command:

vncserver -kill :1
vncserver :1 -geometry 1024x768

to sum up

Is not it simple!

If you need a more detailed tutorial, please see:
"Centos7 Installation and Configuration of VNC Server-Openbox"
https://blog.csdn.net/lxyoucan/article/details/113210891

Guess you like

Origin blog.csdn.net/lxyoucan/article/details/113389124