mguterl (owner)

Revisions

gist: 98172 Download_button fork
public
Public Clone URL: git://gist.github.com/98172.git
Bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# 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 michaelguterl@diminishing.org: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 michaelguterl@diminishing.org:.ssh/authorized_keys2
ssh michaelguterl@diminishing.org # 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