見出し画像

lxcの中でちゃちゃっとxrdpなUbuntu MATE環境を突っ込みたい(x11vnc追記)

Ubuntu + MATE の前に apt-fast しておきたい  

#!/bin/sh
sudo apt-get install software-properties-common -y
sudo add-apt-repository ppa:apt-fast/stable -y
sudo apt update
sudo apt install apt-fast

Ubuntu + MATE を

#!/bin/sh
sudo apt-fast install mate-desktop* -y
sudo apt-fast install task-japanese task-japanese-desktop ibus-kkc locales-all -y
sudo localectl set-locale LANG=ja_JP.UTF-8 LANGUAGE="ja_JP:ja"
sudo apt-fast install gvfs-backends -y
sudo apt-fast install xrdp -y

Windowsからは普通にRDPクライアントで
Linuxならremminaから繋げば宜しいかと
以上

themeをダークにしてみたり見栄え良くするならこんな感じかな

sudo apt-fast install -y arc-theme
sudo add-apt-repository -y ppa:papirus/papirus
sudo apt-get update
sudo apt-fast install -y papirus-icon-theme
sudo apt-fast install -y gtk2-engines-murrine gtk2-engines-pixbuf

flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
flatpak install flathub org.gtk.Gtk3theme.Materia{,-dark,-light}{,-compact}

sudo apt-fast git -y
git clone https://github.com/vinceliuice/stylish-gtk-theme.git
cd stylish-gtk-theme/
chmod +x Install 
sudo ./Install
cd ..
rm -rf stylish-gtk-theme/

テーマは適当に選択してカスタマイズしてアイコンはPapirusDarkあたりでかっこよく使えばいいと思う


こんな感じになる

実はオーディオ転送の事はよく知らないし使わないので放置している

x11vncでも繋げる様にしよう

取り敢えず以下をコピペ実行して
パスワードは任意で他はそのままで動作する筈

sudo apt install x11vnc xserver-xorg-video-dummy lightdm -y

仮想モニターの定義

sudo nano /etc/X11/xorg.conf

Section "Monitor"
Identifier "Monitor0"
HorizSync 28.0-80.0
VertRefresh 48.0-75.0
# 1680x1050 @ 60.00 Hz (GTF) hsync: 65.22 kHz; pclk: 147.14 MHz
Modeline "1920x1080_60.00" 147.14 1680 1784 1968 2256 1050 1051 1054 1087 -HSync +Vsync
EndSection

​Section "Device"
  Identifier "Card0"
  Driver "dummy"
  VideoRam 256000
EndSection

Section "Screen"
DefaultDepth 24
Identifier "Screen0"
Device "Card0"
​Monitor "Monitor0"
    SubSection "Display"
    Depth 24
    Modes "1920x1080"    
    EndSubSection
EndSection
sudo nano /etc/systemd/system/x11vnc.service

[Unit]
Description=x11vnc (Remote access)
After=network-online.target

[Service]
Type=simple
ExecStart=/usr/bin/x11vnc -auth guess -display :0 -rfbauth /etc/.vncpasswd -rfbport 5900 -forever -loop -noxdamage -repeat -shared
ExecStop=/bin/kill -TERM $MAINPID
ExecReload=/bin/kill -HUP $MAINPID
KillMode=control-group
Restart=on-failure

[Install]
WantedBy=graphical.target
sudo nano /etc/init.d/vncserver 

#!/bin/sh -e
### BEGIN INIT INFO
# Provides:          vncserver
# Required-Start:    networking
# Default-Start:     3 4 5
# Default-Stop:      0 6
### END INIT INFO

PATH="$PATH:/usr/X11R6/bin/" CMD="/usr/bin/x11vnc"

# The Username:Group that will run VNC 
export USER="your_username"

# The display that VNC will use DISPLAY="1"

# Color depth (between 8 and 32) DEPTH="16"

# The Desktop geometry to use.
#GEOMETRY="<WIDTH>x<HEIGHT>"
#GEOMETRY="800x600" GEOMETRY="1680x1050"
#GEOMETRY="1280x1024"

# The name that the VNC Desktop will have. NAME="my-vnc-server"

PORT=5900 
LISTEN="192.168.1.10"


OPTIONS="-xkb -noxrecord -noxfixes -noxdamage -listen ${LISTEN} -name ${NAME} -depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY} -auth guess
-usepw ~/.vnc/passwd -rfbport ${PORT} -forever -bg -oa /var/log/x11vnc.log"

. /lib/lsb/init-functions

case "$1" in start) echo ${OPTIONS} log_action_begin_msg "Starting vncserver for user '${USER}' on localhost:${DISPLAY}" su ${USER} -c "${CMD} ${OPTIONS}" ;;

stop) log_action_begin_msg "Stoping vncserver for user '${USER}' on localhost:${DISPLAY}" su ${USER} -c "${CMD} -kill :${DISPLAY}" ;;

restart) $0 stop $0 start ;; esac

exit 0

パスワードを設定

sudo x11vnc -storepasswd /etc/.vncpasswd
Enter VNC password: 
Verify password: 
Write password to /etc/.vncpasswd? [y]/n y
Password written to: /etc/.vncpasswd

サービスとして登録

sudo systemctl daemon-reload
sudo systemctl enable x11vnc
sudo systemctl start x11vnc
sudo systemctl enable x11vnc
sudo systemctl start x11vnc

ふぅ、これで remmina vnc-plugin で繋がるだろう
もしかしたら再起動しなきゃいけないかもしれない

いいなと思ったら応援しよう!