Created
March 3, 2020 04:35
-
-
Save karataserkan/b0de6919c677b4bec7e38a374e2cb9cf to your computer and use it in GitHub Desktop.
This file contains 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
#!/bin/bash | |
#update | |
sudo apt-get update && sudo apt-get upgrade | |
#Install Postgres and PostGIS | |
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - | |
echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" |sudo tee /etc/apt/sources.list.d/pgdg.list | |
sudo apt update | |
sudo apt -y install postgresql-12 postgresql-client-12 | |
sudo apt install postgis postgresql-12-postgis-2.5 | |
#Setup all other dependencies: | |
sudo apt-get install python-pip python-virtualenv python-dev libjpeg-dev libmagickcore-dev libmagickwand-dev imagemagick binutils libproj-dev gdal-bin python-gdal | |
sudo apt-get install libgdal-dev | |
sudo apt-get install ffmpeg | |
wget http://launchpadlibrarian.net/348889634/libav-tools_3.4.1-1_all.deb | |
sudo dpkg -i libav-tools_3.4.1-1_all.deb | |
sed -i 's/\(<policy domain="coder" rights=\)"none" \(pattern="PDF" \/>\)/\1"read|write"\2/g' /etc/ImageMagick-6/policy.xml | |
#Setup database | |
su - postgres | |
psql | |
CREATE USER django WITH PASSWORD 'somepass'; | |
CREATE DATABASE geokey OWNER django; | |
\q | |
psql -d geokey -c 'create extension postgis;' | |
psql -d geokey -c 'create extension hstore;' | |
logout | |
#install apache | |
sudo apt-get install apache2 libapache2-mod-wsgi | |
#get geokey | |
cd /var/www | |
git clone https://github.com/ExCiteS/geokey.git | |
chown -R www-data:www-data geokey | |
cd geokey | |
virtualenv env | |
source env/bin/activate | |
pip install --upgrade pip | |
export CPLUS_INCLUDE_PATH=/usr/include/gdal | |
export C_INCLUDE_PATH=/usr/include/gdal | |
gdalinfo --version | |
pip install GDAL==x.x.x | |
nano requirements.txt #update gdal==x.x.x | |
pip install -r requirements.txt | |
cp -r local_settings.example local_settings | |
nano local_settings/settings.py | |
#update from geokey.core.settings.prod import * | |
#update django db pass | |
#update STATIC_ROOT = '/var/www/geokey/static/' | |
#update SECRET_KEY | |
#update required other fields | |
nano local_settings/wsgi.py | |
#"""WSGI configuration.""" | |
#import os | |
#import sys | |
#from django.core.wsgi import get_wsgi_application | |
#sys.path.append('/var/www/geokey') | |
#sys.path.append('/var/www/geokey/env/lib/python2.7/site-packages') | |
#try: | |
# settings_module = 'local_settings.settings' | |
#except ImportError: | |
# settings_module = 'geokey.core.settings.project' | |
# | |
#os.environ.setdefault('DJANGO_SETTINGS_MODULE', settings_module) | |
#application = get_wsgi_application() | |
python manage.py migrate | |
python manage.py createsuperuser | |
python manage.py collectstatic | |
#configure apache | |
nano /etc/apache2/sites-available/000-default.conf | |
#<VirtualHost *:80> | |
#ServerName localhost | |
# DocumentRoot /var/www/geokey | |
# WSGIScriptAlias / /var/www/geokey/local_settings/wsgi.py | |
# | |
#WSGIDaemonProcess localhost processes=2 threads=15 python-home=/var/www/geokey/env/ | |
#WSGIProcessGroup localhost | |
#WSGIApplicationGroup %{GLOBAL} | |
# WSGIProcessGroup localhost | |
# | |
# <directory /var/www/geokey/> | |
# AllowOverride all | |
# Require all granted | |
# Options FollowSymlinks | |
# </directory> | |
# | |
# Alias /static/ /var/www/geokey/static/ | |
# | |
# <Directory /var/www/geokey/static> | |
# Require all granted | |
# </Directory> | |
#</VirtualHost> | |
service apache2 restart | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment