Server - System - Manager - CentOS, Operation System, VBB, HACKING AND SECURITY

Go Back   Server - System - Manager - CentOS, Operation System, VBB, HACKING AND SECURITY > CentOS Việt Nam - Viet Nam Linux CentOS Community > Hỏi đáp về CentOS

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 27-09-2008
Hackingart Member
 
Join Date: Sep 2008
Posts: 22
Thanks: 0
Thanked 1 Time in 1 Post
Default How to install VNC in CentOS?

Please! Show me the way to install VNC in CentOS 5.1?
I dont understand this link
Cấu h́nh VNC server và VNC client - viewer trong Linux
Reply With Quote
  #2 (permalink)  
Old 27-09-2008
Moderator
 
Join Date: Jul 2008
Posts: 121
Thanks: 2
Thanked 4 Times in 3 Posts
Default Install VNC Server On Centos

This tutorial deals with setting up a machine for remote access. That is, other machines are able to access this machine through VNC. First, install a VNC server using the following command:
yum install vnc-server

To install VNC client,
yum install vnc
Open ports 5900 and 5901 on the firewall. If you want more than one VNC sessions to occur simultaneously, then open ports for those in your firewall. Say you want four simultaneous sessions. Then you would want to open ports 5901, 5902, 5903, and 5904. You may open ports in GUI or via command line.
Now make sure all users have their own .vnc directory in their home directory. For example, ‘testuser’ should have a /home/testuser/.vnc/ directory. If not, create one using
mkdir /home/testuser/.vnc/
Now setup VNC passwords for each user you want to allow VNC for. For example. if you want user ‘testuser’ to be able to VNC, log in as ‘testuser’ and run command
vncpasswd
It will ask you to enter and verify your password. Remember, each user needs to set up their own password with this command. It will store password in /home/testuser/.vnc/passwd file.
Check to see if you have xstartup file in /home/testuser/.vnc/ and if not, create one using
vim /home/testuser/.vnc/xstartup
And make sure it looks like this:
#!/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 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &
startx &
exec gnome-session &
I chose GNOME because I use it on CentOS. If you prefer KDE, just change gnome-session to kde-session. Also, you have to make this file executable, using the following
chmod u+x /home/testuser/.vnc/xstartup
If you do not make this executable, and once VNC is all setup, you may only get a gray screen with a big black mouse pointer. If you make this file executable, this problem should not occur.
Another reason you may get this gray screen is when the character encoding of the file may not be what the scripts are expecting. To remedy this situation, make sure you use files created and modified on Linux. I had the same problem when I created a file on Windows and downloaded it in Linux. When I created the file in Linux, the problem went away.
Now, as root, you need to edit one file
vim /etc/sysconfig/vncservers
And make sure it has the following lines:
VNCSERVERS="1:testuser 2theruser 3:moreuser"
VNCSERVERARGS[1]=”-geometry 1024×768 -depth 16″
VNCSERVERARGS[2]=”-geometry 800×600 -depth 16″
VNCSERVERARGS[3]=”-geometry 1024×768 -depth 16″
What we are doing here is setting up three VNC sessions for three users: testuser, otheruser, and moreuser. Add as many users as you want here. Remember, also open ports in firewall for each VNC session you open.
Be careful. After first installing VNC server, VNCSERVERARGS[1] will not look like this and would probably have flags set so that it doesn’t listen on network. You have to make sure your file looks like what has been shown above. Be careful that -depth is at least 16, not 8. Otherwise it may not work properly. Of course, you may set an appropriate screen resolution, not necessarily what has been set above.
Now you are ready to start VNC server as root.
service vncserver start
To make sure VNC starts up whenever the computer starts, do the following
chkconfig vncserver on
It should give you an OK for all VNC sessions you added in /etc/sysconf/vncservers. You will connect using your VNC client using the following address:
yourhostname :1
or you could use an IP address
192.168.168.100 :1
Where :1 is the number chosen for the user in /etc/sysconf/vncservers. When asked, enter password for that user. The benefit of this method is you do not need to enable auto login to be able to use VNC.
I have to thank the following for helping me learn and also write about this issue: Tutorial: VNC; Set up the VNC server in Fedora;
Change Hostname

To change hostname to another, you need to take care of two things: change the /etc/hostname file and the /etc/sysconfig/network file.
sudo vim /etc/hostname
If there is already a name, replace it with the new one. Or if the file is empty, just add the new name.
sudo vim /etc/sysconfig/network
Change your old hostname to the new one.
sudo /bin/hostname -F /etc/hostname
Although you should not need to reboot, even if you do, the new hostname should show up every time. You may even logout and then login to see the new hostname in effect.
I had to learn these things the hard way but now I am able to share them with you.
Unable to Access Internet

If you are using static IP address and are unable to access the Internet while LAN access is going smoothly, try this: add a routing rule using the Network GUI with the following values. Of course, you would need to change the gateway’s IP to whatever IP your own gateway is using.
address: 0.0.0.0
netmask: 0.0.0.0
gateway: 192.168.1.0
Allow a User to SUDO

I took this step as root, using instructions found in a good tutorial: Configuring SUDO.
su --login -c 'visudo'
Then I uncommented the line saying
# %wheel ALL=(ALL) ALL
and changed it to
%wheel ALL=(ALL) ALL
Also, I added the user I wanted to allow to use sudo by adding the following line below the line root ALL=(ALL) ALL. So now the file read
root ALL=(ALL) ALL
newuser ALL=(ALL) ALL
The user ‘newuser’ was then able to use sudo and it asked for a password every time.


————
X Window System , GNOME Desktop Environment Installation

Lets start by logging on to our VPS and installing the required packages for VNC. We’ll need the X Window System and a desktop environment, which can be installed with:
# yum groupinstall “X Window System”
# yum groupinstall “GNOME Desktop Environment”
You may prefer to install a different desktop environment, such as KDE, which is a little larger and resource intensive than GNOME. To get a complete list of available packages give the “yum grouplist” command.
The installation of each package may take a while to finish, so go pour yourself a cup of coffee.
NOTE: If you receive the error “Error: Missing Dependency: libgaim.so.0 is needed by package nautilus-sendto” while installing GNOME Desktop Environment, you will need to manually install nautilus-sendto with the following procedure:
# yum install yum-utils
# yumdownloader nautilus-sendto
# rpm -Uvh –nodeps nautilus-sendto[PRESS TAB]
Source: 0002483: nautilus-sendto requires a non-existent libgaim.so.0 - CentOS Bug Tracker
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 11:55 AM.


© Diễn đàn HackingArt (HA) được xây dựng và phát triển bởi các thành viên.
+ Diễn đàn HackingArt là nơi trao đổi của các webmaster chuyên nghiệp.