This is the second part of our tutorial, check out Part 1 if you haven’t already!
If you, the reader, have some server admin-fu and have come to realize that you already know what you are doing, then feel free to either skip this part or consider the end of the post in the previous section. I, the author of said post, do not have any administration-fu and might be saying something professionally wrong here. Feel free to comment on my shortcomings.
Your home directory will be empty; I that recommend you create the “bin”, “sites”, and “envs” directories here.
~/bin/
~/sites/
~/envs/
Apparently, I am also the lazy type to do the same things repeatedly so I created 3 basic bash scripts. 2 independent scripts in case I need to call them independently and 1 script to call both (which is only used on startup). I am giving myself the liberty of posting here the scripts, in case you might want to copy them.
The startup script (filename: init-server):
#!/bin/bash
scriptDir=`dirname $0`
$scriptDir/init-network $scriptDir/init-vboxsfs
The script for initializing the network interfaces (filename: Inuit-network):
#!/bin/bash
ifconfig eth0 192.168.56.2 netmask 255.255.255.0 up dhclient eth1
The script for remounting the shared folders (filename: init-vboxsfs):
#!/bin/bash
declare -A vboxsfs
userId=`id -u vdev` sitesDir=’/home/vdev/sites’ vboxsfs=(\ # Format: # [vboxsf-name]=[mountdir-name]\ )
for vboxsf in ${!vboxsfs[@]}; do mountDir=${vboxsfs[$vboxsf]}
umount $vboxsf
if [ ! -d “$sitesDir/$mountDir” ]; then mkdir “$sitesDir/$mountDir” fi
mount -t vboxsf -o uid=$userId,gid=$userId $vboxsf “$sitesDir/$mountDir”
echo “Mounted ‘$vboxsf’ vboxsf to $sitesDir/$mountDir” done
I will be skipping the part where we mount the shared folders and create a virtualenv. Also, I would also like to assume that Django is already installed and your guest host-only network IP is 192.168.56.2.