Difference between revisions of "User:Supaplex/my vserver install notes"

From Freeside
Jump to: navigation, search
Line 7: Line 7:
 
# set these accordingly
 
# set these accordingly
 
export guest=fshead
 
export guest=fshead
 +
export guest_dist=etch
 +
export guest_mirror=ftp://mirrors.xmission.com/debian/
  
 
# hint: grep ^iface /etc/network/interfaces
 
# hint: grep ^iface /etc/network/interfaces
# or: export guest_ip=eth0:$(grep ^iface\ eth0: /etc/network/interfaces | tr ':' ' ' | awk '{print $3}' | sort -n | tail -n 1)
+
 
 +
# my shortcuts
 +
export guest_if=eth0:$(grep ^iface\ eth0: /etc/network/interfaces | tr ':' ' ' | awk '{print $3}' | sort -n | tail -n 1)
 +
export guest_ip=$(grep -A 10 ${guest_if} /etc/network/interfaces | perl -ne'print "$1\n" if /^\s*address ([0-9.]+)/' | head -n 1)
 +
export guest_cidr= Net::CIDR anyone? :)
 +
 
 +
# yours
 
export guest_if=
 
export guest_if=
# ifup ${guest_if}
 
 
export guest_ip=
 
export guest_ip=
# or: export guest_ip=$(ifconfig ${guest_if} | grep 'inet addr:' | tr ':' ' ' | awk '{print $3}')
 
 
export guest_cidr=
 
export guest_cidr=
# netmask: ifconfig ${guest_if} | grep Mask: | tr ':' ' ' | awk '{print $7}'
 
 
 
# dnsmasq:
 
echo -e "echo "${guest_ip}"\t"${guest}'>> /etc/hosts && /etc/init.d/dnsmasq restart'
 
  
 
# debootstrap+vserver guest install
 
# debootstrap+vserver guest install
vserver $guest build -m debootstrap -- -d etch -m ftp://mirrors.xmission.com/debian/</code>
+
vserver $guest build -m debootstrap -- -d ${guest_dist} -m ftp://mirrors.xmission.com/debian/</code>
 
cd /etc/vservers/${guest}/
 
cd /etc/vservers/${guest}/
 
echo ${guest} > uts/nodename
 
echo ${guest} > uts/nodename
Line 32: Line 33:
 
echo ${guest_ip} > ip
 
echo ${guest_ip} > ip
 
echo ${guest_cidr} > prefix
 
echo ${guest_cidr} > prefix
 +
 +
guest_vdir=$(readlink /etc/vservers/${guest}/vdir)
 +
 +
echo "deb http://security.debian.org/ etch/updates main contrib non-free"
 +
deb "${guest_mirror}" etch main contrib non-free" > ${guest_vdir}/etc/apt/sources.list.d/${guest_dist}
 +
 +
echo "deb http://420.am/~ivan/freeside-"${guest_dist}"/ ./" > ${guest_vdir}/etc/apt/sources.list.d/freeside
 +
 +
# dnsmasq:
 +
echo -e "echo "${guest_ip}"\t"${guest}'>> /etc/hosts && /etc/init.d/dnsmasq restart'
 +
 +
vserver ${guest} start
 +
vserver ${guest} enter
 +
</pre></code>
 +
 +
 +
<code><pre>
 +
aptitude update
 +
aptitude upgrade
 
</pre></code>
 
</pre></code>

Revision as of 11:17, 1 February 2008

My steps.


# preflight checklist for guest: /etc/network/interfaces dnsmasq:/etc/hosts ip

# set these accordingly
export guest=fshead
export guest_dist=etch
export guest_mirror=ftp://mirrors.xmission.com/debian/

# hint: grep ^iface /etc/network/interfaces

# my shortcuts
export guest_if=eth0:$(grep ^iface\ eth0: /etc/network/interfaces | tr ':' ' ' | awk '{print $3}' | sort -n | tail -n 1)
export guest_ip=$(grep -A 10 ${guest_if} /etc/network/interfaces | perl -ne'print "$1\n" if /^\s*address ([0-9.]+)/' | head -n 1)
export guest_cidr= Net::CIDR anyone? :)

# yours
export guest_if=
export guest_ip=
export guest_cidr=

# debootstrap+vserver guest install
vserver $guest build -m debootstrap -- -d ${guest_dist} -m ftp://mirrors.xmission.com/debian/</code>
cd /etc/vservers/${guest}/
echo ${guest} > uts/nodename

# network setup
mkdir interfaces/0
cd interfaces/0
echo ${guest_if} > dev
echo ${guest_ip} > ip
echo ${guest_cidr} > prefix

guest_vdir=$(readlink /etc/vservers/${guest}/vdir)

echo "deb http://security.debian.org/ etch/updates main contrib non-free"
deb "${guest_mirror}" etch main contrib non-free" > ${guest_vdir}/etc/apt/sources.list.d/${guest_dist}

echo "deb http://420.am/~ivan/freeside-"${guest_dist}"/ ./" > ${guest_vdir}/etc/apt/sources.list.d/freeside

# dnsmasq:
echo -e "echo "${guest_ip}"\t"${guest}'>> /etc/hosts && /etc/init.d/dnsmasq restart'

vserver ${guest} start
vserver ${guest} enter


aptitude update
aptitude upgrade