23 Installation
mad edited this page 2018-12-01 17:52:46 +00:00

Management Server
This is the master server that runs the webinterface and manages vms either locally or remote via ssh.
It needs at least the following dependencies:
-php with a webserver (preferably nginx if https is going to be used).
-sqlite for the database
-git - you could also just download the tarball
-rsync to manage image files
If there are nodes to manage, it needs these additional dependencies:
-openssl
-openssh

Quick install:
become root
cd /usr/local
git clone https://git.nativenet.ch/nativenet.ch/nlvmi.git
useradd nlvmi
ln -sf ${PWD}/nlvmi/nlvmi /usr/bin/
ln -sf ${PWD}/nlvmi/wrap-nlvmi /usr/bin/
ln -sf ${PWD}/nlvmi/web /var/www/localhost/htdocs/nlvmi -or wherever your webroot is or you would like to access it
chown root:nlvmi nlvmi/*nlvmi
chmod +s nlvmi/wrap-nlvmi
mkdir /etc/nlvmi
cp nlvmi/nlvmi.conf /etc/nlvmi/
nlvmi createdb
chown nobody:root -R /etc/nlvmi -in this case we assume php is running as user nobody

If there are nodes that should get managed by this master server, then the following is also needed:
Enable the MASTERSERVER option in /etc/nlvmi/nlvmi.conf
nlvmi createkey
su nlvmi
ssh-keygen -without a password

If you want to use https, novnc will not work out of the box because of the websocket. NLVMI includes a tiny nginx config generator to overcome this issue. Just create a directory like /etc/nginx/nlvmi/, add "include /etc/nginx/nlvmi/*.conf;" to your https server config and edit /etc/nlvmi/nlvmi.conf to set NGINXCONFIGPATH="/etc/nginx/nlvmi". There is also a NGINXRSTARTCOMMAND which can be used to reload the generated configs automatically.

If this host should also act as node, then the following packages are also needed as dep:
-qemu
-usermode-utilities
-bridge-utils
-socat
You should probably edit /etc/nlvmi/nlvmi.conf.

KVM node
This is a remote server that gets managed by the master.
The following deps are needed there:
-qemu
-usermode-utilities
-bridge-utils
-socat
-openssl
-openssh

Quick install:
become root
cd /usr/local
git clone https://git.nativenet.ch/nativenet.ch/nlvmi.git - you could also just copy everything (expect the webfolder) from the masterserver, but keep the nlvmi bash script in sync after updates!
useradd nlvmi
ln -sf ${PWD}/nlvmi/nlvmi /usr/bin/
ln -sf ${PWD}/nlvmi/wrap-nlvmi /usr/bin/
chown root:nlvmi nlvmi/*nlvmi
chmod +s nlvmi/wrap-nlvmi
mkdir /etc/nlvmi
cp nlvmi/nlvmi.conf /etc/nlvmi/
Now edit /etc/nlvmi/nlvmi.conf and set the IP of the masterserver and the local directories used for images. For multiple iso or image directories, use a semicolon as seperator. You also need to copy /etc/nlvmi/nlvmi_sign.crt from the master server to the node. You should also add the generated ssh key from the masters /home/nlvmi/.ssh/id_rsa.pub to the nodes /home/nlvmi/.ssh/authorized_keys.

If you'd like to autostart some VMs with a boot of the host, you will currently need a cron entry, as there are no initscripts as of now.
su nlvmi
crontab -e
And add this line:
@reboot ( sleep 10s; /usr/bin/nlvmi autostart )

You should also set up some network bridges manually on the host. Please consult your distros documentation on how to do that on your system. During the definition of a vm, you will need the bridge name.

After that, you should be able to access /nlvmi with a webbrowser. Create a new user (first user will be admin who can login to nlvmi) and add a server. For localhost, the connectstring should stay empty.

Do not forget to load the tun and tap kernel modules on the nodes.

It might also be necessary to open up ports on the firewall. On Centos this could be used to do so:
firewall-cmd --zone=public --add-port=5700-6000/tcp --permanent
firewall-cmd --reload