This is a tutorial of how to setup GUI desktop environment on the VM instance of Google cloud platform. You can setup with just a few steps of installation. Follow the instructions here as below.
Environment
- Ubuntu 16.04
- Google Cloud Platform
Prerequisites
Create VM instance.
Before the installation, you need to create a new VM instance based on your requirement. See "How to create a GCP VM instance."Create 5901 port in firewall rules.
Create a port on firewall page for VNC viewer, default port is 5901. To avoid from internet attack, we put constraint on client IP addresses according to CIDR (Classless Inter-Domain Routing). In other words, We only allow some valid hosts that can be used on a specific subnet to connect VNC server.Let's say 123.123.123.123 as client IP address, where it is a dynamic IP address, but the IP may change from 123.123.1.1 to 123.123.255.255. We don't know what IP address would change to next time. To solve this problem we create a VNC server port (5901) in firewall rules according to CIDR table (click here to see more).
Option 1: VPC Network → Firewall rules
Option 2: Create port via gcloud command with CIDR subnet.
gcloud compute firewall-rules create vncserver --allow tcp:5901 --source-ranges 123.123.0.0/16
Installation
Step 1: Open SSH window of the instance.
Step 2: Create a bash script named install_desktop.sh
.
This script is going to upgrade system followed by the installation of desktop dependencies and VNC server.#!/bin/bash
echo '==== Upgrade system ===='
sudo apt-get update
sudo apt-get upgrade -y
echo '==== Install packages ===='
sudo apt-get install -y gnome-shell
sudo apt-get install -y ubuntu-gnome-desktop
sudo apt-get install -y autocutsel
sudo apt-get install -y tightvncserver
sudo apt-get install -y gnome-core
sudo apt-get install -y gnome-panel
sudo apt-get install -y synaptic
touch ~/.Xresources
autocutsel
is a package that allows you to copy and paste between remote server and local computer in vnc viewer.
Run created bash script
install_desktop.sh
.
bash install_desktop.sh
Step 3: Setup VNC server
To setup VNC server, run:$ vncserver
You will require a password to access your desktops.
Password:
Verify:
Would you like to enter a view-only password (y/n)? n
xauth: file /home/chunming/.Xauthority does not exist
New 'X' desktop is multitask-gpu-asia:1
Creating default startup script /home/chunming/.vnc/xstartup
Starting applications specified in /home/chunming/.vnc/xstartup
Log file is /home/chunming
/.vnc/multitask-gpu-asia:1.log
We can see that the startup script was generated under
/home/chunming/.vnc/xstartup
Step 4: Modify VNC configuration
Modify the generated startup script/home/chunming/.vnc/xstartup to the same as below:
#!/bin/sh
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:$PATH
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
autocutsel -fork
xsetroot -solid grey
export XKL_XMODMAP_DISABLE=1
export XDG_CURRENT_DESKTOP="GNOME-Flashback:Unity"
export XDG_MENU_PREFIX="gnome-flashback-"
unset DBUS_SESSION_BUS_ADDRESS
gnome-session --session=gnome-flashback-metacity --disable-acceleration-check --debug &
Step 5: Edit .bashrc
file
Add a new command to~/.bashrc
. It willl kill VNC session and then start a new one with indicated resolution.
$ vim ~/.bashrc
Add restart_vnc() function
function restart_vnc() {
vncserver -kill :1
vncserver -geometry "$1"
}
Activate it.
$ source ~/.bashrc
Step 6: Run VNC server with 1920x1080 resolution and test connection.
$ restart_vnc 1920x1080
Download VNC viewer (Click HERE to download). You can connect to IP address with 5901 port of VM instance.
Step 7: Adjust desktop theme
Install theme packagessudo apt-get install -y gnome-themes-standard
sudo apt-get install adwaita-icon-theme-full adwaita-icon-theme
gsettings get org.gnome.metacity theme
gsettings set org.gnome.metacity theme 'Adwaita'
Open Terminal after connected to VNC server. Execute following command.
$ sudo gnome-tweak-tool
Then you are allowed to change desktop theme.
Step 8: Keep long running background process (Optional)
Any background processes that were running are likely killed automatically when the user logs out of a session, whether it was a desktop session, a VT session, or when you SSHed into a machine. For example, you can no longer start a screen or tmux session, log out, and expect to come back to it.
This feature by default, and it should rather be disabled by default in Debian, either by compiling systemd with
To enable it, edit system login config.
--without-kill-user-processes
or by setting KillUserProcesses=no
in /etc/systemd/logind.conf
.To enable it, edit system login config.
$ sudo vim /etc/systemd/logind.conf
...
# Uncomment this line
KillUserProcesses=no
...
Then reboot your system.
For more info: systemd kill background processes after user logs out
Troubleshooting
Terminal does not start on Remote desktop
Reason: The environment thatgnome-terminal-server
is started with does not correctly set the locale to a UTF-8 locale. Check /etc/default/locale
$ vim /etc/default/locale
# check if locale is correct
LANG=en_US.UTF-8
Configure locales
$ sudo dpkg-reconfigure locales
Select en_US.UTF-8
However, one of my VM instances does not work at all even though I did reconfigure the locales. The problem is resolved by re-installation from step 1 to step 6. Then it works fine without any problem.
Too many authentication failures with VNC
The likely reason why this occurs is due to bots crawling the internet and looking for vulnerable servers to attack. They will try to brute force their way into a server, which is a numbers game, and will only work on a small amount of servers.Make sure that your instance is not exposed to the internet entirely. Check the Source filter in Firewall rules is not set as 0.0.0.0/0. Limit IP ranges via CIDR rule or your client IP address.
Next, change the VNC password immediately by executing this command.
cd ~/.vnc/passwd
# change password
vncpasswd passwd
→ Read more: Add Swap space to GCP VM Instance
References
- Installing and Running Ubuntu Desktop on Google Cloud Compute: Tutorial for The Absolute Novice
- 【筆記】在GCP上建立可Remote dekstop的Ubuntu環境
- GDBus.Error:org.freedesktop.DBus.Error.Spawn.ChildExited: Process org.gnome.Terminal exited with status 8
- Terminal does not start on Remote Desktop; how to fix it?
- How to Resolve/Prevent ‘Too Many Authentication Failures’ with VNC
- Your desktop on Google Cloud Platform
- Install VNC on Ubuntu 16.04
- vncserver grey screen ubuntu 16.04 LTS
- VNC connection to a Linux VM just shows a gray screen… but isn't gnome running?
thanks for sharing,hope it will be helpful for too many people that are searching for this topic
回覆刪除Google Cloud Platform Training
GCP Online Training
Google Cloud Platform Training In Hyderabad
Setup Gui Desktop On Google Cloud Platform (Gcp) Vm Instance >>>>> Download Now
刪除>>>>> Download Full
Setup Gui Desktop On Google Cloud Platform (Gcp) Vm Instance >>>>> Download LINK
>>>>> Download Now
Setup Gui Desktop On Google Cloud Platform (Gcp) Vm Instance >>>>> Download Full
>>>>> Download LINK RR
Very informative and creative content. This concept is a good way to enhance the knowledge.thanks for sharing
回覆刪除GCP Online Training
Google Cloud Platform Training In Hyderabad
Google Cloud Platform Training
Doesn't work now
回覆刪除Setup Gui Desktop On Google Cloud Platform (Gcp) Vm Instance >>>>> Download Now
回覆刪除>>>>> Download Full
Setup Gui Desktop On Google Cloud Platform (Gcp) Vm Instance >>>>> Download LINK
>>>>> Download Now
Setup Gui Desktop On Google Cloud Platform (Gcp) Vm Instance >>>>> Download Full
>>>>> Download LINK
(x-Force keygen) для всех продуктов autocad 2021 Avid Sibelius 8 Camtasia Studio 8 Crack is trustful software which records your computer XForce Keygen Download
回覆刪除Avid Sibelius Ultimate 2022.10.1469 Crack is a songs records gadget, costly software and use it to create a variety of records. Which you require to make.Sibelius Ultimate Crack Reddit
回覆刪除nice,,,,..............................!
回覆刪除google cloud data engineer certification
nice ......................!
回覆刪除ui path training
google cloud data engineer certification
elazığ
回覆刪除bilecik
kilis
sakarya
yozgat
7NZN
görüntülüshow
回覆刪除ücretli show
K7T6QU
malatya evden eve nakliyat
回覆刪除artvin evden eve nakliyat
kocaeli evden eve nakliyat
ankara evden eve nakliyat
düzce evden eve nakliyat
T88KGU
ığdır evden eve nakliyat
回覆刪除bitlis evden eve nakliyat
batman evden eve nakliyat
rize evden eve nakliyat
niğde evden eve nakliyat
QYB
hatay evden eve nakliyat
回覆刪除ısparta evden eve nakliyat
erzincan evden eve nakliyat
muğla evden eve nakliyat
karaman evden eve nakliyat
FZ0H3
ığdır evden eve nakliyat
回覆刪除bitlis evden eve nakliyat
batman evden eve nakliyat
rize evden eve nakliyat
niğde evden eve nakliyat
T1QJL
düzce evden eve nakliyat
回覆刪除denizli evden eve nakliyat
kırşehir evden eve nakliyat
çorum evden eve nakliyat
afyon evden eve nakliyat
YNYFDN
urfa evden eve nakliyat
回覆刪除malatya evden eve nakliyat
burdur evden eve nakliyat
kırıkkale evden eve nakliyat
kars evden eve nakliyat
2JC8XF
9C8CA
回覆刪除Kayseri Lojistik
İzmir Evden Eve Nakliyat
Nevşehir Parça Eşya Taşıma
Yalova Parça Eşya Taşıma
İstanbul Lojistik
D8764
回覆刪除Erzurum Parça Eşya Taşıma
Nevşehir Lojistik
Bartın Parça Eşya Taşıma
Zonguldak Lojistik
Çorum Parça Eşya Taşıma
83B58
回覆刪除Silivri Parke Ustası
Niğde Evden Eve Nakliyat
Kars Evden Eve Nakliyat
Hatay Evden Eve Nakliyat
Eryaman Alkollü Mekanlar
1160C
回覆刪除Loop Network Coin Hangi Borsada
Tunceli Şehirler Arası Nakliyat
Uşak Lojistik
Muğla Parça Eşya Taşıma
Ankara Lojistik
Kastamonu Parça Eşya Taşıma
Erzurum Parça Eşya Taşıma
Kırklareli Parça Eşya Taşıma
Elazığ Parça Eşya Taşıma
A6BD0
回覆刪除Van Evden Eve Nakliyat
buy masteron
Aksaray Evden Eve Nakliyat
https://steroidsbuy.net/steroids/
Antep Evden Eve Nakliyat
buy pharmacy steroids
order parabolan
Bolu Evden Eve Nakliyat
Karabük Evden Eve Nakliyat
E9A95
回覆刪除Konya Şehirler Arası Nakliyat
Rize Şehir İçi Nakliyat
Kocaeli Lojistik
Afyon Parça Eşya Taşıma
Burdur Evden Eve Nakliyat
Yalova Şehir İçi Nakliyat
Mardin Evden Eve Nakliyat
Bayburt Şehir İçi Nakliyat
Adana Parça Eşya Taşıma
E52C7
回覆刪除Trabzon Şehir İçi Nakliyat
Kütahya Parça Eşya Taşıma
Sivas Şehirler Arası Nakliyat
Keçiören Boya Ustası
Muğla Evden Eve Nakliyat
Batman Parça Eşya Taşıma
Adıyaman Evden Eve Nakliyat
Siirt Evden Eve Nakliyat
Giresun Şehir İçi Nakliyat
3883A
回覆刪除Karapürçek Fayans Ustası
Ünye Çekici
Van Parça Eşya Taşıma
Kocaeli Parça Eşya Taşıma
Tokat Şehirler Arası Nakliyat
Etlik Boya Ustası
Bayburt Parça Eşya Taşıma
Tekirdağ Evden Eve Nakliyat
Flare Coin Hangi Borsada
30124
回覆刪除Çorum Şehirler Arası Nakliyat
Ankara Boya Ustası
Siirt Evden Eve Nakliyat
Batıkent Parke Ustası
Huobi Güvenilir mi
Erzincan Parça Eşya Taşıma
Van Şehirler Arası Nakliyat
Ardahan Şehir İçi Nakliyat
Bingöl Lojistik
37065
回覆刪除Lbank Güvenilir mi
Binance Referans Kodu
Gümüşhane Şehirler Arası Nakliyat
Şırnak Parça Eşya Taşıma
Ünye Organizasyon
Karapürçek Parke Ustası
Ağrı Şehir İçi Nakliyat
Çorum Evden Eve Nakliyat
Area Coin Hangi Borsada
A57AE
回覆刪除Giresun Evden Eve Nakliyat
Amasya Şehir İçi Nakliyat
Tunceli Şehir İçi Nakliyat
Ünye Boya Ustası
İstanbul Lojistik
Etlik Parke Ustası
Yozgat Şehir İçi Nakliyat
Tunceli Lojistik
Hakkari Parça Eşya Taşıma
7FB3B
回覆刪除Kastamonu Evden Eve Nakliyat
Isparta Evden Eve Nakliyat
Osmaniye Şehirler Arası Nakliyat
Kars Şehir İçi Nakliyat
Karaman Şehir İçi Nakliyat
Bitexen Güvenilir mi
Niğde Parça Eşya Taşıma
Kastamonu Şehir İçi Nakliyat
Muş Şehirler Arası Nakliyat
6FD82
回覆刪除Bayburt Evden Eve Nakliyat
Batman Evden Eve Nakliyat
Çankırı Şehir İçi Nakliyat
Pitbull Coin Hangi Borsada
Afyon Lojistik
Şırnak Lojistik
Giresun Şehir İçi Nakliyat
Mamak Parke Ustası
Tekirdağ Parça Eşya Taşıma
F39DD
回覆刪除Batıkent Boya Ustası
Binance Referans Kodu
Bitcoin Nasıl Alınır
Zonguldak Evden Eve Nakliyat
Tekirdağ Evden Eve Nakliyat
Çerkezköy Oto Boya
Keçiören Boya Ustası
Şırnak Evden Eve Nakliyat
Rize Evden Eve Nakliyat
57076
回覆刪除binance kod
2BBC8
回覆刪除https://resimlimag.net/
Madencilik Nedir
Bitcoin Nasıl Çıkarılır
resimlimag.net
Coin Madenciliği Nedir
Coin Oynama
Coin Nasıl Üretilir
Binance Nasıl Oynanır
Coin Nasıl Oynanır
EC621
回覆刪除binance referans kodu
resimli magnet
resimli magnet
binance referans kodu
binance referans kodu
binance referans kodu
resimli magnet
referans kimliği nedir
referans kimliği nedir
7DE6A
回覆刪除karaman goruntulu sohbet
mardin sohbet sitesi
malatya telefonda kadınlarla sohbet
giresun telefonda kadınlarla sohbet
bilecik sesli sohbet
sesli sohbet siteleri
siirt ücretsiz sohbet
eskişehir kadınlarla ücretsiz sohbet
muş canlı sohbet siteleri
B3D51
回覆刪除Binance Kimin
Facebook Grup Üyesi Satın Al
Coin Üretme Siteleri
Youtube Abone Satın Al
Shibanomi Coin Hangi Borsada
Görüntülü Sohbet
Sohbet
Kripto Para Madenciliği Nasıl Yapılır
Threads Takipçi Hilesi
F61E9
回覆刪除Facebook Takipçi Hilesi
Bitcoin Madenciliği Nedir
Osmo Coin Hangi Borsada
Likee App Beğeni Hilesi
Mith Coin Hangi Borsada
Coin Çıkarma Siteleri
Facebook Beğeni Satın Al
Parasız Görüntülü Sohbet
Görüntülü Sohbet
1233C
回覆刪除kızlarla canlı sohbet
kripto telegram
bitcoin ne zaman çıktı
bitget
güvenilir kripto para siteleri
bitcoin nasıl oynanır
bitmex
referans kodu
en az komisyon alan kripto borsası
EB1C1
回覆刪除en güvenilir kripto borsası
filtre kağıdı
binance
bitcoin nasıl üretilir
telegram kripto para grupları
referans kodu binance
okex
bitcoin seans saatleri
paribu