Auto Start VNC Server Ubuntu 14.04: A Comprehensive Guide : cybexhosting.net

Hello and welcome to this guide on how to auto start VNC server on Ubuntu 14.04. VNC (Virtual Network Computing) allows users to remotely access and control another computer. It is a popular tool for system administrators and users who frequently work on multiple machines. In this article, we will go through the steps needed to set up VNC server to start automatically on Ubuntu 14.04.

What is VNC Server?

VNC server is a remote desktop sharing system that enables a user to control another computer remotely. The user can access and operate the remote computer with the help of a VNC client application. VNC server is particularly useful for remote administration, technical support, and online collaboration.

In the following sections, we will explain how to set up VNC server on Ubuntu 14.04 and configure it to start automatically on boot.

Setting Up VNC Server on Ubuntu 14.04

Before we proceed to auto start VNC server, we need to first set it up manually. The following are the steps needed to install VNC server on Ubuntu 14.04:

Step Description
Step 1: Open Terminal
Step 2: Install the vnc4server package
Step 3: Create a VNC server password
Step 4: Start the VNC server
Step 5: Connect to the VNC server from a remote machine

Let’s go through each of these steps in detail.

Step 1: Open Terminal

The first step is to open the terminal on your Ubuntu 14.04 machine. You can do this by pressing Ctrl+Alt+T or by searching for “Terminal” from the Ubuntu Dash.

Step 2: Install the vnc4server package

Once the terminal is open, type the following command to install the vnc4server package:

sudo apt-get update
sudo apt-get install vnc4server

This command will install the VNC server package along with its dependencies.

Step 3: Create a VNC server password

After the installation is complete, you need to create a VNC server password. This password is used to authenticate the VNC client when connecting to the VNC server.

To create a VNC server password, type the following command in the terminal:

vncpasswd

Follow the prompts to set a VNC server password. Remember to choose a secure password.

Step 4: Start the VNC server

Once the password is set, you can start the VNC server by typing the following command:

vncserver :1

This command will start a VNC server on display :1. The display number can be changed as needed. The first time you start the VNC server, it will create a configuration file and a log file.

Step 5: Connect to the VNC server from a remote machine

Finally, you can connect to the VNC server from a remote machine using a VNC client application. You will need to enter the IP address or hostname of the remote machine along with the display number. For example, if the IP address of the remote machine is 192.168.1.100 and the display number is 1, you can connect to the VNC server by entering:

192.168.1.100:1

You will be prompted to enter the VNC server password that you created in step 3.

Auto Starting VNC Server on Ubuntu 14.04

Now that we have set up VNC server on Ubuntu 14.04, we can move on to configuring it to start automatically on boot. The following are the steps needed to auto start VNC server:

Step Description
Step 1: Create a startup script for VNC server
Step 2: Make the startup script executable
Step 3: Add the startup script to the init system
Step 4: Reboot the system to test the auto start feature

Let’s dive into each of these steps in detail.

Step 1: Create a startup script for VNC server

The first step is to create a startup script for VNC server. This script will start the VNC server on boot. Open the terminal and type the following command to create a new file:

sudo nano /etc/init.d/vncserver

This command will open a new file in the nano text editor.

Copy and paste the following script into the file:

#!/bin/sh

USER=username
HOME=/home/$USER

export USER HOME

case "$1" in
  start)
    su - $USER -c '/usr/bin/vncserver :1 -geometry 1280x800 -depth 24'
    echo "Starting VNC server"
    ;;
  stop)
    su - $USER -c '/usr/bin/vncserver -kill :1'
    echo "Stopping VNC server"
    ;;
  *)
    echo "Usage: /etc/init.d/vncserver {start|stop}"
    exit 1
    ;;
esac

exit 0

Replace “username” with your actual username in the script. You can also adjust the display resolution and color depth as needed.

Save the file and exit the editor by pressing Ctrl+X, then Y, then Enter.

Step 2: Make the startup script executable

Now that we have created the startup script, we need to make it executable. Type the following command in the terminal to do so:

sudo chmod +x /etc/init.d/vncserver

Step 3: Add the startup script to the init system

The next step is to add the startup script to the init system so that it runs on boot. Type the following command in the terminal to do so:

sudo update-rc.d vncserver defaults

This command will create symbolic links to the startup script in the appropriate runlevel directories.

Step 4: Reboot the system to test the auto start feature

Finally, we can test the auto start feature by rebooting the system and checking if the VNC server starts automatically. Type the following command in the terminal to reboot:

sudo reboot

After the system reboots, connect to the VNC server from a remote machine and verify that it starts automatically.

FAQs

1. What is the use of VNC server?

VNC server is a remote desktop sharing system that enables a user to control another computer remotely. The user can access and operate the remote computer with the help of a VNC client application. VNC server is particularly useful for remote administration, technical support, and online collaboration.

2. Can VNC server be set up to start automatically on Ubuntu 14.04?

Yes, VNC server can be set up to start automatically on Ubuntu 14.04 by creating a startup script and adding it to the init system.

3. How do I create a VNC server password?

To create a VNC server password, type the following command in the terminal:

vncpasswd

Follow the prompts to set a VNC server password. Remember to choose a secure password.

4. How do I connect to a VNC server from a remote machine?

To connect to a VNC server from a remote machine, you will need to enter the IP address or hostname of the remote machine along with the display number. For example, if the IP address of the remote machine is 192.168.1.100 and the display number is 1, you can connect to the VNC server by entering:

192.168.1.100:1

You will be prompted to enter the VNC server password that you created.

5. How do I stop the VNC server?

To stop the VNC server, type the following command in the terminal:

vncserver -kill :1

Replace “1” with the display number if necessary.

6. Can I change the display resolution and color depth of the VNC server?

Yes, you can change the display resolution and color depth of the VNC server by adding the appropriate options to the startup script. For example, the following line sets the display resolution to 1280×800 and the color depth to 24 bits:

/usr/bin/vncserver :1 -geometry 1280x800 -depth 24

You can adjust these values as needed.

7. Can I use a different VNC server package instead of vnc4server?

Yes, you can use a different VNC server package instead of vnc4server. Simply replace “vnc4server” with the name of the package that you want to use in the installation command and in the startup script.

Conclusion

Congratulations, you have successfully set up VNC server on Ubuntu 14.04 and configured it to start automatically on boot. We hope this guide has been helpful in understanding how VNC server works and how to use it to remotely access and control another computer. If you have any questions or comments, please leave them below.

Source :