Hello there!
Here I will explain how to install Proxmox VE on any dedicated server with a recovery system witch you can activate using the provider’s control panel (witch in my case is a Ubuntu OS loaded into the ram). This is the only way you can make a custom partitioning on these systems because they do not offer any custom OS installation as they only offer pre-built templates.
Please note that this is not entirely my work as I am taking part from some websites I found that helped me do this on my provider. I used this document from the debian website and the other part from hackerlab.
Partitioning the hard drive
You can use any method to partition your hard drive but for me I used parted which i find easier to use.
# parted /dev/sda
Now we need to see the current partitions on the disk so we can remove them to be able to create new ones afterwards
(parted) print
And to delete any partitions on the disk you simply write:
(parted) rm x
Witch x is the partition numbers.
Now we need to partition this hard drive! I used only one partition for the root system as i do not find any advantage to make separate partitions for / , /boot etc…
(parted) mkpart primary ext3 0 100G
You can put any size of your choice here but I decided to make it 100 GB because I want to put the iso and templates here so I want to be sure I have enough space… Now we create another partition for the swap:
(parted) mkpart primary ext2 100G 132G
You should make a swap partition equal to the size of your ram. In my case i have 32 GB of ram.
The last partition will be the rest of the disk and this one need to be labelled as LVM that will be the only thing we will do to this partition for now as we will need tools to create logical volume later which it need the actual OS to be booted up.
(parted) mkpart primary ext2 132G 1800G
Since we are already in the partitioning tool we will label it as LVM right away by doing this
(parted) set 3 lvm on
Now we can exit parted by doing: q then enter.
Before doing anything else we need to create the ext3 filesystem onto the new / partition we created. This will take a little moment to create.
# mke2fs -j /dev/sda1
Now we need to activate the spwap
# mkswap /dev/sda2
# sync; sync; sync # swapon /dev/sda2
Mount one partition as
/mnt/debinst
(the installation point, to be the root (/
) filesystem on your new system).
# mkdir /mnt/debinst # mount /dev/sda1 /mnt/debinst
Note:
If you want to have parts of the filesystem (e.g. /usr) mounted on separate partitions, you will need to create and mount these directories manually before proceding with the next stage.
Install debootstrap
The utility used by the Debian installer, and recognized as the official way to install a Debian base system, is debootstrap. It uses wget and ar, but otherwise depends only on /bin/sh
and basic Unix/Linux tools. Install wget and ar if they aren’t already on your current system, then download and install debootstrap.
Or, you can use the following procedure to install it manually. Make a work folder for extracting the .deb into:
# mkdir work # cd work
The debootstrap binary is located in the Debian archive (be sure to select the proper file for your architecture). Download the debootstrap .deb from the pool, copy the package to the work folder, and extract the files from it. You will need to have root privileges to install the files.
# ar -x debootstrap_0.X.X_all.deb # cd / # zcat /full-path-to-work/work/data.tar.gz | tar xv
Run debotstrap
debootstrap can download the needed files directly from the archive when you run it. You can substitute any Debian archive mirror for http.us.debian.org/debian
in the command example below, preferably a mirror close to you network-wise. Mirrors are listed at http://www.debian.org/mirror/list.
If you have a squeeze Debian GNU/Linux CD mounted at /cdrom
, you could substitute a file URL instead of the http URL: file:/cdrom/debian/
# /usr/sbin/debootstrap --arch amd64 squeeze \ /mnt/debinst http://ftp.us.debian.org/debian
Before we CHROOT into the installation, we need to copy the devices from the working host.
cd /dev; cp -rf * /mnt/debinst/dev
Configure The Base System
Now you’ve got a real Debian system, though rather lean, on disk. chroot into it:
# LANG=C chroot /mnt/debinst /bin/bash
After chrooting you may need to set the terminal definition to be compatible with the Debian base system, for example:
# export TERM=xterm-color
Mount Partitions
You need to create /etc/fstab
.
# editor /etc/fstab
Here is a sample you can modify to suit:
# /etc/fstab: static file system information. # # file system mount point type options dump pass /dev/XXX / ext3 defaults 0 1 /dev/XXX /boot ext3 ro,nosuid,nodev 0 2 /dev/XXX none swap sw 0 0 proc /proc proc defaults 0 0 /dev/fd0 /media/floppy auto noauto,rw,sync,user,exec 0 0 /dev/cdrom /media/cdrom iso9660 noauto,ro,user,exec 0 0 /dev/XXX /tmp ext3 rw,nosuid,nodev 0 2 /dev/XXX /var ext3 rw,nosuid,nodev 0 2 /dev/XXX /usr ext3 rw,nodev 0 2 /dev/XXX /home ext3 rw,nosuid,nodev 0 2
Use mount -a
to mount all the file systems you have specified in your /etc/fstab
, or, to mount file systems individually, use:
# mount /path # e.g.: mount /usr
Current Debian systems have mountpoints for removable media under /media
, but keep compatibility symlinks in /
. Create these as as needed, for example:
# cd /media # mkdir cdrom0 # ln -s cdrom0 cdrom # cd / # ln -s media/cdrom
You can mount the proc file system multiple times and to arbitrary locations, though /proc
is customary. If you didn’t use mount -a
, be sure to mount proc before continuing:
# mount -t proc proc /proc
The command ls /proc
should now show a non-empty directory. Should this fail, you may be able to mount proc from outside the chroot:
# mount -t proc proc /mnt/debinst/proc
Setting Timezone
An option in the file /etc/default/rcS
determines whether the system will interpret the hardware clock as being set to UTC or local time. The following command allows you to set that and choose your timezone.
# editor /etc/default/rcS # dpkg-reconfigure tzdata
Configure Networking
To configure networking, edit /etc/network/interfaces
, /etc/resolv.conf
, /etc/hostname
and /etc/hosts
.
# editor /etc/network/interfaces
Here are some simple examples from /usr/share/doc/ifupdown/examples
:
###################################################################### # /etc/network/interfaces -- configuration file for ifup(8), ifdown(8) # See the interfaces(5) manpage for information on what options are # available. ###################################################################### # We always want the loopback interface. # auto lo iface lo inet loopback # To use dhcp: # # auto eth0 # iface eth0 inet dhcp # An example static IP setup: (broadcast and gateway are optional) # # auto eth0 # iface eth0 inet static # address 192.168.0.42 # network 192.168.0.0 # netmask 255.255.255.0 # broadcast 192.168.0.255 # gateway 192.168.0.1
Enter your nameserver(s) and search directives in /etc/resolv.conf
:
# editor /etc/resolv.conf
A simple example /etc/resolv.conf
:
search hqdom.local nameserver 10.1.1.36 nameserver 192.168.9.100
Enter your system’s host name (2 to 63 characters):
# echo DebianHostName > /etc/hostname
And a basic /etc/hosts
127.0.0.1 localhost
192.168.0.42 DebianHostName < This is really important! if you do not do this proxmox installation will fail!
Configure Apt
Debootstrap will have created a very basic /etc/apt/sources.list
that will allow installing additional packages. However, we need to install proxmox ve right? So why don’t we add the correct repository right now?:
deb http://ftp.us.debian.org/debian squeeze main contrib
# PVE packages provided by proxmox.com
deb http://download.proxmox.com/debian squeeze pve
# security updates
deb http://security.debian.org/ squeeze/updates main contrib
Then add the Proxmox VE repository key:
wget -O- "http://download.proxmox.com/debian/key.asc" | apt-key add -
Make sure to run aptitude update
after you have made changes to the sources list.
Install a Kernel
If you intend to boot this system, you probably want a Linux kernel and a boot loader. Identify available pre-packaged kernels with:
# apt-cache search linux-image
Then install the amd64 kernel package needed to boot up the server.
# aptitude install linux-image-2.6.32-amd64
Set up the Boot Loader
To make your Debian GNU/Linux system bootable, set up your boot loader to load the installed kernel with your new root partition. Note that debootstrap does not install a boot loader, though you can use aptitude inside your Debian chroot to do so.
Installing and setting up grub
is as easy as:
# mount -t sysfs sysfs /sys # aptitude install grub # grub-install /dev/hda
# update-grub
The second command will install grub (in this case in the MBR of hda
). The last command will create a sane and working /boot/grub/menu.lst
.
Note that this assumes that a /dev/hda
device file has been created. There are alternative methods to install grub, but those are outside the scope of this appendix.
Before we reboot the system and start the proxmox installation we need to set the password for the root user and install ssh so you can access you server from putty or any other ssh app.
# passwd root >thepassworyouwant >again
To install ssh simply type:
# aptitude install ssh
Now you can reboot and see if everything work. When the system boot we will be able to create the Logical volumes on the third partition we created earlier.
Configuring LVM
Now that we are in a working debian installation, we can now access it via ssh.
The first thing we need to do is install the required tools to work with lvm:
# apt-get install lvm2 dmsetup mdadm reiserfsprogs xfsprogs
Now lets prepare our partition for lvm:
# pvcreate /dev/sda3
Then we will create a volume group called pve-vg (you can call it whatever you ant):
# vgcreate pve-vg /dev/sda3
Then we will create 2 logical volumes, one for the containers and one for the vzdump each one have half the size of the partition:
# lvcreate --name pve --size 850G pve-vg# lvcreate --name vzdump --size 850G pve-vg
Now we will make these partition mountable at boot time:
# mkdir /vzdump# mkdir /var/lib/vz
Your /etc/fstab file should look similar to this:
# /etc/fstab: static file system information. # # file system mount point type options dump pass /dev/sda1 / ext3 defaults 0 1 /dev/sda2 none swap sw 0 0/dev/pve-vg/pve /var/lib/vz ext3 defaults 0 0 /dev/pve-vg/vzdump /vzdump ext3 defaults 0 0
Then we mount all partition:
# mount -a
Now you should start following this guide on the proxmox ve wiki: http://pve.proxmox.com/wiki/Install_Proxmox_VE_on_Debian_Squeeze
Enjoy!