-
-
Save visnup/172510 to your computer and use it in GitHub Desktop.
setup an ubuntu server quickly
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
| #!/bin/sh | |
| # Configure your desired options here | |
| DESIRED_HOSTNAME="lazeroids.com" | |
| # Ensure hostname is configured | |
| if [ -z "$DESIRED_HOSTNAME" ]; then | |
| echo DESIRED_HOSTNAME must be set. | |
| exit 1 | |
| fi | |
| # Set hostname | |
| echo "$DESIRED_HOSTNAME" >/etc/hostname | |
| #sed -re "s/^(127.0.1.1[[:space:]]+).*/\\1$DESIRED_HOSTNAME/" </etc/hosts >"#{remote_tmp_file}" && cp -f "#{remote_tmp_file}" /etc/hosts && rm -f "#{remote_tmp_file}" | |
| /etc/init.d/hostname.sh start | |
| # Upgrade system packages | |
| apt-get -y update | |
| apt-get -y upgrade | |
| # Install essential tools | |
| apt-get -y install build-essential wget curl | |
| # SSH keys | |
| mkdir ~/.ssh | |
| curl https://gist.github.com/raw/c36181da7af33fdb416c/88cc6febee6d2026b695ba88aca441b8d54cdfd9/gistfile1.txt > ~/.ssh/authorized_keys | |
| chmod 700 ~/.ssh | |
| chmod 600 ~/.ssh/authorized_keys | |
| # Install Apache 2 | |
| apt-get -y install apache2 apache2-prefork-dev | |
| # Install MySQL Server | |
| apt-get -y install mysql-server | |
| # Install Git | |
| apt-get -y install git-core | |
| # Install python and twisted | |
| apt-get -y install python-dev python-twisted python-setuptools | |
| # Install orbited | |
| easy_install orbited simplejson | |
| # Install Ruby Enterprise Edition | |
| apt-get -y install libreadline5-dev | |
| wget http://rubyforge.org/frs/download.php/66162/ruby-enterprise-1.8.7-2009.10.tar.gz | |
| tar xzf ruby-enterprise-1.8.7-2009.10.tar.gz | |
| ./ruby-enterprise-1.8.7-2009.10/installer | |
| # Make PATH adjustments | |
| echo "export PATH=/opt/ruby-enterprise-1.8.7-2009.10/bin:$PATH" > /etc/profile.d/ruby-enterprise-1.8.7-2009.10.sh | |
| /etc/profile.d/ruby-enterprise-1.8.7-2009.10.sh | |
| # Install gems | |
| gem install --no-rdoc --no-ri faker haml json newrelic_rpm stomp | |
| # Install passenger | |
| passenger-install-apache2-module -a | |
| echo "LoadModule passenger_module /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/passenger-2.2.7/ext/apache2/mod_passenger.so" > /etc/apache2/mods-available/passenger.load | |
| echo "PassengerRoot /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/passenger-2.2.7" > /etc/apache2/mods-available/passenger.conf | |
| echo "PassengerRuby /opt/ruby-enterprise-1.8.7-2009.10/bin/ruby" >> /etc/apache2/mods-available/passenger.conf | |
| a2enmod passenger | |
| # Need mod_rewrite | |
| a2enmod rewrite | |
| /etc/init.d/apache2 restart | |
| # Setup app user | |
| mkdir /u | |
| useradd -d /u/apps -m -s /bin/bash app | |
| # app user SSH keys | |
| mkdir /u/apps/.ssh | |
| cp ~/.ssh/authorized_keys /u/apps/.ssh | |
| chown -R app:app /u/apps/.ssh | |
| chmod 700 /u/apps/.ssh | |
| chmod 600 /u/apps/.ssh/authorized_keys | |
| # Firewall |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment