Yadda ake Shigar da Sanya VNC Server akan Ubuntu


Virtual Network Computing (VNC) tsari ne wanda ake amfani dashi wanda ake amfani dashi wajan rarraba kayan kwalliya wanda yake bawa asusun masu amfani damar hadasu nesa da kuma sarrafa ayyukan kwamfyuta daga wata kwamfutar ko wata na'urar ta hannu.

A cikin wannan labarin, za mu bayyana yadda za a girka da saita VNC Server a kan ɗab'in Desktop na Ubuntu 18.04 ta hanyar shirin tigervnc-server.

VNC Server: 192.168.56.108
VNC Client: 192.168.56.2

Shigar da Muhallin Desktop a cikin Ubuntu

Kamar yadda na fada, VNC tsarin raba tebur ne, don haka kuna buƙatar samun yanayin yanayin tebur a kan sabar Ubuntu. Kuna iya shigar da DE ɗin da kuka zaɓa ta hanyar tafiyar da umarnin da ya dace a ƙasa. Don dalilan wannan labarin, za mu girka Ubuntu Gnome (dandano na hukuma).

$ sudo apt-get install ubuntu-desktop		#Default Ubuntu desktop
$ sudo apt install ubuntu-gnome-desktop	        #Ubuntu Gnome (Official flavor)
$ sudo apt-get install xfce4			#LXDE
$ sudo apt-get install lxde			#LXDE
$ sudo apt-get install kubuntu-desktop		#KDE

Shigar da Sanya VNC a cikin Ubuntu

Tigervnc-uwar garke babban-tsari ne, na dandamali mai yawa na VNC wanda ke gudanar da sabar Xvnc kuma yana farawa da zama iri daya na Gnome ko wasu muhalli na Desktop akan teburin VNC.

Don shigar da sabar TigerVNC da sauran fakiti masu alaƙa a cikin Ubuntu, gudanar da wannan umarnin.

$ sudo apt install tigervnc-standalone-server tigervnc-common tigervnc-xorg-extension tigervnc-viewer

Yanzu fara sabar VNC ta hanyar kunna umarnin vncserver azaman mai amfani na yau da kullun. Wannan aikin zai ƙirƙiri saitin farko wanda aka adana a cikin adireshin $HOME/.vnc kuma hakan zai kuma sa ka saita kalmar shiga.

Shigar da kalmar wucewa (wanda dole ne yakai aƙalla haruffa shida) kuma tabbatar dashi/tabbatar dashi. Sannan saita kalmar sirri kawai idan kana so, kamar haka.

$ vncserver
$ ls -l ~/.vnc 

Na gaba, muna buƙatar saita DE don aiki tare da sabar VNC. Don haka, dakatar da sabar VNC ta amfani da umarni mai zuwa, don aiwatar da wasu abubuwan daidaitawa.

$ vncserver -kill :1

Don saita GNOME ko kowane tebur ɗin da kuka girka, ƙirƙiri fayil ɗin da ake kira xstartup a ƙarƙashin kundin tsarin daidaitawa ta amfani da editan rubutu da kuka fi so.

$ vi ~/.vnc/xstartup

Sanya layuka masu zuwa a cikin fayil din. Waɗannan dokokin za a aiwatar da su ta atomatik duk lokacin da ka fara ko ka sake farawa sabar TigerVNC. Lura cewa umarni na iya bambanta dangane da DE ɗin da kuka sanya.

#!/bin/sh
exec /etc/vnc/xstartup
xrdb $HOME/.Xresources
vncconfig -iconic &
dbus-launch --exit-with-session gnome-session &

Adana fayil ɗin kuma saita izinin da ya dace akan fayil ɗin don a kashe shi.

$ chmod 700 ~/.vnc/xstartup

Na gaba, fara sabar VNC ta hanyar aiwatar da umarni mai zuwa azaman mai amfani na yau da kullun. Sanya ƙimominku don lissafin nuni. Bugu da ƙari, yi amfani da tutar -localhost don ba da damar haɗi daga localhost kawai da misalin, kawai daga masu amfani da aka tabbatar akan sabar.

Bugu da kari, VNC ta tsohuwa tana amfani da tashar TCP 5900 + N , inda N shine lambar nunawa. A wannan yanayin, : 1 yana nufin cewa uwar garken VNC zata gudana akan lambar tashar jirgin ruwa mai lamba 5901.

$ vncserver :1 -localhost -geometry 1024x768 -depth 32

Don jera zaman uwar garken VNC akan tsarinka, aiwatar da wannan umarni.

$ vncserver -list

