Skip to content

Instantly share code, notes, and snippets.

@roberocity
Created February 5, 2012 02:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roberocity/1742166 to your computer and use it in GitHub Desktop.
Save roberocity/1742166 to your computer and use it in GitHub Desktop.
Simple Server Setup
echo "Setting up the server with initial packages, etc."
echo "This should be done as sudo."
echo "-------"
echo "Upate and Upgrade existing packages. Install basic packages."
# initial server setup
apt-get update
apt-get -y upgrade
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline5-dev libpcre3-dev git-core libxml2 libxml2-dev libxslt-dev
apt-get -y install ruby-1.9.1 ruby-1.9.1-dev
apt-get -y install mailutils
echo "-------"
echo "Setup rbenv and ruby-build"
# --------------------
# rbenv and ruby-build
# --------------------
echo "cloning rbevn"
git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv
echo "setting up rbenv"
# from https://gist.github.com/1237417
# Add rbenv to the path:
echo '# rbenv setup' > /etc/profile.d/rbenv.sh
echo 'export RBENV_ROOT=/usr/local/rbenv' >> /etc/profile.d/rbenv.sh
echo 'export PATH="$RBENV_ROOT/bin:$PATH"' >> /etc/profile.d/rbenv.sh
echo 'eval "$(rbenv init -)"' >> /etc/profile.d/rbenv.sh
chmod +x /etc/profile.d/rbenv.sh
source /etc/profile.d/rbenv.sh
chmod -R g+rwxX /usr/local/rbenv
echo "installing ruby-build"
# Install ruby-build:
pushd /tmp
git clone git://github.com/sstephenson/ruby-build.git
cd ruby-build
./install.sh
popd
chmod g+rwxX -R /usr/local/rbenv
echo "-----"
echi "Install ruby 1.9.2-p290. This may take a while."
# Install Ruby 1.9.2-p290:
rbenv install 1.9.2-p290
rbenv global 1.9.2-p290
# Rehash:
rbenv rehash
# Ruby Gems
echo "download and install ruby gems"
wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.15.tgz
tar xvf rubygems-1.8.15.tgz
pushd rubygems-1.8.15
ruby setup.rb
popd
rbenv rehash
# -------
# sqlite3
# -------
echo "-----"
echo "Install sqlite3"
apt-get -y install sqlite3 sqlite3-doc libsqlite3-dev
# -----
# nginx
# -----
echo "-----"
echo "Install Nginx as the Web server. It will be running after intall."
# added to aid in nginx install to gain
# ability to add-apt-repository
apt-get -y install python-software-properties
add-apt-repository ppa:nginx/stable
apt-get update
apt-get -y install nginx
echo "-----"
echo "All done now"
echo ""
echo ""
echo "-----"
echo "nginx conf is in /etc/nginx/nginx.conf"
echo "reload nginx conf after config changes"
echo "$ nginx -s reload"
echo "stop nginx"
echo "$ nginx -s stop"
apt-get install python-software-properties
apt-add-repository ppa:chris-lea/node.js
apt-get update
apt-get install nodejs npm
apt-get install nodejs-dev
if -z $1 || -z $2
echo "./wp-install.sh dirname domain"
fi
DBNAME=`echo $1 | cut -c1-10`
DBUSER=$DBNAME
DBPASSWD=`apg -m 12 -n 1 -x 20 -M SNCL -E \"\'\\\.()[]{}&*`
WPDIR=$1
DOMAIN=$2
SITEROOT=`pwd`/$WPDIR
DOMAINS=$DOMAIN.com www.$DOMAIN.com $DOMAIN.wp2.roberocity.com
wget -q http://wordpress.org/latest.tar.gz
tar -xf latest.tar.gz
rm latest.tar.gz
mv wordpress $WPDIR
mysql -e "CREATE DATABASE "$DBNAME
mysql -e "CREATE USER '"$DBUSER"'@localhost IDENTIFIED BY '"$DBPASSWD"'"
mysql -e "GRANT ALL PRIVILEGES ON $DBNAME.* TO '"$DBUSER"'@localhost"
echo "server {
listen 80;
server_name $DOMAINS;
client_max_body_size 100m;
root $SITEROOT;
include global/restrictions.conf;
include global/wordpress.conf;
}" >> nginx.conf
echo "Database: " $DBNAME
echo "User: " $DBUSER
echo "Password: " $DBPASSWD
echo "Hosted at: " $DOMAINS
echo "Site Root: " $SITEROOT
/etc/init.d/nginx reload
echo "Setting up the server with initial packages, etc."
echo "This should be done as sudo."
echo "-------"
echo "Upate and Upgrade existing packages. Install basic packages."
# initial server setup
apt-get update
apt-get -y upgrade
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline5-dev libpcre3-dev git-core libxml2 libxml2-dev libxslt-dev
apt-get -y install mailutils
# -----
# nginx
# -----
echo "-----"
echo "Install Nginx as the Web server. It will be running after intall."
# added to aid in nginx install to gain
# ability to add-apt-repository
apt-get -y install python-software-properties
add-apt-repository ppa:nginx/stable
apt-get update
apt-get -y install nginx
# -----
# mySQL
# -----
apt-get -y install mysql-server
mysql_secure_installation
# -----
# PHP
# -----
apt-get -y install php5 php5-cli php5-cgi php5-mysql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment