Skip to content

Instantly share code, notes, and snippets.

Created December 12, 2012 07:11
Show Gist options
  • Select an option

  • Save anonymous/4265730 to your computer and use it in GitHub Desktop.

Select an option

Save anonymous/4265730 to your computer and use it in GitHub Desktop.
Install script for Newznab on AWS EC2 & RDS. This script assumes you have: * Created a new EC2 instance using the Amazon Linux AMI * Allowed port 80 and 443 access to the new instance * Created an EBS and attached it to /dev/sdh on the new instance * Created a new RDS instance in the same region * Created a new RDS security group which allows ac…
#!/bin/bash
############################## READ ME ###################################
#
# Ensure you have:
# Created a new EC2 instance using the Amazon Linux AMI
# Allowed port 80 and 443 access to the new instance
# Created an EBS and attached it to /dev/sdh on the new instance
# Created a new RDS instance in the same region
# Created a new RDS security group which allows access from the EC2
#
##########################################################################
sudo mkfs.ext3 /dev/sdh
sudo mkdir -p /mnt/www
sudo mkdir -p /mnt/www/nzbfiles/
sudo chmod -R 777 /mnt/www/nzbfiles/
sudo mount -t ext3 /dev/sdh /mnt/www
#### auto mount ####
sudo cat > /etc/fstab <EOF
/dev/sdh /mnt/www ext3 defaults 1 1
EOF
echo "Download remi repos"
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
sudo yum install -y wget nano unzip unrar
echo "Insall unrar"
cd /tmp
sudo wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm
sudo rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
sudo rpm -i rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm
sudo yum install -y rar unrar
echo "Install PHP and Apache"
sudo yum --enablerepo=remi,remi-test install -y httpd php php-common php-cli php-pear php-gd php-mbstring php-mcrypt php-xml php-devel php-mysql php-pdo ImageMagick2 php-pecl-imagick php-pecl-mongo
sudo yum --enablerepo=remi,remi-test install -y php-pecl-apc
sudo yum --enablerepo=remi,remi-test install -y php-posix
sudo perl -p -i -e 's/post_max_size = .*M/post_max_size = 500M/' /etc/php.ini
sudo perl -p -i -e 's/upload_max_filesize = .*M/upload_max_filesize = 500M/' /etc/php.ini
sudo perl -p -i -e 's/memory_limit = .*M/memory_limit = 256M/' /etc/php.ini
sudo perl -p -i -e 's/;date\.timezone =/date\.timezone = UTC/' /etc/php.ini
sudo perl -p -i -e 's/max_execution_time = .*/max_execution_time = 60/' /etc/php.ini
sudo chkconfig httpd on
echo "Install Newznab"
sudo yum install -y subversion
sudo mkdir -p /mnt/www/nnplus
cd /mnt/www/nnplus
sudo svn co svn://svn.newznab.com/nn/branches/nnplus /mnt/www/nnplus
sudo cat > /etc/httpd/conf.d/nnplus.conf <<EOF
<VirtualHost *:80>
DocumentRoot "/mnt/www/nnplus/www"
ServerAlias nnplus.com
<Directory "/mnt/www/nnplus">
EnableSendfile off
Options Indexes
</Directory>
<Directory "/mnt/www/nnplus/www">
EnableSendfile off
RewriteEngine On
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
EOF
sudo chmod 777 /mnt/www/nnplus/www/lib/smarty/templates_c
sudo chmod 777 /mnt/www/nnplus/www/covers/movies
sudo chmod 777 /mnt/www/nnplus/www/covers/anime
sudo chmod 777 /mnt/www/nnplus/www/covers/music
sudo chmod 777 /mnt/www/nnplus/www
sudo chmod 777 /mnt/www/nnplus/www/install
sudo service httpd restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment