Installing VNCserver on CentOS 5.7 and Ubuntu 11 for remote desktop in Windows

December 26th, 2011

I run an Apache web server from my home. It is basically used to create test and development websites for my domains. The problem I was experiencing was how to allow my son and others work within a desktop in CentOS similar to Windows.

I decided a good method would be VNC. The first step is to set up the vncserver to deliver a desktop to remote sessions. I like the concept of connecting via HTTP, because we all have web browser.

You can enable HTTP access to a remote desktop on the web server with VNCserver. You can also create separate accounts for each user to view his or her own desktop. Security can also be maintained through the granting of rights and privileges for the session. Here are the steps I took to allow my son to work on his website through a web-based, VNC session on his Windows 7 laptop.

 

So if this is what you are looking to do with Windows 7 and Internet Explorer to access a Linux desktop, then read on to see how it is done.

CentOS 5.7 : Install vncserver via yum

Ubuntu 11: Install X11VNC Server via sudo apt-get intall x11vnc.

CentOS 5.7 set-up after installing vncserver.

  1. Add user to server.
    sudo /usr/sbin/useradd thefrugaltech
    sudo passwd mikey (to assign a password to the account)
  2. Install vnc-server
    sudo yum install vnc-server
  3. Provide VNC user with password
    sudo su – thefrugaltech
    Run:vncpasswd
    Password: New Password
    Verify: Type New Password again
    Logout as user by typing “exit”
  4. Vi /etc/sysconfig/vncservers
    Edit: VNCSERVERS=”2:myusername” to read VNCSERVERS=”2:thefrugaltech”
    Edit: VNCSERVERARGS[2]=”-geometry 800×600 -nolisten tcp -nohttpd – localhost” to read VNCSERVERS=”-geometry 1024×768″
  5. Start vncserver
    su – root (provide root password)
    /sbin/service vncserver start (if it does not start due to permissions issues ensure you are using an account with sudo rights)
  6. Change the xstartup options for the user account created in step 3
    su - root
    vi  ~thefrugaltech/.vnc/xstartup
    Uncomment: “unset SESSION_MANAGER” and “exec /etc/X11/xinit/xinitrc”
  7. Open Internet Explorer on your Windows. Goto “http:<ip of vncserver>:5802″ click “OK” for the session and enter the password for the user, then press OK.

Ubuntu 11 set-up after installing x11vnc

  1. Run: vncpasswd (This will set the current users password).
  2. You can log out of the session or simply restart the server.
  3. If you are viewing from a Windows server or PC install RealVNC viewer. Open the viewer and type in the Ubuntu 11 server’s IP address.
  4. You should see the desktop.

Not working?

  • Ensure Java is installed on the PC.
  • If you are not getting a GNOME desktop, check the default settings for new users. What I found to be expedient is to log the user into a desktop session.

Add local printer to networked application

October 21st, 2011

Times are changing, so people are very surprised when you have a printer that does not come with a network card. Why would anyone want to keep a printer that old? One reason is because they were build better and are conservative with ink cartridges. Here is how to keep that older printer and provide access to the printer in an application based on a server.

I have an HR DeskJet 895 connected to a Windows 2000 PC via a serial connection. I want to be able to use the printer for an application or general use on a Windows 2008 R2 server. The principles are very similar to adding a printer to CUPS and the older LPD protocol in Unix.

  • Make sure the printer is added to the Windows 2000 PC.
  • Go to Start -> Control Panel -> Add and Remove Programs
  • Select Add/Remove Windows Components
  • Ensure Other Network File and Print Services is checked and click on Details
  • Check Print Services for Unix and OK.
  • Click Next to install the component, then Finish.
  • Close out of the Add and Remove Programs application.
  • Under Services ensure the TCP/IP Print Server is started and set to automatically start at boot.
  • That is all there is to configuring the Windows 2000 PC
  • Now we move onto the Windows 2008 R2 server.
  • Open the Server Manager console. Start -> Administrative Tools -> Server Manager
  • Under Features Summary click Add Features.
  • Check LPR Port Monitor, Next, then Install. The process may take a bit, so be patient.
  • Once the install is finished click Close, then close the Server Manager window.
  • Open Start -> Control Panel -> Printers
  • Double click Add Printer
  • Select Add a Local Printer -> Next
  • Select Create a New Port, the Type of Port is LPR Port -> Next
  • The Name or address of server providing lpd: is the IP address of the PC to which the printer is connected. The Name of the print queue on that server: is the printer’s name on the PC to which the printer is connected, like HP DeskJet 895Cse. Click OK (if you receive an error message that the port already exists, check Use and existing port: and use the drop-down list to select your printer, then click Next.
  • Select the Manufacturer and Print driver for your printer, then click Next.
  • The Use the driver that is currently installed (recommended) should be selected, click Next
  • You can change the Printer name: to what every you would like, then click Next.
  • Printer Sharing: You can share the printer or choose not to share the printer, then click Next.
  • Click Print a test page to see if it works. If everything is fine you should see the job in the print queue on the PC the printer is connected and better yet the test page should print.
  • Click finish and enjoy the printer!