From OrganicDesign Wiki
#!/bin/bash
# FIRST:
# - Make sure time is set correctly before wiki install
# Use tzconfig to set local timezone (system clock should be UTC)
# - Ensure all router pinholes are dealt with now, 22, 80, 443, 1729
# Upgrade repositories
apt-get update
apt-get upgrade
# General utils
apt-get install build-essential p7zip-full bzip2 rar htmldoc subversion
# SSH config (/etc/ssh/sshd_config)
# - change port away from 22
# - don`t allow root login
# - AllowUsers bob sally sam etc
# -------------------------------------------------------------------------------- #
# LAN - if you`re serving the site from LAN
apt-get install dhcp3-server bind9 ipmasq
# here`s a typical port-forward to a machine on the internal LAN for bit-torrent clients etc
# nano /etc/ipmasq/F10portfw.rul (probably any Fxx file will do)
# $IPTABLES -A FORWARD -i eth1 -o eth0 -p tcp --dport 32459 -j ACCEPT
# $IPTABLES -A PREROUTING -t nat -p tcp --dport 32459 -j DNAT --to-destination 192.168.1.107
# /etc/init.d/ipmasq restart
# -------------------------------------------------------------------------------- #
# MAIL
dpkg-reconfigure exim4-config
apt-get install dovecot-common dovecot-imapd dovecot-pop3d
# create local password file
echo "$USER:{PLAIN}password" > /etc/passwd.dovecot
# modify /etc/dovecot/dovecot.conf
vi /etc/dovecot/dovecot.conf
# modify this section
auth default {
..
passdb passwd-file {
args = /etc/passwd.dovecot
}
..
# Also comment out passdb pam
# Verify with dovecot -n that the output looks like this:
/*
...
auth default:
passdb:
driver: passwd-file
args: /etc/passwd.dovecot
userdb:
driver: passwd
*/
# in dovecot.conf set disable_plaintext_auth = no (INSECURE)
# uncomment this line
# mail_location = mbox:/var/mail/%d/%1n/%n:INDEX=/var/indexes/%d/%1n/%n
# -------------------------------------------------------------------------------- #
# LAMP & Wiki necessities
apt-get install mysql-server-5.0 apache2 libapache2-svn libapache2-mod-php5 php5-mysql php5-gd php5-xsl php5-curl php5-sqlite3 imagemagick librsvg2-bin
a2enmod ssl
a2enmod rewrite
a2enmod dav
a2enmod dav_fs
a2enmod dav_svn
# Create a self-signed certificate in /var/www (see http://www.technocage.com/~caskey/openssl)
openssl req -new -newkey rsa:1024 -days 3650 -nodes -x509 -keyout www.organicdesign.co.nz.pem -out www.organicdesign.co.nz.pem
# Apache
# copy add-db, backup.pl and rewrite.pl into /var/www
# Add a crontab entry for daily backup, eg: 0 3 * * * root /var/www/backup.pl
# replace the default virtual-host (/etc/apache2/sites-available/default) with the content from organicdesign.vhost
/etc/init.d/apache2 restart
# Perl
apt-get install libwww-perl libio-socket-ssl-perl perlmagick libtimedate-perl libnet-scp-expect-perl
# Reduce MySQL memory usage with the following (mainly for low RAM VPS)
# - uncomment "skip-innodb" in /etc/mysql/my.cnf
# - ensure bind-address is set to 127.0.0.1 if remote access not required
# Set root passwd
mysqladmin -u root -p password *******
or SET PASSWORD FOR root@localhost=PASSWORD('*****');
# Create DB from backup - first create database your-wiki-db
mysql -u root -p your-wiki-db < backup.sql
or gunzip < backup.tgz | mysql -u root -p your-wiki-db
# If you need math rendering in your wiki (NOTE: this may be legacy test if needed first)
apt-get install dvipng tetex-extra cjk-latex ocaml
cd ....wiki/math
make
# Add these to LocalSettings.php
# $wgUseTeX = true;
# $wgMathPath = "$wgScriptPath/images/math";
# $wgTmpDirectory = "$IP/tmp";
# $wgMathDirectory = "$IP/images/math";
# -------------------------------------------------------------------------------- #
# SVN
mkdir /var/svn
svnadmin create --fs-type fsfs /var/svn/www
addgroup subversion
addgroup <username> subversion
chown -R www-data:subversion /var/svn/*
chmod -R 770 /var/svn/*
# -------------------------------------------------------------------------------- #
# R statistical programming environment
apt-get install r-base
# See article history for removed unused items