Installing Mono on Amazon Linux AMI

amazon ec2amazon-amimono

I am trying to setup an Amazon EC2 AMI (details) with Mono 2.8.2 on it by following this guide. I've run into a couple of issues with it.

Issue One

I get a Permission Denied error When I try to do the following steps

cat >>/etc/profile.d/mono_path.sh
export PATH=$PATH:/opt/mono-2.8.1/bin
export PKG_CONFIG_PATH=/opt/mono-2.8.1/lib/pkgconfig/:$PKG_CONFIG_PATH

Even doing sudo cat >>/etc/profile.d/mono_path.sh resulted in the same Permission Denied error so I decided to use VI to create a /etc/profile.d/mono_path.sh and added in the above two lines to it.

Issue Two

When trying to install XSP-2.8.1 I need to use sudo to run the following command

./configure –prefix=/opt/mono-2.8.1

It fails with the following error output

[ec2-user@ip-10-245-39-133 xsp-2.8.1]$ sudo ./configure –prefix=/opt/mono-2.8.1
checking build system type… i686-pc-linux-gnu
checking host system type… i686-pc-linux-gnu
checking target system type… i686-pc-linux-gnu
checking for a BSD-compatible install… /usr/bin/install -c
checking whether build environment is sane… yes
checking for a thread-safe mkdir -p… /bin/mkdir -p
checking for gawk… gawk
checking whether make sets $(MAKE)… yes
checking whether to enable maintainer-specific portions of Makefiles… no
checking for a BSD-compatible install… /usr/bin/install -c
checking for pkg-config… /usr/bin/pkg-config
checking if tracing is requested… no
checking for csc… no
checking for gmcs… no
checking for dmcs… no
checking for runtime in the installation prefix… /opt/mono-2.8.1/bin/mono
checking for gacutil… no
checking for sn… no
configure: error: No C# compiler found

Now I have no idea how to get around this issue. Any help would be appreciated.

Best Answer

sudo cat >>/etc/profile.d/mono_path.sh only runs cat as root, with the redirection happening as the original user. The equivalent in sudoland is cat | sudo tee -a /etc/profile.d/mono_path.sh