Как в Oracle Linux запустить VNC-сервер
Как в Oracle Linux запустить VNC-сервер
Для удаленного администрирования Oracle Linux удобно использовать инструменты с графическим интерфейсом. Например, VNC-сервер.
Ниже описана последовательность действий для запуска:
- Устанавливаем VNC-сервер:
- Задаем пароль для подключения:
- Редактируем конфигурационный файл /etc/sysconfig/vncservers
В файле раскомментируем строку вместо myusername пишем имя пользователя. Добавляем строку - Запускаем VNC-сервер и добавляем его в автозагрузку
- Проверяем какой порт слушает VNC-сервер, в моем случае это 5902
- На Firewall открываем порт для VNC-сервера.
- На компьютере с MS Windows устанавливаем клиента, например realvnc (www.realvnc.com).
- Запускаем realvnc в строке соединения пишем . Напрмер 192.168.10.2:5902.
Простейшая настройка VNC-сервера более чем проста и не требует особых админских танцев с бубном.
Внимание.
Комментировать могут только зарегистрированные пользователи.
Возможно использование следующих HTML тегов: , , ,
.
Oracle Linux: Install the VNC Remote Access Server
Before You Begin
This tutorial shows you how to install and set up the VNC remote access server software on an Oracle Linux 8 system to enable you to remotely operate a graphical desktop environment.
Background
Virtual Network Computing (VNC) is a graphical desktop sharing system that controls remote machines by sending keyboard and mouse events over the network. VNC is particularly useful for remotely controlling Oracle Linux servers that have a graphical desktop environment installed.
You can connect to a VNC server by using any compatible software client. VNC is suitable for thin client computing where multiple dumb terminals can share the same hardware resources that are hosted on an Oracle Linux server.
This tutorial uses TigerVNC to illustrate how to remotely connect to systems. However, you can use a different VNC software of your choice. Some alternative software is listed at the end of the tutorial.
What Do You Need?
Install a graphical desktop environment
Install a GNOME desktop environment and all of its dependencies.
Set graphical mode as the default login type for user accounts, then reboot the server.
Uncomment the following line in the /etc/gdm/custom.conf file to ensure that VNC uses X.org instead of Wayland:
Install the VNC packages
Install the VNC server package and all of its dependencies.
Set the VNC password
Create a VNC password for the user account that you intend to use for remote sessions.
Create the VNC server configuration file
As the root user, create the /etc/systemd/system/vncserver@.service file and populate it with the following content. Replace username with the user for which you just set a VNC password.
Set up the VNC service
Reload the systemd service, then enable and start the VNC server by using X Server display 1:
Configure firewall rules (Optional)
If you are using a custom firewall profile or an Oracle Cloud Infrastructure instance, open the firewall port for the VNC service (5901). Then, reload the default firewall service.
Open a VNC client and test your deployment
On the client machine, use the VNC software to connect to the remote Oracle Linux server domain or IP address. Make sure to specify the correct port. The default VNC port is 5900, but that number is incremented according to the configured display number. Thus, display 1 corresponds to 5901, display 2 to 5902, and so on.
If you encounter connectivity problems, troubleshoot these issues by connecting to the remote server over an SSH connection that has been configured with X11 forwarding enabled. Then, use the tigervnc package to connect a VNC client to the local host:
Oracle linux vnc server
To configure a VNC server:
Install the tigervnc-server package:
Create the VNC environment for the VNC users.
Each VNC desktop on the system runs a VNC server as a particular user. This user must be able to log in to the system with a user name and either a password or an SSH key (if the VNC desktop is to be accessed through an SSH tunnel).
Use the vncpasswd command to create a password for the VNC desktop. The password must be created by the user that runs the VNC server and not root , for example:
The password must contain at least six characters. If the password is longer than eight characters, only the first eight characters are used for authentication. An obfuscated version of the password is stored in $HOME/.vnc/passwd unless the name of a file is specified with the vncpasswd command.
Create a service unit configuration file for each VNC desktop that is to be made available on the system.
Copy the vncserver@.service template file, for example:
where display is the unique display number of the VNC desktop starting from 1. Use a backslash character ( \ ) to escape the colon ( : ) character.
Each VNC desktop is associated with a user account. For ease of administration if you have multiple VNC desktops, you can include the name of the VNC user in the name of the service unit configuration file, for example:
Edit the service unit configuration files.
Replace any instances of with the user name of the user that will run the VNC desktop, for example:
Optionally, you can add command-line arguments for the VNC server. In the following example, the VNC server only accepts connections from localhost , which means the VNC desktop can only be accessed locally or through an SSH tunnel; and the size of the window has been changed from the default 1024×768 to 640×480 using the geometry flag:
Start the VNC desktops.
Make systemd reload its configuration files:
For each VNC desktop, start the service, and configure the service to start following a system reboot. Remember that if you specified a username in the name of the service unit configuration file, you must specify this. Equally, you should use the same display number that you specified for the service unit configuration file name. For example:
If you make any changes to a service unit configuration file, you must reload the configuration file and restart the service.
Configure the firewall to allow access to the VNC desktops.
If users will access the VNC desktops through an SSH tunnel and the SSH service is enabled on the system, you do not need to open additional ports in the firewall. SSH is enabled by default. For information on enabling SSH, see Section 27.3, “Configuring an OpenSSH Server”.
If users will access the VNC desktops directly, you must open the required port for each desktop. The required ports can be calculated by adding the VNC desktop service display number to 5900 (the default VNC server port). So if the display number is 1, the required port is 5901 and if the display number is 67, the required port is 5967.
To open ports 5900 to 5903, you can use the following commands:
To open additional ports, for example port 5967, use the following commands:
Configure the VNC desktops.
By default, the VNC server runs the user’s default desktop environment. This is controlled by the VNC user’s $HOME/.vnc/xstartup file, which is created automatically when the VNC desktop service is started.
If you did not install a desktop environment when you installed the system (for example because you selected Minimal Install as the base environment), you can install one with the following command:
When the installation is complete, use the systemctl get-default command to check that the default system state is multi-user.target (multi-user command-line environment). Use the systemctl set-default command reset the default system state or to change it to the graphical.target (multi-user graphical environment) if you prefer.
The $HOME/.vnc/xstartup file is a shell script that specifies the X applications to run when the VNC desktop is started. For example, to run a KDE Plasma Workspace, you could edit the file as follows:
If you make any changes to a user’s $HOME/.vnc/xstartup file, you must restart the VNC desktop for the changes to take effect:
See the vncserver(1) , Xvnc(1) , and vncpasswd(1) manual pages for more information.
Copyright В© 2014, 2019, Oracle and/or its affiliates. All rights reserved. Legal Notices
How to configure VNC Server on Oracle Linux 6
Here is a short howto on configuring VNC server for Oracle Linux 6.
1. Check if the server is connected to Oracle Linux yum server Or ULN to avoid the dependency issue.
2. Install the vnc server RPMs:
This installs latest version of RPMs: tigervnc-server-module, tigervnc and tigervnc-server.
3. Edit the “/etc/sysconfig/vncservers” file to configure the required displays. The following entries enable VNC for display numbers “:2” and “:3“. Notice multiple “display:user” pairs are defined on a single line, but the arguments for each display are defined separately.
4. Set the VNC password for any users defined in the “/etc/sysconfig/vncservers” file.
5. Enable the “vncserver” service for autostart and start the service :
6. Run commandto start or stop the vncserver :
Install vnc viewer in client machine then try to access the vncserver.
Configuring VNC Server on Linux
sysvint (Original Method)
The sysvinit method works for RHEL and it’s clones (Oracle Linux and CentOS) up to and including RHEL6. It also works for Fedora up to and including Fedora 15. Although Fedora 15 includes systemd, the VNC server configuration is unchanged, so you should still use this method.
Install the VNC Server.
Edit the «/etc/sysconfig/vncservers» file to configure the required displays. The following entries enable VNC for display numbers «:2» and «:3». Notice multiple «display:user» pairs are defined on a single line, but the arguments for each display are defined separately.
Set the VNC password for any users defined in the «/etc/sysconfig/vncservers» file.
Enable the «vncserver» service for autostart and start the service.
You should now be able to use a VNC viewer to connect to system using the display numbers and passwords defined.
Use the following commands to stop the service and disable autostart.
systemd (New Method)
The systemd method works for Fedora 16 and above. Although Fedora 15 uses systemd, the VNC server configuration is unchanged so you still use the previous configuration method. This method also works for RHEL7/OL6/CentOS7.
Install the VNC Server.
Create a new configuration file for each of the display numbers you want to enable. In the following case, I am setting up the display number «:3». Notice how the display number is included in the configuration file name. In some Fedora releases they suggest not including the display number, as systemd will spawn correct config in memory on first request.
Edit the new configuration file, amending the user and startup arguments as necessary. An example of the changed lines is shown below. All other lines should be unmodified. The geometry is set below, but this line doesn’t have to be modified if the default geometry of «1280×1024» is acceptable.
Run the following command.
Set the VNC password for the user defined in the new configuration file.
Enable the service for autostart and start the service.
You should now be able to use a VNC viewer to connect to system using the display number and password defined.
Use the following commands to stop the service and disable autostart.
VNC Clients
Once your VNC server is configured, you can connect to it from any VNC server. On Linux this will often be TigerVNC, installed using the following command.
Connect to a VNC server using the following command.