-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathblog-install-ubuntu1204.sh
executable file
·147 lines (123 loc) · 4.7 KB
/
blog-install-ubuntu1204.sh
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#! /bin/bash
# Here's what I did to run the site under MacOS straight up (as VirtualBox ran into permission hell)
#brew update
#brew install ruby
#add the following line to .bash_profile: 'export PATH=/Users/joldenbeuving/.gem/ruby/2.6.0/bin:/usr/local/opt/ruby/bin:$PATH'
#gem install --user-install bundler jekyll
#echo "set modeline" > ~/.vimrc
#sudo apachectl start
#add virtual host info from below into httpd.conf, main document root thing. Scortched earth style.
#brew install sass/sass/sass #because the original SAS was depricated
#gem install rake
#rm Gemfile.lock
#bundle install
#remove last line Gemfile.lock (bundled with 2.0.2 or whatever), then run `jekyll` see if it works
# enable rewrite rules in httpd2.conf on the mac, by uncommenting the following line, then restart httpd
# LoadModule rewrite_module libexec/apache2/mod_rewrite.so
# finish here in 2019
sudo apt-get -y update
sudo apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev git apache2 tidy
cd /tmp
wget http://cache.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p353.tar.gz
tar -xvzf ruby-2.0.0-p353.tar.gz
cd ruby-2.0.0-p353/
./configure --prefix=/usr/local
make
sudo make install
sudo gem install jekyll
sudo gem install therubyracer
sudo gem install rouge
sudo gem install sass
# Make modelines work for VIM
echo "set modeline" > ~/.vimrc
#HERE DOC for Apache Virtual Host configuration
cat << EOFAPACHE > /tmp/host
<VirtualHost *:4000>
ServerAdmin [email protected]
DocumentRoot /vagrant/jilles.net/_site
<Directory "/vagrant/jilles.net/_site">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
EOFAPACHE
# Ensure Apache is listening on port 4k as well
cat << EOFPORT > /tmp/port
# here for jilles.net blog
NameVirtualHost *:4000
Listen 4000
EOFPORT
sudo sh -c "cat /tmp/host >> /etc/apache2/sites-available/jilles"
sudo sh -c "cat /tmp/port >> /etc/apache2/ports.conf"
rm /tmp/port /tmp/host
sudo ln -s /etc/apache2/sites-available/jilles /etc/apache2/sites-enabled/010-jilles
sudo apachectl restart
mkdir -p /home/vagrant/.ssh
chmod 700 /home/vagrant/.ssh
cat <<EOFSSH > /home/vagrant/.ssh/config
Host prod
Hostname ssh.jilles.net
User jilles.net
Host *
ServerAliveInterval 30
ServerAliveCountMax 120
EOFSSH
# setting time stuff correct
sudo VBoxService --timesync-set-threshold 1000
# setting motd
cat << EOFMOTD > /tmp/motd
__ _ _ _ _ _ _
\ \(_) | | ___ ___ _ __ ___| |_ __ _____| |__ | | ___ ____
\ \ | | |/ _ \/ __| | '_ \ / _ \ __| \ \ /\ / / _ \ '_ \| |/ _ \ / _ |
/\_/ / | | | __/\__ \_| | | | __/ |_ \ V V / __/ |_) | | (_) | (_| |
\___/|_|_|_|\___||___(_)_| |_|\___|\__| \_/\_/ \___|_.__/|_|\___/ \__, |
|___/
Production: http://www.jilles.net
Development: http://localhost:4000
Repository: https://github.com/ojilles/jilles.net
EOFMOTD
sudo mv /tmp/motd /etc/motd
# fixing up Git
git config --global user.name "Jilles Oldenbeuving"
git config --global user.email [email protected]
git config --global alias.lg 'log --pretty=format:"%C(yellow)%h\\ %C(green)%ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short --graph'
git config --global alias.st "status -s --branch"
git config --global alias.ll 'log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat'
git config --global alias.gr 'grep -Ii'
git config --global alias.staged 'diff --cached'
# ensure ssh connectivity for pub/priv key
git remote set-url origin [email protected]:ojilles/jilles.net.git
rake dev
# if host system has private key for production environment,
# copy it in for easy deployment
if [ -f /vagrant/id_rsa ];
then
cp /vagrant/id_rsa /home/vagrant/.ssh/
chmod 0700 /home/vagrant/.ssh/id_rsa
else
echo "No private key found for production environment. In your host system run: 'cp ~/.ssh/id_rsa .'"
fi
echo 'Open up your browser to: http://localhost:4000'
exit
# new attempt on ubuntu (20200523)
sudo apt install ruby-full build-essential zlib1g-dev tidy sass apache2
gem install bundler jekyll
bundle install
bundle lock --update
bundler
#and run:
rake dev
# images
# https://pixabay.com/
# https://unsplash.com/
# grammar
# https://www.quickanddirtytips.com/grammar-girl
# https://www.chicagomanualofstyle.org/home.html
#
# htaccess to rewrite to SSL
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L]
#https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-20-04