Skip to content

Instantly share code, notes, and snippets.

@t-book
Last active July 30, 2018 12:52
Show Gist options
  • Save t-book/ec65310c2e8703afbd3d55cc9f4c74b2 to your computer and use it in GitHub Desktop.
Save t-book/ec65310c2e8703afbd3d55cc9f4c74b2 to your computer and use it in GitHub Desktop.
GeoNode14.04 on Ubuntu Trusty
#!/usr/bin/env bash
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
echo ' INSTALL APT PACKAGES'
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
sudo apt-get update
sudo apt-get install git tree python-virtualenv build-essential openssh-server apache2 gcc gdal-bin gettext git-core libapache2-mod-wsgi libgeos-dev libjpeg-dev libpng-dev libpq-dev libproj-dev libxml2-dev libxslt-dev patch postgresql postgis postgresql-9.3-postgis-scripts postgresql-contrib python python-dev python-gdal python-pycurl python-imaging python-pastescript python-psycopg2 python-support python-urlgrabber python-virtualenv unzip zip
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
sudo apt install oracle-java8-set-default
sudo apt-get install tomcat7 -y
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
echo ' GIT ACTIONS'
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
git clone https://github.com/GeoNode/geonode.git --branch 2.4.x
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
echo ' PIP INSTALL'
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
sudo pip install -e geonode
cd geonode
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
echo ' PAVER SETUP'
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
# wget http://build.geonode.org/geoserver/latest/geoserver-2.9.x.war
# http://build.geonode.org/geoserver/latest/data-2.9.x.zip
sudo paver setup
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
echo ' MOVE DIR TO VAGRANT'
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
#sudo mv /home/vagrant/geonode /vagrant/
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
echo ' CONFIGURE POSTGRES'
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
cd /home
echo ' Create DBs'
sudo -u postgres createdb -E 'utf-8' -l en_US.utf8 -T template0 geonode
sudo -u postgres createdb -U postgres -E 'utf-8' -l en_US.utf8 -T template0 geonode_data
echo ' Create User'
sudo -u postgres psql -c "create role geonode with login password 'geonode';"
echo ' alter permissions'
sudo -u postgres psql -c "alter database geonode owner to geonode;"
sudo -u postgres psql -c 'alter database "geonode_data" owner to geonode;'
echo ' import data'
sudo -u postgres psql -f /usr/share/postgresql/9.3/contrib/postgis-2.1/postgis.sql geonode_data
sudo -u postgres psql -f /usr/share/postgresql/9.3/contrib/postgis-2.1/spatial_ref_sys.sql geonode_data
sudo -u postgres psql -d geonode_data -c 'GRANT ALL ON geometry_columns TO PUBLIC;'
sudo -u postgres psql -d geonode_data -c 'GRANT ALL ON spatial_ref_sys TO PUBLIC;'
sudo cp -f /vagrant/assets/pg_hba.conf /etc/postgresql/9.3/main/
sudo sed -ie "s/#listen_addresses = 'localhost'/listen_addresses = '*'/g" /etc/postgresql/9.3/main/postgresql.conf
sudo service postgresql restart
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
echo ' CONFIGURE GEONODE LOCAL SETTINGS'
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
sudo cp -f /vagrant/assets/local_settings.py /home/vagrant/geonode/geonode/
cd /home/vagrant/geonode
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
echo ' SYNC DB'
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
python manage.py syncdb --noinput # password question --noinput
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
echo ' COLLECTSTATIC'
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
python manage.py collectstatic --noinput # yes question --noinput
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
echo ' CREATE UPLOADED'
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
sudo mkdir -p /home/vagrant/geonode/geonode/uploaded
sudo chown www-data -R /home/vagrant/geonode/geonode/uploaded
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
echo ' CONFIGURE GEOSERVER'
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
sudo service tomcat7 stop
sudo cp /home/vagrant/geonode/downloaded/geoserver-2.9.x.war /var/lib/tomcat7/webapps/geoserver.war
#sudo cp /home/vagrant/geonode/downloaded/geoserver.war /var/lib/tomcat7/webapps/
sudo /etc/init.d/tomcat7 start
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
echo ' CONFIGURE APACHE'
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
sudo a2enmod proxy_http
sudo cp -f /vagrant/assets/geonode.conf /etc/apache2/sites-available/
sudo a2dissite 000-default.conf
sudo a2ensite geonode.conf
sudo service apache2 reload
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
echo ' CONFIGURE DIR PERMISSIONS'
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
sudo chown -R www-data:www-data /home/vagrant/geonode/geonode/static/
sudo chown -R www-data:www-data /home/vagrant/geonode/geonode/uploaded/
sudo chown -R www-data:www-data /home/vagrant/geonode/geonode/static_root/
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
echo 'add admin user'
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
python /home/vagrant/geonode/manage.py loaddata /vagrant/assets/people.json
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
echo ' INSTALL DUMMY DATA'
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
cd /home/vagrant/geonode
sudo paver setup_data
# to be save
sudo chown -R www-data:www-data /home/vagrant/geonode/geonode/uploaded/thumbs
sudo chown -R www-data:www-data /home/vagrant/geonode/geonode/uploaded/layers
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
#config.vm.provision :shell, path: "bootstrap.sh"
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.provider "virtualbox" do |vb|
vb.memory = "6024"
end
config.vm.network "forwarded_port", guest: 80, host: 8001
config.vm.network "forwarded_port", guest: 8000, host: 8000
config.vm.network "forwarded_port", guest: 8080, host: 8080
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment