This page looks best with JavaScript enabled

VNC Server on raspberry pi

 ·   ·  β˜• 2 min read

    Install Tightvnc server

    sudo apt update
    sudo apt upgrade
    sudo apt install tightvncserver
    

    Configure the vncserver

    vncserver :1
    

    To start vnc server manually

    vncserver :1
    

    Running vncserver at boot

    sudo nano /etc/systemd/system/vncserver.service
    

    Copy the following

    [Unit]
    Description=TightVNC remote desktop server
    After=network.target
     
    [Service]
    User=pi
    Type=forking
    ExecStart=/usr/bin/vncserver :1
    ExecStop=/usr/bin/vncserver -kill :1
     
    [Install]
    WantedBy=multi-user.target
    

    To start the service

    sudo systemctl start vncserver
    

    To see status

    sudo systemctl status vncserver
    

    To stop server

    vncserver -kill :1
    

    To run start the service at boot

    sudo systemctl enable vncserver
    

    To stop the service

    sudo systemctl stop vncserver
    

    To disable the service

    sudo systemctl disable vncserver
    

    Set screen size

    vncserver :1 -geometry 1440x900
    

    Install ubuntu desktop

    sudo apt install ubuntu-gnome-desktop
    

    Start the gnome desktop service, and make sure it runs when booting.

    sudo systemctl start gdm
    sudo systemctl enable gdm
    

    Installing ubuntu packages

    sudo apt-get install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal
    

    Update ~/.vnc/xstartup

    # 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 &
    x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
    x-window-manager &
    
    gnome-panel &
    gnome-settings-daemon &
    metacity &
    nautilus &
    

    Installing fake display

    Install the package

    sudo apt-get install xserver-xorg-video-dummy
    

    Add the following to /etc/X11/xorg.conf

    Section "Device"
        Identifier  "Configured Video Device"
        Driver      "dummy"
    EndSection
    
    Section "Monitor"
        Identifier  "Configured Monitor"
        HorizSync 31.5-48.5
        VertRefresh 50-70
    EndSection
    
    Section "Screen"
        Identifier  "Default Screen"
        Monitor     "Configured Monitor"
        Device      "Configured Video Device"
        DefaultDepth 24
        SubSection "Display"
        Depth 24
        Modes "1024x800"
        EndSubSection
    EndSection
    

    Reference: https://www.teknotut.com/en/install-vnc-server-with-gnome-display-on-ubuntu-18-04/


    Ohidur Rahman Bappy
    WRITTEN BY
    Ohidur Rahman Bappy
    πŸ“šLearner 🐍 Developer