In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how CentOS7 installs the GUI interface and remote connections. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Crawl data with selenium technology based on browser (webdriver), so the program needs to run in GUI environment
Install the GUI interface
The images provided by most CVM vendors do not have a GUI interface, so you need to install a graphical environment first. This article uses the GNOME desktop environment:
Yum-y groups install "GNOME Desktop"
This command will install the necessary software packages for the GNOME desktop, and configure the X system to use GNOME after execution:
Echo "exec gnome-session" > > ~ / .xinitrc
The two commands to install the KDE or MATE desktop environment are slightly different:
# kdeyum-y groups install "KDE Plasma Workspaces" echo "exec startkde" > ~ / .xinitrc # mateyum-enablerepo=epel-y groups install "MATE Desktop" echo "exec / usr/bin/mate-session" > > ~ / .xinitrc
The GUI desktop environment is installed above.
There are two ways to start a desktop environment:
Disposable: enter startx in the terminal
Enter the desktop environment by default when the system starts: systemctl set-default graphical.target, and then restart
Install vnc-server
With a desktop environment, you can generally access the desktop through a remote connection to the web terminal provided by the CVM manufacturer. You need to open a browser every time you use a web terminal, and then log in to the cloud management background to connect, which is more troublesome. We adopt the way of connecting remotely from the desktop client directly, eliminating the need to open the browser and log in to the cloud management background.
There are many remote desktop technologies, such as VNC, TeamViewer, RDP and so on. This article uses free and widely used VNC.
Install the server first on the server (tigervnc is a branch of tightvnc):
Yum install-y tigervnc-server
Then make a copy of the VNC configuration:
Cp / lib/systemd/system/vncserver@.service / etc/systemd/system/vncserver@:1.service
Note that the above command parameter heavy "@: 1", you can change the number 1 to any number within 30000, "5900 + number" is the program display (listening) port, such as "@: 1" means listening to port 5901.
Edit the configuration file to replace the login user name in the file with the login user name of the remote connection (if it is root, note that the "/ home" of the second line is removed). Example of configuration as root:
# The vncserver service unit file## Quick HowTo:# 1. Copy this file to / etc/systemd/system/vncserver@.service# 2. Replace with the actual user name and edit vncserver# parameters appropriately# (ExecStart=/usr/sbin/runuser-l-c "/ usr/bin/vncserver% I" # PIDFile=/home//.vnc/%H%i.pid) # 3. Run `systemctl daemon- reload` # 4. Run `systemctl enable vncserver@: .service` # # DO NOT RUN THIS SERVICE if your local area network is# untrusted! For a secure way of using VNC, you should# limit connections to the localhost and then tunnel from# the machine you want to view VNC on (hostA) to the machine# whose VNC output you want to view (hostB) # # [user@hostA ~] $ssh-v-C-L 590N:localhost:590M hostB## this will open a connection on port 590N of your hostA to hostB's port 590M# (in fact It ssh-connects to hostB and then connects to localhost (on hostB). # See the ssh man page for details on port forwarding) # # You can then point a VNC client on hostA at vncdisplay N of localhost and with# the help of ssh, you end up seeing what hostB makes available on port 590M## Use "- nolisten tcp" to prevent X connections to your VNC server via TCP.## Use "- localhost" to prevent remote VNC clients connecting except when# doing so through a secure tunnel. See the "- via" option in the# `man vncviewer' manual page. [unit] Description=Remote desktop service (VNC) After=syslog.target network.target [Service] Type=forking# Clean any existing files in/ tmp/.X11-unix environmentExecStartPre=/bin/sh-c'/ usr/bin/vncserver-kill% I > / dev/null 2 > & 1 | |: 'ExecStart=/usr/sbin/runuser-l root-c "/ usr/bin/vncserver% I" PIDFile=/root/.vnc/%H%i.pidExecStop=/bin/sh-c' / Usr/bin/vncserver-kill% I > / dev/null 2 > & 1 | |:'[Install] WantedBy=multi-user.target
Next, set the vnc connection password:
Vncpasswd
Note that the connection password is different from the login password: the connection password is used to display the remote desktop and the login password is used for the user to log in to the system.
Once set up, start the vnc service:
Systemctl daemon-reloadsystemctl start vncserver@:1systemctl enable vncserver@:1
If the firewall is turned on, pay attention to release the appropriate port.
Client connection
After the server is configured, then connect with the client.
Vnc is a free technology and is supported by many clients. This article uses the free "Remote Desktop-VNC" software on App Store to connect, and the software interface is as follows:
Enter the server address: vnc://ip:port, where ip is the ip or domain name of the server, and port is the listening port, for example, 5901. Enter and press enter, the password input box pops up, and enter the password set by vncpasswd. If the password is correct, you can see the graphical desktop of the server, for example:
Press enter to enter the login interface and enter the login user name and password to enter the system:
Then you can do a variety of graphic operations.
Thank you for reading! This is the end of the article on "how to install the GUI interface and remote connection in CentOS7". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.