Thursday, May 7, 2015

Install proxmox on debian

#reinstall debian minimal 64 bit

nano /etc/hosts
#tambahkan
192.168.6.177 proxmox-6-177.proxmox.com proxmox-6-177 pvelocalhost

nano /etc/apt/sources.list
#tambahkan
deb http://ftp.at.debian.org/debian wheezy main contrib
# PVE repository provided by proxmox.com, only for installation (this repo will stay on 3.1)
deb http://download.proxmox.com/debian wheezy pve
# security updates
deb http://security.debian.org/ wheezy/updates main contrib

wget -O- "http://download.proxmox.com/debian/key.asc" | apt-key add -
apt-get update && apt-get dist-upgrade -y

apt-get install -y pve-firmware pve-kernel-2.6.32-26-pve pve-headers-2.6.32-26-pve
reboot
uname -a
#Linux ...-pve

apt-get remove linux-image-amd64 linux-image-3.2.0-4-amd64 linux-base
update-grub
apt-get install -y proxmox-ve-2.6.32 ntp ssh lvm2 postfix ksm-control-daemon vzprocps open-iscsi bootlogd

==

nano /etc/init.d/vz-routing

#!/bin/sh
case "$1" in
 start) echo "vz-routing started"
# It's important that you change the SNAT IP to the one of your server (not the local but the internet IP)
# The following line adds a route to the IP-range that we will later assign to the VPS. That's how you get internet access on # your VPS.
/sbin/iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -o eth0 -j SNAT --to ip-of-your-server

# These are the rules for any port forwarding you want to do
# In this example, all traffic to and from the ports 11001-11019 gets routed to/from the VPS with the IP 10.0.0.1.
# Also the port 11000 is routed to the SSH port of the vps, later on you can ssh into your VPS through yourip:11000

/sbin/iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 11000 -j DNAT --to 10.0.0.1:22
/sbin/iptables -t nat -A PREROUTING -i eth0 -p udp --dport 11001:11019 -j DNAT --to 10.0.0.1
/sbin/iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 11001:11019 -j DNAT --to 10.0.0.1

# In my case I also dropped outgoing SMTP traffic, as it's one of the most abused things on servers

/sbin/iptables -A FORWARD -j DROP -p tcp --destination-port 25
/sbin/iptables -A FORWARD -j DROP -p tcp --destination-port 2525
/sbin/iptables -A FORWARD -j DROP -p tcp --destination-port 587
/sbin/iptables -A FORWARD -j DROP -p tcp --destination-port 465
/sbin/iptables -A FORWARD -j DROP -p tcp --destination-port 2526
/sbin/iptables -A FORWARD -j DROP -p tcp --destination-port 110
/sbin/iptables -A FORWARD -j DROP -p tcp --destination-port 143
/sbin/iptables -A FORWARD -j DROP -p tcp --destination-port 993

;;

*) echo "Usage: /etc/init.d/vz-routing {start}"
exit 2
;;

esac
exit 0

chmod u+x /etc/init.d/vz-routing
/etc/init.d/vz-routing start

#kalo ok
update-rc.d vz-routing defaults

#change port vnc di /usr/bin/vncserver

#download n create container dg routed mode
#http://download.proxmox.com/appliances/system/
cd /var/lib/vz/template/cache/
wget -c -t inf -b http://download.openvz.org/template/precreated/ubuntu-14.04-x86-minimal.tar.gz

#create container
apt-get install --no-install-recommends xinit xserver-xorg-video-intel xserver-xorg-input-synaptics xserver-xorg-input-kbd xserver-xorg-input-mouse xfonts-base openbox lxpanel wine

#copy container 100 sbg template
cd /var/lib/vz/private/100 
tar -cvzpf /var/lib/vz/template/cache/dari101.tar.gz .

# isi xstartup
root@satu:~/.vnc# cat xstartup
#!/bin/sh

xrdb $HOME/.Xresources
xsetroot -solid grey
#x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &
# Fix to make GNOME work
export XKL_XMODMAP_DISABLE=1
#/etc/X11/Xsession
#/usr/bin/startx &
lxpanel &
openbox &
wine c:\\Program\ Files\\FXDD\ Malta\ -\ MetaTrader\ 4\\terminal.exe

#- end -

======quota===
1. Install rrdtool and PHP support

apt-get install rrdtool php5

2. Download the bandwidth collection script and Web UI

wget http://www.aip.im/downloads/vzmonitor.tar.gz

3. Unpack and relocate

tar zxvf vzmonitor.tar.gz
mkdir /usr/local/bandwidth
mv bandwidth /usr/local/bandwidth/
mv vzmonitor /var/www/

4. Create a cron job to collect the data every 5 minutes (crontab -e)

*/5 * * * * cd /usr/local/bandwidth;./bandwidth.sh &> /dev/null

5. Add config to Apache (pico /etc/apache2/conf.d/vzmonitor.conf)

Alias /vzmonitor /var/www/vzmonitor


DirectoryIndex index.php


6. Restart Apache

/etc/init.d/apache2 restart

7. It's ready, wait a few minutes and enter this location to view the bandwidth usage: http://yourserver/vzmonitor









No comments:

Post a Comment