PDA

View Full Version : How to install Proxmox KVM VPS Node server?



Fli
05-19-2015, 03:22 PM
What is Proxmox

Proxmox is opensource software for dedicated servers allowing You to create virtual private servers based on both OpenVZ and KVM virtualization. Both at same time are built into Proxmox. In order to make VPS networking working, buy IPs as a subnet (/28 IPv4 for example) as it contains gateway IP, not just IPs alone because u would need to somehow route traffic thru host server (https://pve.proxmox.com/wiki/Network_Configuration#_routed_configuration). // update: here is described (https://forum.online.net/index.php?/topic/4455-howto-proxmox-ip-failover-in-openvz-container-beginners-guide/) (not found? What about this (http://www.maurihost.net/forums/showthread.php/244-Proxmox-IP-Failover-in-OpenVZ-Container-(Beginners-Guide))?) on how to use failover IPs with mac to run VPS.
Proxmox needs hardware raid or a single drive. (SW raid not supported https://pve.proxmox.com/wiki/Software_RAID).

How to install Proxmox

A) download Proxmox .iso image from proxmox.com (https://pve.proxmox.com/wiki/Downloads), burn it on CD and install.
Or attach that .iso image into your server remote console (KVM/IP, IPMI, Dell Drac..) and remotely do installation from the proxmox iso.

B) install proxmox via SSH command line from within Debian [stretch(9), jessie(8), wheezy(7)] Linux.
here is how:
https://pve.proxmox.com/wiki/Install_Proxmox_VE_on_Debian_Stretch
https://pve.proxmox.com/wiki/Install_Proxmox_VE_on_Debian_Jessie
https://pve.proxmox.com/wiki/Install_Proxmox_VE_on_Debian_Wheezy#Install_Proxmo x_V

During install, i used Kimsufi server, 3 primary partitions, 2 ext4 (/ - 15GB and /var/lib/vz rest of space) and one swap - 8GB, no LVM:

# lvs
WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it!
No volume groups found

In above mentioned tutorials they invite to set IP in Linux network configuration, i did it like this (https://internetlifeforum.com/networking/8189-how-change-linux-dedicate-server-ip-another-one-assigned-subnet/).

------

After installation access proxmox web panel:
https://YourServerIP:8006/

Login using server root credentials.

Connection timeout: If you received timeout, try making sure you have used "hostname" command with the hostname without any dots (only first part of th FQDN) and that the hostname is correctly set inside /etc/hosts and /etc/hostname , try "systemctl status pveproxy.service"

One may get error:
"You do not have a valid subscription for this server. Please visit www.proxmox.com (http://www.proxmox.com) to get a list of available options."
To fix, try to backup config file:

cp -p /usr/share/pve-manager/ext4/pvemanagerlib.js /usr/share/pve-manager/ext4/pvemanagerlib.js_bckp
edit it:

nano /usr/share/pve-manager/ext4/pvemanagerlib.js
(if file not found, try /usr/share/pve-manager/js/pvemanagerlib.js)
Ctrl+w
search for:
if (data.status !== 'Active'
Hit enter and edit that line to be:
if (false) {

instead of:
if (data.status !== 'Active') {

Save (Ctrl+x) + y

you may need to clear web browser cache in order to change take effect.

------

Templates and restore

To upload OpenVZ or or .ISO templates into Proxmox, click Datacenter / yourserverhostname / local , and "Upload button". Or you can DL precreated templates by clicking "Template" button. My precreated template did not contained SSh so i had to go to Console of the CT and execute: yum install ssh-server;systemctl restart sshd.
Template paths:
/var/lib/vz/template/cache directory for openvz templates and /var/lib/vz/template/iso directory for ISOs. Then one would be able to select uploaded template during VPS creation.
To restore vzdump-123.tgz OpenVZ backups into Proxmox do "pct restore 105 vzdump-1120.tgz" where the 105 is the CT id which will be automatically created and should not exist on Proxmox, 1120 is the id of openvz CT which was backed up.
Then in proxmox edit this new CT network configuration and then start CT and login via ssh to update IPs inside /etc/hosts file and other files where is old IP. To search whole filesystem for old IP occurences, do: grep -Rl "oldiphere" /

Networking

I had a dedi server on /29 IPv4 subnet and i got assigned another /27 subnet which i wanted to use for VPS's and this is what worked (PS: i was unable to add additional subnets except this single one!):

(the IPs i am mentioning are mine only, you need to use your numbers, to calculate them, try to use: http://www.calculator.net/ip-subnet-calculator.html and http://www.subnet-calculator.com)

Add new Linux bridge and name is vmbr0, the IP address is: 185.176.243.194 (the first usable one and also the first available one of the 185.176.243.192/27 subnet) and the Subnet mask is 255.255.255.224 , do not ticket anything else and confirm bridge be created. then when creating a CT/VPS, on network tab i mention venet0 or eth0 as a network interface name and Bridge is vmbr0, IPv4 is static and i set first available IP from the 185.176.243.192/27 subnet. It is *.195 (entered (185.176.243.195/32 into that IP field), because *.194 is the vmbr0 bridge IP, so the next fisrs available is *.195. Next field on the Network tab when creating new CT/VPS is the gateway IP and there i always set the IP of the vmbr0 bridge, which is in my case (185.176.243.194)
Second necessary step i needed to do in my case (OpenVZ CT's) in order to make VPSs networking work and ping to/from the outside internet was to enable proxy_arp by:
echo 1 > /proc/sys/net/ipv4/conf/eno1/proxy_arp
(update eno1 to your main network interface (eth0, em1 etc)
add:
net.ipv4.conf.all.proxy_arp=1
net.ipv4.conf.default.proxy_arp=1
to /etc/sysctl.conf
sysctl -p
service networking restart
then i also restarted whole host/dedi server: reboot


If there are problems with OpenVZ networking, (can not connect internet) one of possible solutions may be:
(Following information may be usefull, BUT may be also confusing)

In this tutorial (https://www.howtoforge.com/tutorial/how-to-install-proxmox-ve-4-on-debian-8-jessie/) they used GW IP which dedicated server is using (not dedicated server's IP but just one it is using to connect internet; should be mentioned in /etc/network/interfaces), i think it is the second IP of the IPv4 subnet. Example if i have 1.2.3.136/29 subnet, then the GW may be 1.2.3.137.

When creating new VM/CT, use vmbr0 interface. Inside VM/CT, editing /etc/network/interfaces or in case RHEL /etc/sysconfig/network-scripts/ifcfg-eth0 and then adding IPs maybe like this:

auto eth0
iface eth0 inet static
address HereIPYouAssignedToThisVPS
netmask 255.255.255.0
gateway TheGW_IP_Which_YourDediServerIsUsing_OrGWIPOfTheSu bnetOfWhichTHisVPSIsPart
To discover IPs to add, execute this on the dedicated/host server: cat /etc/network/interfaces|grep "gateway" && ifconfig|grep broad
but if VPS IP is in diferent subnet than dedicated host server, maybe use GW IP of the VPS subnet instead of dedicated server subnet. (1.2.3.137 in above example)

- In case of OpenVZ, find VPS .conf file in the /etc/pve/nodes/ subfolders (ls -lt /etc/pve/nodes/*/*) and change "NEIGHBOUR_DEVS=" from "detect" to "all".
If there is still problem (also with KVM networking):
- try enabling "net.ipv4.ip_forward" inside /etc/sysctl.conf and in same file maybe try also adding "net.ipv4.conf.all.forwarding=1". Do "sysctl -p" to apply changes, unsure if "service networking restart" is necessary to apply change.
- another interesting commands:
echo 1 > /proc/sys/net/ipv4/conf/all/proxy_arp
echo 1 > /proc/sys/net/ipv4/ip_forward
sysctl -p
- also one may try editing /etc/network/interfaces and adding following line to the main interface (em1, eth0, eno1..):
post-up echo 1 > /proc/sys/net/ipv4/conf/eth0/proxy_arp
and then service networking restart
- if one setup bridge (example: vmbr0), one may edit network interfaces file and add following lines to this bridge.:
post-up echo 1 > /proc/sys/net/ipv4/ip_forward
post-up iptables -t nat -A POSTROUTING -s '192.168.2.0/24' -o eth0 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s '192.168.2/24' -o eth0 -j MASQUERADE
(maybe replacing 192.168.*.* by real IP of the VPS)

Console and SPICE view for MS Win.

For Proxmox VM console (something like remote desktop) to work, You need Oracle Java plugin installed in your browser. Download & Install Java from http://java.com
After one create new Virtual machine (have touch screen and need visual console, try setting VM for SPICE (https://internetlifeforum.com/virtualisation/7768-proxmox-anyone-know-how-use-spice-console/)), it might be needed to go into virtual machine, go to "Options" tab and set "Start at boot" to Yes and "KVM hardware virtualization" to No (in case your Kernel is lower than 3.1 or your CPU does not support VT-x/AMD-V), in Wikipedia they say: "Hardware-assisted virtualization was added to x86 processors (Intel VT-x or AMD-V) in 2005 and 2006 (respectively)." see https://pve.proxmox.com/wiki/Nested_Virtualization
Else i think Proxmox may return "TASK ERROR: No accelerator found!" on VM start.



Paths to PVE/OVZ/KVM/LXC configuration files here (https://hungred.com/how-to/list-of-proxmox-important-configuration-files-directory/)
IPv6 setup: here (http://wiki.euserv.com/index.php/Manual_Einrichtung_Proxmox/en#Configuration_of_IPv6)

Here is full basic info on proxmox installation (official Wiki): https://pve.proxmox.com/wiki/Installation#Install_Proxmox_VE_server

"Issue discards to PVs that are no longer used by an LV. ... e.g. lvremove, lvreduce .. SSDs and thinly provisioned LUNs generally do (benefit from discards) ... only be used if both the storage and kernel provide support"

ENABLE: vi /etc/lv/lv.conf
find issue_discards variable and change it to 1