Da zarar uwar garken VNC ta fara, duba tashar da take aiki tare da umarnin netstat.

$ netstat -tlnp

Haɗawa zuwa VNC Server ta Abokin Cinikin VNC

A wannan sashin, za mu nuna yadda za a yi haɗi zuwa sabar VNC, amma kafin mu shiga wannan, ya kamata ku sani cewa ta hanyar tsoho VNC ba ta da tsaro ta tsohuwa (ba yarjejeniya ce ɓoyayyiya ba kuma tana iya fuskantar cushe fakiti) . Ana iya gyara wannan matsalar ta ƙirƙirar rami daga abokin ciniki zuwa haɗin sabar ta hanyar SSH.

Ta amfani da murfin SSH, zaka iya tura safararru daga na'ura na gida a tashar jirgin ruwa ta 5901 zuwa uwar garken VNC a wannan tashar.

A kan mashin ɗin abokin cinikin Linux, buɗe sabon taga don buɗe gudu ka kuma bi wannan umurnin don ƙirƙirar ramin SSH zuwa sabar VNC.

$ ssh -i ~/.ssh/ubuntu18.04 -L 5901:127.0.0.1:5901 -N -f -l tecmint 192.168.56.108

Nan gaba shigar abokin ciniki na vncviewer kamar su TigerVNC Viewer kamar yadda ake bi (zaka iya girka duk wani abokin harka da kake so).

$ sudo apt install tigervnc-viewer		#Ubuntu/Debian
$ sudo yum install tigervnc-viewer		#CnetOS/RHEL
$ sudo yum install tigervnc-viewer		#Fedora 22+
$ sudo zypper install tigervnc-viewer	        #OpenSUSE
$ sudo pacman -S tigervnc			#Arch Linux

Da zarar an gama girka, sai a yi aiki da abokin cinikin VNC ɗinku, saka adireshin localhost: 5901 don haɗawa don nuna 1 kamar haka.

$ vncviewer localhost:5901

A madadin, buɗe shi daga menu ɗin tsarin, shigar da adireshin da ke sama sannan danna Haɗa.

Za a sa ka shigar da kalmar shiga ta VNC da aka ƙirƙira a baya, shigar da ita ka danna OK don ci gaba.

Idan kalmar sirri daidai ce, zaku sauka a cikin hanyar shiga ta tebur ɗin ku. Shigar da kalmar wucewa don samun damar tebur.

Hankali: Idan kuna sane da tsaro, wataƙila kun lura cewa mai kallon VNC yana nuna\"haɗi ba ɓoyayye bane" duk da cewa mun kunna ramin SSH.

Wannan saboda an tsara shi ne don amfani da takamaiman tsare-tsaren tsaro banda ramin SSH lokacin ƙoƙarin tabbatarwa tare da sabar. Koyaya, haɗin yana da aminci da zarar kun kunna rami na SSH.

Irƙirar Fayil din Systemd na TigerVNC Server

Domin gudanar da sabar VNC a karkashin tsari watau farawa, dakatarwa, da sake kunna sabis na VNC kamar yadda ake buƙata, muna buƙatar ƙirƙirar fayil ɗin naúra gare shi a ƙarƙashin/etc/systemd/system/directory, tare da gata tushen.

$ sudo vim /etc/systemd/system/[email protected]

Sannan ƙara layuka masu zuwa a cikin fayil ɗin:

[Unit] 
Description=Remote desktop service (VNC) 
After=syslog.target network.target 

[Service] 
Type=simple 
User=tecmint 
PAMName=login 
PIDFile=/home/%u/.vnc/%H%i.pid 
ExecStartPre=/usr/bin/vncserver -kill :%i > /dev/null 2>&1 || :
ExecStart=/usr/bin/vncserver :%i -localhost no -geometry 1024x768 
ExecStop=/usr/bin/vncserver -kill :%i 

[Install] 
WantedBy=multi-user.target

Adana fayil ɗin kuma rufe shi.

Na gaba, sake loda tsarin sarrafa manajan don karanta sabon fayil ɗin naúrar, kamar haka.

$ sudo systemctl daemon-reload

Daga nan sai a fara hidimar VNC, a bashi damar fara amfani da shi ta atomatik sannan a duba matsayinta kamar yadda aka nuna.

$ sudo systemctl start [email protected]
$ sudo systemctl enable [email protected]
$ sudo systemctl status [email protected]

Shi ke nan! A cikin wannan labarin, munyi bayanin yadda ake girka da saita sabar VNC akan rarraba Ubuntu Linux. Raba tambayoyinku ko tunaninku tare da mu ta hanyar hanyar mayar da martani da ke ƙasa.