Development/VM

From Sit

Jump to: navigation, search


This is a guide to standardize new VM's when needed.

This guide is not a step-by-step installation guide for users. It's meant for developers, and therefor not very user friendly.


Contents

VM Minimum specs

  • 15GB SCSI hdd for system (SCSI ID = 0)
  • 60GB SCSI hdd for webroot (SCSI ID = 1)
  • 512MB Ram
  • Network = Bridged
  • Remove all unnessesary hardware (soundcard, floppy drives and USB)
  • Do NOT use VMWare tools since it has to be recompiled when a new kernel is released.

Installation

  • Prefered OS = Ubuntu
  • Do not use the easy installer, install manually
  • Locale should be United Kingdom
  • hostname = sit.localdomain
  • Location = Europe/London
  • use LVM on the system drive
  • Full name = Support Incident Tracker
  • username = sit
  • password = sit
  • No automatic Updates

Software

  • LAMP
  • Mailserver
  • OpenSSH
  • MySQL root password = sit
  • Mail config = Internet

After installation

format the second hdd with ext4 (or higher)

sudo fdisk /dev/sdb
  • n new partition
  • p Primary partition
  • 1 1 partition
  • enter start sector
  • enter end sector
  • w write changes

prepare the disk for LVM

sudo pvcreate /dev/sdb1
sudo vgcreate webroot /dev/sdb1
sudo lvcreate -n www webroot -L 59999M   (1MB less that the disksize, else it'll complain that there isn't enough space)
sudo mkfs.ext4 /dev/webroot/www


Edit fstab to mount the second harddrive to /var/www, it should look something like this

/dev/webroot/www /var/www ext4 rw 0 1


This goes into the user guide of the VM, stored here for now

how to resieze after VM has had the drive resized:

sudo fdisk /dev/sdb
  • d Delete the partition (don't worry data will not be deleted if you do this correct)

Partition 1 should now be deleted

Remake the partition to max size.

  • n new partition
  • p Primary partition
  • 1 1 partition
  • enter start sector
  • enter end sector
  • w write changes
sudo pvresize /dev/sdb1
sudo lvextend -L79999M /dev/webroot/www  (where the new disk size is 80GB if more, subtract 1MB)
sudo resieze2fs /dev/webroot/www


Install additional software

Update with latest patches/software/kernel

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get install php5-ldap php5-imap php5-mcrypt php5-mysql php5-cli

sudo reboot
sudo apt-get autoclean
sudo apt-get autoremove

Check if automount to the new hdd went well

sudo apt-get install phpmyadmin mc subversion
# phpmyadmin configuring: apache2, yes to dbconfig-common, Application password should be randomly generated

Prepare for SiT

Create the database and user

# mysql -u root -psit
mysql> create database sit;
mysql> create user 'sit'@'localhost' identified by 'sit';
mysql> grant all privileges on sit.* to 'sit'@'localhost';
mysql> exit
sudo svn export --force https://sitracker.svn.sourceforge.net/svnroot/sitracker/branches/vm/usr/local/bin /usr/local/bin
sudo svn export --force https://sitracker.svn.sourceforge.net/svnroot/sitracker/branches/vm/usr/share/man/man5 /usr/share/man/man5
sudo svn export --force https://sitracker.svn.sourceforge.net/svnroot/sitracker/branches/vm/etc /etc
sudo chmod ugo+x /usr/local/bin/*

Set the scheduler to run every minute

sudo crontab -e -u www-data
*/1 * * * * /usr/bin/php -f /var/www/auto.php

Remove the noticing in php.ini, add the following to the reporting section.

& ~E_NOTICE

Correct version information Change SiT version

sudo nano /usr/local/bin/sithelp

Change Linux version

sudo nano /etc/issue


Install latest SiT version

sudo sitreset

and enter the latest release when prompted

Create logfile

sudo touch /var/log/sit.log
sudo chown www-data:www-data /var/log/sit.log

Add the logfile to logrotation

sudo nano /etc/logrotate.conf

Add the following to the last line of the file

/var/log/sit.log {
    missingok
    compress
    size 10M
    create 660 www-data:www-data
    count 10
}

Open a browser and finish off the installation, admin password should be set to sit Edit logfile settings, and point it to /var/log/sit.log

Final step: Cleanup and prepare for shipping

sudo cleanup
sudo history -c
history -c
sudo shutdown -h now

Packing up and shipping

  • With the VMware Player (or Server etc), edit the VM and edit harddrives, compress them both (can be found in utilities)
  • Compress the SiT folder containing the VM with 7zip, Ultra compression (LZMA) and Save it as VMware_SiT_vX.XX.7z
  • Create a MD5 hash of the compressed file and name it VMware_SiT_vX.XX.7z.md5
  • Upload the 2 files to the sitracker homepage, and upload it to Sourceforge.
  • Modify VM to point to the newest upload
  • Change the [VMware] appliance site to use the new link from SF

Personal tools
project