Last active
November 14, 2015 19:54
-
-
Save Tehnix/4493bcb60420b6d2c450 to your computer and use it in GitHub Desktop.
Bash script to install Anope IRC Services 2.0.2 on an AWS Linux AMI.
This file contains hidden or 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
# This script will install Anope IRC Services on an AWS Linux AMI by: | |
# 0.1) Create an AWS Linux EC2 instance, with S3 read access (IAM roles)) | |
# 0.2) Set up UnrealIRCd | |
# 1) Installing the necessary packages with yum | |
# 2) Downloading anope | |
# 3) Configuring and installing anope | |
# 4.1) Download configuration files from S3, add init script and start it | |
# 4.2) Alternatively, do it manually | |
# | |
# S3 assumes the file is called anope-$ANOPE_VERSION-rc3-conf.tar.gz, and is unpacked to | |
# anope-conf`. | |
# | |
# NOTE: Expects root priviliges i.e. `sudo install-anope.sh` | |
# | |
# Anope version | |
ANOPE_VERSION="2.0.2" | |
# Operating system (used for init script) | |
OS="centos" | |
# AWS S3 bucket configuration | |
USE_AWS="yes" # set to no, if you don't want to use S3 | |
AWS_S3_BUCKET="irc.codetalk.io/config" | |
AWS_S3_REGION="eu-central-1" | |
# Set the correct locale environment | |
ENV LC_ALL C | |
# Make sure the ircd group exists | |
groupadd ircd | |
# Install necessary packages and clean up afterwards | |
INSTALL_COMPLETE="no" | |
yum -y upgrade \ | |
&& yum -y install cmake \ | |
&& yum -y autoremove \ | |
&& curl -L https://github.com/anope/anope/releases/download/$ANOPE_VERSION/anope-$ANOPE_VERSION-source.tar.gz | tar xz \ | |
&& cd anope-$ANOPE_VERSION-source \ | |
&& mv modules/extra/m_ssl_openssl.cpp modules/ \ | |
&& mv modules/extra/m_sasl_dh-aes.cpp modules/ \ | |
&& mkdir build \ | |
&& cd build \ | |
&& cmake \ | |
-DINSTDIR:STRING=/etc/anope \ | |
-DDEFUMASK:STRING=077 \ | |
-DCMAKE_BUILD_TYPE:STRING=RELEASE \ | |
-DUSE_RUN_CC_PL:BOOLEAN=ON \ | |
-DUSE_PCH:BOOLEAN=ON .. \ | |
&& make \ | |
&& make install \ | |
&& echo "\n\nDone installing" \ | |
&& INSTALL_COMPLETE="yes" | |
if [ "$INSTALL_COMPLETE" == "yes" ]; then | |
if [ "$USE_AWS" == "yes" ]; then | |
# Download and move the configuration files into place, from S3 (assuming EC2 roles are set) | |
cd /etc/anope \ | |
&& aws s3 cp --region $AWS_S3_REGION s3://$AWS_S3_BUCKET/anope-$ANOPE_VERSION-conf.tar.gz anope-$ANOPE_VERSION-conf.tar.gz \ | |
&& tar xf anope-$ANOPE_VERSION-conf.tar.gz \ | |
&& rm -f anope-$ANOPE_VERSION-conf.tar.gz \ | |
&& rm -rf conf \ | |
&& mv anope-conf/anope-$OS.init /etc/init.d/anope \ | |
&& mv anope-conf conf \ | |
&& echo "\nConfiguration has been downloaded and moved into place." \ | |
&& chmod +x /etc/init.d/anope \ | |
&& chkconfig --add anope \ | |
&& service anope start \ | |
&& echo "Anope IRC services have been started" | |
else | |
# Additional steps for manual configuration | |
echo "Anope now needs to be configured. You can find most files at /etc/anope/conf." | |
echo "\nIt is recommended to add the following via 'crontab -e'" | |
echo " 5 * * * * /etc/anope/conf/services.chk >/dev/null 2>&1" | |
echo "and then running 'crontab -l'" | |
fi | |
else | |
echo "\n\nSomething went wrong during the install. Please check the output." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Check out the gist on installing UnrealIRCd.