Skip to content

Instantly share code, notes, and snippets.

@Jinkxed
Last active August 29, 2015 14:02
Show Gist options
  • Save Jinkxed/8fca8b6126f1400b9c93 to your computer and use it in GitHub Desktop.
Save Jinkxed/8fca8b6126f1400b9c93 to your computer and use it in GitHub Desktop.
Node-Mono-Edge on Amazon Linux (Redhat/CentOS) Bootstrap
#!/bin/bash
export PATH=$PATH:/usr/local/bin
THE_USER=`whoami`
set -e
sudo -u ${THE_USER} mkdir tmp
# install prerequisities
sudo yum install -y curl tar wget unzip glib2-devel libpng-devel libjpeg-devel giflib-devel libtiff-devel libexif-devel libX11-devel fontconfig-devel gettext make gcc-c++
sudo yum groupinstall 'Development Tools' -y
# build libgdiplus
curl -O http://download.mono-project.com/sources/libgdiplus/libgdiplus-2.10.9.tar.bz2
bunzip2 libgdiplus-2.10.9.tar.bz2
tar xvf libgdiplus-2.10.9.tar
cd libgdiplus-2.10.9
export 'echo=echo'
sudo -u ${THE_USER} bash -c './configure --prefix=/usr/local'
sudo sed 's/LIBS = -lpthread -lfontconfig/LIBS = -lpthread -lfontconfig -lglib-2.0 -lX11/g' -i tests/Makefile
make
sudo make install
cd ..
# download and build Node.js
sudo -u ${THE_USER} curl https://codeload.github.com/joyent/node/tar.gz/v0.10.29 > node.v0.10.29.tar.gz
sudo -u ${THE_USER} tar -xvf node.v0.10.29.tar.gz
cd node-0.10.29/
sudo -u ${THE_USER} bash -c './configure'
sudo make
sudo make install
cd ..
# install node-gyp mocha pm2
sudo /usr/local/bin/npm install node-gyp -g
sudo /usr/local/bin/npm install mocha -g
sudo /usr/local/bin/npm install pm2@latest -g
# download and build Mono x64
sudo -u ${THE_USER} curl http://download.mono-project.com/sources/mono/mono-3.4.0.tar.bz2 > mono-3.4.0.tar.bz2
sudo -u ${THE_USER} tar -xvf mono-3.4.0.tar.bz2
sudo -u ${THE_USER} curl https://raw.githubusercontent.com/tjanczuk/edge/master/tools/Microsoft.Portable.Common.targets > ./mono-3.4.0/mcs/tools/xbuild/targets/Microsoft.Portable.Common.targets
cd mono-3.4.0
# see http://stackoverflow.com/questions/15627951/mono-dllnotfound-error
sudo -u ${THE_USER} bash -c 'sed -i "s/\@prefix\@\/lib\///g" ./data/config.in'
sudo -u ${THE_USER} bash -c './configure --prefix=/usr/local --with-glib=embedded --enable-nls=no'
sudo make
sudo make install
echo "export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig" >> ~/.bashrc
echo "export LD_LIBRARY_PATH=/usr/local/lib" >> ~/.bashrc
echo "export MONO_PATH=$MONO_PATH:/home/eventstore/NodeProcessorHost/native/BatchEmailSend:/home/eventstore/NodeProcessorHost/native/EventCapture" >> ~/.bashrc
source ~/.bashrc
sudo ldconfig
cd ..
# download and build Edge.js
sudo -u ${THE_USER} curl https://codeload.github.com/tjanczuk/edge/zip/master > edge.js.zip
sudo -u ${THE_USER} unzip edge.js.zip
cd edge-master/
npm install
npm test
# download and build eventstore
mkdir eventstore-mono-2.0.1
cd eventstore-mono-2.0.1
sudo -u ${THE_USER} curl http://download.geteventstore.com/binaries/eventstore-mono-2.0.1.tgz > eventstore-mono-2.0.1.tgz
tar -xvf eventstore-mono-2.0.1.tgz
cd ..
@jwhitmarsh
Copy link

Hi Chad, sorry I realise this is over a year old, but are you still maintaining mono on a linux environment? We're really struggling to get mono installed, and this gist is the closest we've come, but it falls over when creating the make file for libgdiplus....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment