Created
July 10, 2011 12:48
-
-
Save philippkueng/1074516 to your computer and use it in GitHub Desktop.
A script to install BlogEngine.NET with Mono and Apache on a fresh Ubuntu 10.04 LTS install.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Variables | |
LOGFILE=/root/blogengine_install.log | |
echo | |
echo | |
echo "Preparing Server for ASP.NET" | |
echo "############################" | |
echo | |
# Check we're running as root | |
if [ "$(id -u)" != "0" ]; then | |
echo "This script must be run as root" | |
exit 1 | |
fi | |
echo "Upgrading Ubuntu" | |
apt-get update >> ${LOGFILE} | |
apt-get upgrade -y >> ${LOGFILE} | |
echo "...done..." | |
echo | |
echo "Installing Apache" | |
apt-get install apache2 -y >> ${LOGFILE} | |
echo "...done..." | |
echo | |
echo "Installing mod_mono" | |
/etc/init.d/apache2 stop >> ${LOGFILE} | |
apt-get install mono-apache-server2 -y >> ${LOGFILE} | |
echo | |
echo | |
echo "*****************************************************************************" | |
echo | |
echo "Please hit 'the return key' 20 seconds from now to continue the installation." | |
echo | |
echo "*****************************************************************************" | |
echo | |
echo | |
apt-get install libapache2-mod-mono >> ${LOGFILE} | |
apt-get install libmono-i18n2.0-cil -y >> ${LOGFILE} | |
/etc/init.d/apache2 start >> ${LOGFILE} | |
echo "...done..." | |
echo | |
echo "Configuring Apache" | |
cat > /etc/apache2/sites-available/blogengine.org << EOF | |
<VirtualHost *:80> | |
ServerName blogengine.org | |
ServerAdmin [email protected] | |
ServerAlias www.blogengine.org | |
DocumentRoot /srv/www/blogengine.org/public_html | |
ErrorLog /srv/www/blogengine.org/logs/error.log | |
CustomLog /srv/www/blogengine.org/logs/access.log combined | |
MonoServerPath blogengine.org "/usr/bin/mod-mono-server2" | |
MonoDebug blogengine.org true | |
MonoSetEnv blogengine.org MONO_IOMAP=all | |
MonoApplications blogengine.org "/:/srv/www/blogengine.org/public_html" | |
<Location "/"> | |
Allow from all | |
Order allow,deny | |
MonoSetServerAlias blogengine.org | |
SetHandler mono | |
SetOutputFilter DEFLATE | |
SetEnvIfNoCase Request_URI "\.(?:gif|jpe?g|png)$" no-gzip dont-vary | |
</Location> | |
<IfModule mod_deflate.c> | |
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript | |
</IfModule> | |
</VirtualHost> | |
EOF | |
mkdir -p /srv/www/blogengine.org/public_html | |
mkdir /srv/www/blogengine.org/logs | |
echo "...done..." | |
echo | |
echo | |
echo | |
echo "Installing BlogEngine" | |
echo "#####################" | |
echo | |
# Because I didn't manage to get it to download from codeplex itself I'm hosting a version myself. | |
# Maybe linking it directly from a github repo is a solution | |
echo "Downloading BlogEngine 1.6.1" | |
wget http://philippkueng.ch/download/blogengine161.zip --no-verbose >> ${LOGFILE} | |
echo "...done..." | |
echo | |
echo "Unzipping and Copying BlogEngine" | |
apt-get install unzip >> ${LOGFILE} | |
unzip blogengine161.zip >> ${LOGFILE} | |
cd BlogEngine.Web | |
cp -R * /srv/www/blogengine.org/public_html | |
echo "...done..." | |
echo | |
echo "Setting the necessary Permissions for BlogEngine to run" | |
mkdir /srv/www/blogengine.org/public_html/setup/Mono | |
cat > /srv/www/blogengine.org/public_html/setup/Mono/mono_install.sh << EOF | |
#!/bin/bash | |
## | |
## BlogEngine.NET Mono Setup Script | |
## | |
## This script will prepare a Mono installation of BlogEngine.NET. See the | |
## ReadMe.txt file in the same directory for instructions on how to use it and | |
## what it does. | |
## | |
## Usage: | |
## ./mono_setup.sh [group_name] | |
## | |
## Step 1 - Create the symlink | |
echo "Creating symlink (bin -> Bin)..." | |
cd ../.. | |
if [ -e bin ]; then | |
echo "bin already exists - nothing done" | |
else | |
ln -s Bin bin | |
echo "Done!" | |
fi | |
echo | |
if [ -z "\$1" ]; then | |
## No group, no changed permissions... | |
echo "No group specified; permissions on App_Data were NOT changed" | |
echo | |
echo "BlogEngine.NET Mono setup completed" | |
exit 0 | |
fi | |
## Step 2 - change the group of App_Data | |
echo "Changing App_Data to group $1..." | |
chgrp -R "\$1" /srv/www/blogengine.org/public_html/App_Data | |
echo "Assigned group write permissions to App_Data..." | |
chmod -R g+w /srv/www/blogengine.org/public_html/App_Data | |
echo "Done!" | |
echo | |
echo "BlogEngine.NET Mono setup completed" | |
exit 0 | |
EOF | |
chmod +x /srv/www/blogengine.org/public_html/setup/Mono/mono_install.sh | |
bash /srv/www/blogengine.org/public_html/setup/Mono/mono_install.sh www-data | |
echo "...done..." | |
echo | |
echo "Enabling the Configuration" | |
/etc/init.d/apache2 restart >> ${LOGFILE} | |
a2ensite blogengine.org >> ${LOGFILE} | |
/etc/init.d/apache2 reload >> ${LOGFILE} | |
a2dissite default >> ${LOGFILE} | |
/etc/init.d/apache2 reload >> ${LOGFILE} | |
echo "...done..." | |
echo | |
echo "Restarting Apache" | |
echo "...done..." | |
echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I would need that but with blogengine.net 3.3.8 (latest version)