Created
April 19, 2009 18:56
-
-
Save mguterl/98172 to your computer and use it in GitHub Desktop.
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
# credits | |
# http://github.com/hartcode/serverjuice/ | |
# http://blog.fiveruns.com/2008/3/3/compiling-ruby-rubygems-and-rails-on-ubuntu | |
# http://www.rubyinside.com/how-to-install-a-ruby-18-stack-on-ubuntu-810-from-scratch-1566.html | |
# upgrade packages | |
apt-get update | |
apt-get upgrade | |
# install reasonably easy-to-use text editor (skip this if you can wield something greater) | |
apt-get install nano | |
# set static ip | |
nano /etc/network/interfaces | |
# # Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or | |
# # /usr/share/doc/ifupdown/examples for more information. | |
# | |
# auto lo | |
# iface lo inet loopback | |
# | |
# auto eth0 | |
# | |
# # iface eth0 inet dhcp | |
# iface eth0 inet static | |
# address 75.127.97.45 | |
# gateway 75.127.97.1 | |
# netmask 255.255.255.0 | |
/etc/init.d/networking restart | |
# add non-root user | |
adduser michaelguterl | |
# add user to the end of /etc/sudoers | |
nano /etc/sudoers | |
# michaelguterl ALL=(ALL) ALL | |
# ssh configuration | |
# change to obscure port | |
nano /etc/ssh/sshd_config | |
# Port 4242 | |
# KeepAlive yes | |
# ClientAliveInterval 60 | |
/etc/init.d/ssh restart | |
logout | |
# reconnect and disable root login via ssh | |
ssh [email protected]:4242 | |
# PermitRootLogin no | |
/etc/init.d/ssh restart | |
# set hostname | |
echo "diminishing.org" >/etc/hostname | |
/etc/init.d/hostname.sh start | |
# simple firewall | |
apt-get -y install ufw | |
ufw allow to 0.0.0.0/0 port 80 | |
ufw allow to 0.0.0.0/0 port 4242 # (or whichever port you use for ssh) | |
ufw allow to 0.0.0.0/0 port 25 # (if you need mail in) | |
ufw enable | |
# ssh keys, be sure to mkdir ~/.ssh on the server | |
# do this on your local machine | |
ssh-keygen -t dsa | |
nano ~/.ssh/config | |
# Host diminishing.org | |
# Port 4242 | |
scp ~/.ssh/id_dsa.pub [email protected]:.ssh/authorized_keys2 | |
ssh [email protected] # should not require password | |
# build tools | |
apt-get install build-essential wget curl libxml2 libxml2-dev libxslt-dev sqlite3 libsqlite3-dev locate git-core | |
# install apache2 | |
apt-get -y install apache2 apache2-prefork-dev | |
# install mysql server | |
apt-get -y install mysql-server mysql-client libmysqlclient15-dev | |
# phpmyadmin http://diminishing.org/phpmyadmin | |
apt-get install phpmyadmin # select apache2 when prompted | |
# install ruby deps | |
apt-get install libreadline5-dev libssl-dev zlib1g zlib1g-dev | |
# install ruby 1.8.6-p386 from source | |
mkdir ~/src | |
cd src | |
wget http://ftp.ruby-lang.org/pub/ruby/ruby-1.8.6-p369.tar.gz | |
tar -xzvf ruby-1.8.6-p369.tar.gz | |
cd ruby-1.8.6-p369 | |
./configure --prefix=/usr/local --disable-pthread --with-openssl-dir=/usr --with-readline-dir=/usr --with-zlib-dir=/usr | |
make | |
sudo make install | |
sudo make install-doc | |
ruby -ropenssl -rzlib -rreadline -e "puts :success" | |
# install rubygems | |
cd ~/src | |
wget http://rubyforge.org/frs/download.php/55066/rubygems-1.3.2.tgz | |
tar -xzvf rubygems-1.3.2.tgz | |
cd rubygems-1.3.2 | |
sudo ruby setup.rb | |
# ruby gems | |
gem install --no-ri --no-rdoc rake rack rails mysql passenger cheat \ | |
sinatra sqlite3-ruby daemons nokogiri hpricot json crack httparty \ | |
happymapper fastthread uuid builder | |
# imagemagick / rmagick | |
apt-get -y install libmagick9-dev # warning this installs tons of packages | |
gem install --no-ri --no-rdoc rmagick | |
# passenger | |
gem install passenger | |
passenger-install-apache2-module |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice walkthrough of a new VPS setup