.
D 2017-03-24T01:05:15.540
L lxd_test_cluster
N text/x-markdown
P b0a0ba07791522b06f3f1ae41e7d87e18c54750f
U bjbarcla
W 5407
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#orgheadline11">1. Setup lxd cluster for megatest</a>
<ul>
<li><a href="#orgheadline1">1.1. I setup 3 container "boxes" - pablo, ruby, ash</a></li>
<li><a href="#orgheadline2">1.2. install lxd - loosely followed this</a></li>
<li><a href="#orgheadline3">1.3. put containers on home LAN- followed this procedure</a></li>
<li><a href="#orgheadline4">1.4. setup shared space across containers, mounted from host fs</a></li>
<li><a href="#orgheadline5">1.5. Setup containers</a></li>
<li><a href="#orgheadline6">1.6. setup ssh host keys across mtuser</a></li>
<li><a href="#orgheadline7">1.7. pick a container and setup X / vnc</a></li>
<li><a href="#orgheadline8">1.8. fix consternating issue breaking tab completion working in any term:</a></li>
<li><a href="#orgheadline9">1.9. start a vnc session (so iup works)</a></li>
<li><a href="#orgheadline10">1.10. from home network, use vnc client to connect to container:1</a></li>
</ul>
</li>
</ul>
</div>
</div>
# Setup lxd cluster for megatest<a id="orgheadline11"></a>
## I setup 3 container "boxes" - pablo, ruby, ash<a id="orgheadline1"></a>
- shared disk space at /lxd-shared
- picked pablo to serve vnc
- put containers on home network to make things easy
## install lxd - loosely followed [this](https://stgraber.org/2015/04/21/lxd-getting-started/)<a id="orgheadline2"></a>
## put containers on home LAN- followed [this](https://insights.ubuntu.com/2015/11/10/converting-eth0-to-br0-and-getting-all-your-lxc-or-lxd-onto-your-lan/) procedure<a id="orgheadline3"></a>
host# mkdir /lxd-shared
host# chown 100000:100000 /lxd-shared
host# chmod 777 /lxd-shared
host# xc remote add images images.linuxcontainers.org
host# lxc launch images:ubuntu/xenial/amd64 ruby
host# lxc launch images:ubuntu/xenial/amd64 pablo
host# lxc launch images:ubuntu/xenial/amd64 ash
## setup shared space across containers, mounted from host fs<a id="orgheadline4"></a>
mkdir /lxd-shared
- my root disk is bigly
chmod 777 /lxd-shared
host# lxc config device add ruby sharedtmp disk path=/lxd-shared source=/lxd-shared
host# lxc config device add ash sharedtmp disk path=/lxd-shared source=/lxd-shared
host# lxc config device add pablo sharedtmp disk path=/lxd-shared source=/lxd-shared
## Setup containers<a id="orgheadline5"></a>
- Foreach container :
host# lxc exec container /bin/bash
container# apt update
container# apt upgrade
container# apt-get install -y openssh-server htop ncurses-term fossil make
container# service ssh start
container# addgroup megatest
container# adduser --ingroup megatest mtuser
container# apt-get install -y libreadline-dev
container# apt-get install -y libwebkitgtk-dev libfreetype6-dev libx11-dev libxpm-dev libxmu-dev libxft-dev libgtk2.0-dev \
container# libgl1-mesa-dev libglu1-mesa-dev libpangox-1.0-dev \
container# bison libwebkitgtk-3.0-dev
container# apt-get install -y libmotif-common
container# apt-get install -y uuid-dev
## setup ssh host keys across mtuser<a id="orgheadline6"></a>
host# lxc exec container1 /bin/bash
container1# su - mtuser
% ssh-keygen
- leave password blank, take all defaults
% cat .ssh/id\_rsa.pub > .ssh/authorized\_keys
% chmod go= .ssh/authorized\_keys
% tar czvf /lxd-shared/mtuser-ssh.tgz .ssh
% ssh container2 tar xzvf /lxd-shared/mtuser-ssh.tgz
% ssh container3 tar xzvf /lxd-shared/mtuser-ssh.tgz
- ssh between all pairs to initialize host keys. should be passwordless now.
## pick a container and setup X / vnc<a id="orgheadline7"></a>
container# apt-install vnc4server xfce4
container# su -c mtuser
% vncpasswd
- put following in .vnc/xstartup
#!/bin/sh
# 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 &
#!/bin/sh
unset SESSION\_MANAGER
unset DBUS\_SESSION\_BUS\_ADDRESS
startxfce4 &
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
mtuser% vncserver -geometry 1366x746 -depth 24
## fix consternating issue breaking tab completion working in any term:<a id="orgheadline8"></a>
- edit ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml
- find the line
<property name="<Super>Tab" type="string" value="switch\_window\_key"/>
- and change it to
<property name="<Super>Tab" type="empty"/>
- restart vnc (vncserver -stop :1 ;
## start a vnc session (so iup works)<a id="orgheadline9"></a>
## from home network, use vnc client to connect to container:1<a id="orgheadline10"></a>
- setup shop in /lxd-share, eg:
% cd /lxd-share
% fossil clone http://kiatoa.com/fossils/megatest megatest.fossil
.....
Z adee136764dbe6c21d3a2cc06312ec31