Serveur VNC sous Debian LennyMettre en fonction l'interface graphique sous Lenny.
La GUI sur les VMs Debian Lenny s'obtient par installation et la configuration d'un serveur VNC.1. Installez votre VM Lenny avec avec Gnome en gestionnaire de fenetre (c'est déjà le cas si vous avez utilisé l'iso_xen)
2. Installer Xvnc server via apt-get (la aussi ce doit déjà être le cas)
sinon
- Code:
-
aptitude install vnc4server
3. Entrez un mot de passe VNC (ne pas en mettre est un sérieux problème de sécurité) grâce à la commande vncpasswd,
avec un fichier dans lequel écrire les informations.
For example:
- Code:
-
vncpasswd /etc/vncpass
4. Modifiez votre fichier gdm.conf (/etc/gdm/gdm.conf)Pour configurer VNC de sorte à être votre affichage par défaut en
ajoutant dans la section [servers]:
- Code:
-
sudo nano /etc/gdm/gdm.conf
- Code:
-
[servers]
0=VNC
[server-VNC]
name=VNC
command=/usr/bin/Xvnc -geometry 800x600 -PasswordFile /etc/vncpass BlacklistTimeout=0
flexible=true
5. Redémarrez GDM, puis attendez que Xencenter détecte le changement:
- Code:
-
/etc/init.d/gdm restart
Note
Vous pouvez vérifier l'état du serveur VNC grâce à cette commande
- Code:
-
ps ax | grep vnc
To avoid receiving the message There is no public key available for the following key
IDs when running apt-get update, run the following command to download the appropriate key:
- Code:
-
wget -O - \ http://updates-int.uk.xensource.com/XenServer/5.5.0/GPG-KEY \
| sudo apt-key add -
Serveur VNC sous Cent Os 5.5bientot la traduction 1. Installing the required packages
The server package is called 'vnc-server'. Run the command
- Code:
-
rpm -q vnc-server
The result will be either package vnc-server is not installed or something like vnc-server-4.0-11.el4.
If the server is not installed, install it with the command:
- Code:
-
yum install vnc-server
The client program is 'vnc'. You can use the command
- Code:
-
yum install vnc
to install the client if
- Code:
-
rpm -q vnc
shows that it is not already installed.
Make sure to install a window manager in order to get a normal GUI desktop.
- Code:
-
rpm -q gdm
You can use the command
- Code:
-
yum groupinstall GNOME Desktop Environment
to install the Gnome Desktop and requirements, for example. Other popular desktop environments are "KDE" and "XFCE-4.4". XFCE is more light-weight than Gnome or KDE and available from the "extras" repository.
If you are running CentOS 5, yum groupinstall "GNOME Desktop Environment" may complain about a missing libgaim.so.0. This is a known bug. Please see CentOS-5 FAQ for details.
2. Configuring un-encrypted VNC
We will be setting up VNC for 3 users. These will be 'larry', 'moe', and 'curly'.
You will perform the following steps to configure your VNC server:
Create your VNC users.
Set your users' VNC passwords.
Edit the server configuration.
Create and customize xstartup scripts.
Start the VNC service.
Test each VNC user.
Setup the VNC service to start on reboot.
Additional optional enhancements
2.1. Create your VNC users
As root:
- Code:
-
$ su -
# useradd larry
# useradd moe
# useradd curly
# passwd larry
# passwd moe
# passwd curly
2.2. Set your users' VNC passwords
Login to each user, and run
- Code:
-
vncpasswd
This will create a .vnc directory.
- Code:
-
[~]$ cd .vnc
[.vnc]$ ls
passwd
2.3. Edit the server configuration
Edit /etc/sysconfig/vncservers, and add the following to the end of the file.
- Code:
-
nano /etc/sysconfig/vncservers
- Code:
-
VNCSERVERS="1:larry 2:moe 3:curly"
VNCSERVERARGS[1]="-geometry 640x480"
VNCSERVERARGS[2]="-geometry 640x480"
VNCSERVERARGS[3]="-geometry 800x600"
Larry will have a 640 by 480 screen, as will Moe. Curly will have an 800 by 600 screen.
2.4. Create xstartup scripts
We will create the xstartup scripts by starting and stopping the vncserver as root.
- Code:
-
# /sbin/service vncserver start
# /sbin/service vncserver stop
Login to each user and edit the xstartup script. To use Larry as an example, first login as larry
- Code:
-
[~]$ cd .vnc
[.vnc] ls
mymachine.localnet:1.log passwd xstartup
Edit xstartup. The original should look like:
- Code:
-
#!/bin/sh
# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &
Add the line indicated below to assure that an xterm is always present, and
uncomment the two lines as directed if you wish to run the user's normal desktop window manager in the VNC. Note that in the likely reduced resolution and color depth of a VNC window the full desktop will be rather cramped and a look bit odd. If you do not uncomment the two lines you will get a gray speckled background to the VNC window.
- Citation :
- #!/bin/sh
# Add the following line to ensure you always have an xterm available.
( while true ; do xterm ; done ) &
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &
2.5. Start the VNC server
Start the vncserver as root.
- Code:
-
# /sbin/service vncserver start
To configure VNC on Red Hat VMs, you need to modify the GDM configuration. The GDM configuration
is held in a file whose location varies depending on the version of Red Hat Linux you are using. Before
modifying it, first determine the location of this configuration file; this file will then be modified in a number
of subsequent procedures in this section.
Determining the location of your VNC configuration file
If you are using Red Hat Linux version 3 or 4 the GDM configuration file is /etc/X11/gdm/gdm.conf.
This is a unified configuration file that contains default values as specified by the provider of your version of
GDM in addition to your own customized configuration. This type of file is used by default in older versions
of GDM, as included in these versions of Red Hat Linux.
If you are using Red Hat Linux version 5 the GDM configuration file is /etc/gdm/custom.conf. This is
a split configuration file that contains only user-specified values that override the default configuration. This
type of file is used by default in newer versions of GDM, as included in these versions of Red Hat Linux.
Configuring GDM to use VNC1. Open the GDM configuration file with your preferred text editor and add the following lines to the file:
- Code:
-
nano /etc/gdm/custom.conf
- Code:
-
[server-VNC]
name=VNC Server
command=/usr/bin/Xvnc -SecurityTypes None -geometry 1024x768 -depth 16 \
-BlacklistTimeout 0
flexible=true
• With configuration files on Red Hat Linux 3 and 4, this should be added above the [server-Standard]
section.
•
With configuration files on Red Hat Linux 5, this should be added into the empty [servers] section.
2. Modify the configuration so that the Xvnc server is used instead of the standard X server:
• If you are using Red Hat Linux 3 or 4, there will be a line just above that that reads:
0=Standard
Modify it to read:
- Code:
-
0=VNC
• If you are using Red Hat Linux 5 or greater, add the above line just below the [servers] section
and before the [server-VNC] section.
4. Save and close the file.
Restart GDM for your change in configuration to take effect, by running the command
- Code:
-
/usr/sbin/gdmrestart
Note
Red Hat Linux uses runlevel 5 for graphical startup. If your installation is configured to start up in runlevel
3, change this for the display manager to be started (and therefore to get access to a graphical console).
See the section called “Checking runlevels” for further details.
1. Check /etc/inittab to see what the default runlevel is set to. Look for the line that reads:
- Code:
-
nano /etc/inittab
- Code:
-
id:n:initdefault:
If n is not 5, edit the file to make it so.
Firewall settingsThe firewall configuration by default does not allow VNC traffic to go through. If you have a firewall between
the VM and XenCenter, you need to allow traffic over the port that the VNC connection uses. By default,
a VNC server listens for connections from a VNC viewer on TCP port 5900 + n, where n is the display
number (usually just zero). So a VNC server setup for Display-0 will listen on TCP port 5900, Display-1 is
TCP-5901, and so on. Consult your firewall documentation to make sure these ports are open.
You might want to further customize your firewall configuration if you want to use IP connection tracking or
limit the initiation of connections to be from one side only.
To customize Red Hat-based VMs firewall to open the VNC port
1. For Red Hat Linux 3, use
- Code:
-
redhat-config-securitylevel-tui
.
For Red Hat Linux 4 and 5, use
- Code:
-
system-config-securitylevel-tui
.
XenServer Virtual Machine Installation Guide Installing Linux VMs 25
2. Select “Customize” and add 5900 to the other ports list.
Alternatively, you can disable the firewall until the next reboot by running the command service iptables
stop, or permanently by running chkconfig iptables off. This can of course expose additional services to
the outside world and reduce the overall security of your VM.
VNC screen resolution
If, after connecting to a VM with the graphical console, the screen resolution is mismatched (for example,
the VM display is too big to comfortably fit in the Graphical Console pane), you can control it by setting the
VNC server geometry parameter as follows:
1. Open the GDM configuration file with your preferred text editor. See the section called “Determining the
location of your VNC configuration file” for information about determining the location of this file.
2. Find the [server-VNC] section you added above.
3. Edit the command line to read, for example:
command=/usr/bin/Xvnc -SecurityTypes None -geometry 800x600
where the value of the geometry parameter can be any valid screen width and height.
4. Save and close the file.