SMEServer KVM

From Proxmox VE
Jump to: navigation, search

SMEServer KVM

SMEServer is a SOHO appliance based on CentOS that has webmail, websites (Ibays and file repository), users, groups, PPTP-VPN Server (256 Users), internet gateway, workgroup printing, firewall, Apache/MySQL/PHP, DHCP Server, NTP Server and many addons.

Attempting to follow instructions for enabling php5-mcrypt in SMEServer v8 Beta 5 will lead to dependancy problems as of April 2010. The php v5.2.10 used in this version of SMEServer does not have php5-xmlrpc and many other extensions installed. In fact the php5-curl extension that is compiled in has some quirks when dealing with posting to forms under FOLLOWLOCATION parameter - we must do a further curl exec to the intended follow page as it will not FOLLOWLOCATION even if enabled. This true whether a full yum update is done or not.

SMEServer LVM Recovery

SMEServer stores it's data in LVM2. On corruption of the superblock or metadata use a Knoppix LiveCD for recovery and follow instructions at:

SMEServer LVM Recovery using Knoppix LiveCD

Suggestions

  • Avoid LVM for a VM!
  • To install SMEserver without LVM, use the following command at installation time: "sme nolvm"
  • Better still, use "sme raid=none nolvm"
  • To make manu similar installs of SMEServer, take a "Backup to Desktop" from within the SMEServer's server-manager and restore from it at install time. This will overwrite some files specific to the new install and hence delete them from the backed-up version before restoration. The files to be removed from the backup are:
root/anaconda-ks.cfg
root/install.log
root/install.log.syslog
  • On each clone, re-generate new Self-Signed Certificates with:
rm -f /home/e-smith/ssl.crt/*
rm -f /home/e-smith/ssl.key/*
rm -f /home/e-smith/ssl.pem/*
rm -f /etc/ssh/ssh_host*
signal-event post-upgrade; signal-event reboot

SMEServer v8.0 as KVM in Proxmox VE

To install it as a Server and Gateway, the following steps are needed to get a successful KVM running in Proxmox.

Note that the broadcast entries below will have to be manually put in and the host rebooted.

Working example of a Proxmox host's /etc/network/interfaces file:

 # network interface settings
 auto lo
 iface lo inet loopback
 iface eth0 inet manual
 iface eth1 inet manual
 auto vmbr0
 iface vmbr0 inet static
   address  192.168.12.178
   netmask  255.255.255.0
   gateway  192.168.12.1
   network  192.168.12.0
   broadcast  192.168.12.255
   bridge_ports eth0
   bridge_stp off
   bridge_fd 0
 auto vmbr1
 iface vmbr1 inet static
   address  10.10.10.5
   netmask  255.255.255.0
   broadcast  10.10.10.255
   bridge_ports eth1
   bridge_stp off
   bridge_fd 0

Sequence of connection on SMEServer's WAN Interface:-

 (KVM eth1)
 SME WAN Interface
 192.168.12.x
 vmbr0 (Bridged to ProxMox eth0)
 Internet Router 

Sequence of connection on SMEServer's LAN Interface:-

 (KVM eth0)
 SME LAN Interface
 10.10.10.x
 vmbr1 (Bridged to ProxMox eth1)

Create a KVM with

 IDE HDD >= 20 GB
 2 NICs:-
   vlan0 ->  e1000   -> vmbr0
   vlan1 ->  rtl8139 -> vmbr1 (Add after initial creation from the Hardware tab)
 RAM >= 512 MB
 IDE CDROM -> SME ISO file
 In Options -> Boot from CDROM and then HDD

In the host, checkout the /etc/qemu-server/VEID#.conf where VEID# is the Virtual Machine ID Number.

Working example /etc/qemu-server/101.conf

 name: smetest
 ide2: smeserver-8.0beta4-i386.iso,media=cdrom
 smp: 1
 vlan1: rtl8139=F2:39:0E:D7:01:00
 bootdisk: ide0
 ide0: vm-102-disk.qcow2
 ostype: l26
 memory: 512
 vlan0: e1000=66:6C:7C:87:11:00
 onboot: 1
 description: SME 8.0 beta 4

We notice that the vlan1 was added first and then the vlan0. This is because at the time of KVM creation, we chose vmbr1 for the first NIC (rtl8139) which we intended to use for the SMEServer's LAN Interface. Subsequently we chose vmbr0 for the SMEServer's WAN Interface as it brings in the Internet from the Router above it.

Hence the first ProxMox physical NIC (P-eth0 connected to vmbr0) is on the SMEServer's WAN Interface (S-eth1) and the second one (P-eth1 connecetd to vmbr1) is on the SMEServer's LAN Interface (S-eth0)

During installation and any future (re-)configuration of the SMEServer, we are asked for the LAN Interface first and then for the WAN Interface. At both (LAN and WAN setup) NIC choice menus, we are shown the available NICS arranged in vlan order - as seen from the KVM info from the hosts' /etc/qemu-server/101.conf file above.

We should not assume internal eth# numbering order and mistakenly associate it with the shown NIC's names accordingly. If we do so, we will land up 'plugging' in the wrong interface to the wrong bridge and cause havoc to all actual devices and VMs on the network.

The menu order we will see here is:

 1. e1000 (vmbr0 - host's eth0)
 2. rtl8139 (vmbr1 - host's eth1)

For the LAN setup, we need to choose 2 (as KVM's eth0) and for the WAN setup we need to choose 1 (as KVM's eth1). We are bound to be confused here if we are not careful.

Choose an Administrator's (user root for SSH and admin for Web) Password.

Choose a domain (mydomain.com and a host name (smetest) and our machine will become smetest.mydomain.com

For the LAN we choose the static IP / NM to be 10.10.10.1 / 255.255.255.0 as this will be the Gateway for it's DHCP clients.

We choose a Server and Gateway Installation.

FOR WAN we choose static IP / NM / GW as 192.168.12.150 / 255.255.255.0 / 192.168.12.1

This will get us the Internet for the SME Server and it's DHCP clients.

We enable DHCP server for LAN.

Connect a switch to the Proxmox VE eth1 socket and plug in all the LAN clients into it.

Connect your Proxmox VE eth0 socket to your Router (or Switch to which the Router's LAN side is connected).

We are done! http://SME-LAN-IP/server-manager to manage the SMEServer.

Depending on whether we choose vmbr0 or vmbr1 for the client KVM's NIC, we will get the DHCP from the appropriate DHCP server - from Main Router or from SME Server respectively.

php.ini upload_tmp_dir setting

Only 5 variables in the php.ini file can be set using the setprop commands in SMEServer. Whilst the file upload variable is set to On by default, the upload_tmp_dir variable is not set and hence has no value in a regular install. The following will set it to /home/e-smith/files/tmp for all ibays - if that is what you want. The execute (x) permission is essential for the web server user.

// mkdir -p : no error if existing, make parent directories as needed 
mkdir -p /home/e-smith/files/tmp
chmod 2770 /home/e-smith/files/tmp
chown admin:www /home/e-smith/files/tmp
mkdir -p /etc/e-smith/templates-custom/etc/php.ini
cp /etc/e-smith/templates/etc/php.ini/50PathsDirectories /etc/e-smith/templates-custom/etc/php.ini
echo upload_tmp_dir = \"/home/e-smith/files/tmp\" >> /etc/e-smith/templates-custom/etc/php.ini
expand-template /etc/php.ini
sv t httpd-e-smith

Resources