This repository was archived by the owner on Aug 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.sh
54 lines (36 loc) · 1.39 KB
/
bootstrap.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
#!/usr/bin/env bash
# add swap
fallocate -l 4G /swapfile && chmod 0600 /swapfile && mkswap /swapfile && swapon /swapfile && echo '/swapfile none swap sw 0 0' >> /etc/fstab
echo vm.swappiness = 10 >> /etc/sysctl.conf && echo vm.vfs_cache_pressure = 50 >> /etc/sysctl.conf && sysctl -p
# use local ubuntu mirror
sed -i 's/archive.ubuntu.com/lv.archive.ubuntu.com/g' /etc/apt/sources.list
# update apt-get
sudo apt-get update
# install various dependencies
sudo apt-get -y install build-essential libreadline-gplv2-dev libncursesw5-dev \
libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev sshpass \
git-core sloccount
# Install Python3.6 & PIP
sudo apt-get -y install python3.6 python-pip python-dev libpq-dev
sudo pip install --upgrade pip
# @see https://pip.pypa.io/en/latest/reference/pip.html
# Install projects Requirements
sudo pip install -qq -r /projects/requirements.txt
# Setup Python Config
APP_SETTINGS="config.ProductionConfig"
export APP_SETTINGS
# Install SQLite3
sudo apt-get -y install sqlite3 libsqlite3-dev
# create folder for SQLite DB
cd /tmp
mkdir tmp
sudo chown www-data:www-data /tmp/tmp
# create DB tables, set folder and file permissions
cd /var/www/
python db_create_users.py
python db_create_posts.py
sudo chown www-data:www-data /tmp/tmp/sample.db
sudo chmod -R 777 /tmp/tmp
# Open port 80
sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT
sudo iptables-save