Created
March 17, 2014 04:07
-
-
Save stevage/9593847 to your computer and use it in GitHub Desktop.
Attempting to install CartoDB
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
sudo apt-get update | |
sudo apt-get install -y git-core | |
cd /mnt | |
sudo mkdir cartodb | |
sudo chown ubuntu:ubuntu cartodb | |
git clone --recursive https://github.com/CartoDB/cartodb.git | |
#Add CartoDB GIS PPA | |
sudo add-apt-repository ppa:cartodb/gis | |
#Add CartoDB Mapnik PPA | |
sudo add-apt-repository ppa:cartodb/mapnik | |
#Add CartoDB Node PPA | |
sudo add-apt-repository ppa:cartodb/nodejs | |
#Add CartoDB Redis PPA | |
sudo add-apt-repository ppa:cartodb/redis | |
#Add CartoDB PostgreSQL PPA | |
sudo add-apt-repository ppa:cartodb/postgresql | |
#Add CartoDB Varnish PPA | |
sudo add-apt-repository ppa:cartodb/varnish | |
#Resfresh repositories to use the PPAs | |
sudo apt-get update | |
--- | |
#Some dependencies | |
#unp is required for archive file upload support | |
# zip is required for table exports | |
sudo apt-get install -y unp zip | |
#################### | |
#Install GEOS | |
#GEOS is required for geometry function support. | |
sudo apt-get install -y libgeos-c1 libgeos-dev | |
#Install GDAL | |
#GDAL is requires for raster support. | |
sudo apt-get install -y gdal-bin libgdal1-dev | |
#Install JSON-C | |
#JSON-C is required for GeoJSON support. | |
sudo apt-get install -y libjson0 python-simplejson libjson0-dev | |
#Install PROJ | |
#PROJ4 is required for reprojection support. | |
sudo apt-get install -y proj-bin proj-data libproj-dev | |
#Install PostgreSQL | |
#PostgreSQL is the relational database that powers CartoDB. | |
sudo apt-get install -y postgresql-9.1 postgresql-client-9.1 postgresql-contrib-9.1 postgresql-server-dev-9.1 | |
#plpython is required for Python support | |
sudo apt-get install -y postgresql-plpython-9.1 | |
#Currently there is an error with credential-based connections for development, and all connections must be performed using method "trust" inside config file pg_hba.conf. | |
cd /etc/postgresql/9.1/main | |
sudo perl -p -i -e 's/md5|peer$/trust/g' pg_hba.conf | |
#And change inside all local connections from peer/md5/... to trust. | |
#Then restart postgres and you're done. | |
sudo /etc/init.d/postgresql restart | |
######################## | |
sudo bash <<EOF | |
cd /usr/local/src | |
wget http://download.osgeo.org/postgis/source/postgis-2.0.2.tar.gz | |
tar xzf postgis-2.0.2.tar.gz | |
cd postgis-2.0.2 | |
./configure --with-raster --with-topology | |
make | |
make install | |
EOF | |
sudo -u postgres bash <<"EOF" | |
POSTGIS_SQL_PATH=`pg_config --sharedir`/contrib/postgis-2.0 | |
createdb -E UTF8 template_postgis | |
createlang -d template_postgis plpgsql | |
psql -d postgres -c \ | |
"UPDATE pg_database SET datistemplate='true' WHERE datname='template_postgis'" | |
psql -d template_postgis -f $POSTGIS_SQL_PATH/postgis.sql | |
psql -d template_postgis -f $POSTGIS_SQL_PATH/spatial_ref_sys.sql | |
psql -d template_postgis -f $POSTGIS_SQL_PATH/legacy.sql | |
psql -d template_postgis -f $POSTGIS_SQL_PATH/rtpostgis.sql | |
psql -d template_postgis -f $POSTGIS_SQL_PATH/topology.sql | |
psql -d template_postgis -c "GRANT ALL ON geometry_columns TO PUBLIC;" | |
psql -d template_postgis -c "GRANT ALL ON spatial_ref_sys TO PUBLIC;" | |
EOF | |
# sudo -u postgres ./template_postgis.sh | |
################## | |
#Install Ruby | |
#We implemented CartoDB in the Ruby programming language, so you'll need to install Ruby 1.9.2. You can use rvm: | |
# Don't be root here? | |
curl -L https://get.rvm.io | bash | |
sudo ln -sf /proc/self/fd /dev/fd | |
source /etc/profile.d/rvm.sh | |
rvm install 1.9.2 | |
#Install Node.js | |
#The tiler API and the SQL API are both Node.js apps. | |
sudo apt-get install -y nodejs npm | |
#We currently run our node apps against version 0.8.x. You can install NVM to handle multiple versions in the same system: | |
curl https://raw.github.com/creationix/nvm/master/install.sh | sh | |
#Then you can install and use any version, for example: | |
source ~/.profile | |
nvm install v0.8.9 | |
# not needed? nvm use 0.8.9 | |
#Install Redis | |
#Components of CartoDB, like Windshaft or the SQL API depend on Redis. | |
sudo apt-get install -y redis-server | |
#Install Python dependencies | |
#This needs to be done from the cartodb20 local copy. To install the Python modules that CartoDB depends on, you can use easy_install. | |
#You need to have some dependencies installed before using pip: | |
#sudo apt-get install -y python2.7-dev build-essential | |
# trying this instead: | |
# Nope. sudo apt-get install -y python-setuptools build-essential | |
# this seems to work: | |
sudo tee -a /etc/apt/sources.list <<EOF | |
deb http://ppa.launchpad.net/fkrull/deadsnakes/ubuntu lucid main | |
deb-src http://ppa.launchpad.net/fkrull/deadsnakes/ubuntu lucid main | |
EOF | |
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys DB82666C | |
sudo apt-get update | |
sudo apt-get install -y python2.7 python2.7-dev | |
curl -O http://python-distribute.org/distribute_setup.py | |
sudo python2.7 distribute_setup.py | |
sudo easy_install pip | |
export CPLUS_INCLUDE_PATH=/usr/include/gdal | |
export C_INCLUDE_PATH=/usr/include/gdal | |
## where does this python_requirements.txt file come from? | |
cd /mnt/cartodb | |
#sudo -E pip install --no-use-wheel -r python_requirements.txt | |
# This works: | |
sudo -E pip install --allow-external argparse --no-use-wheel -r python_requirements.txt | |
########### HMMMMMMAMMMMM | |
#$ sudo -E pip install --no-use-wheel -r python_requirements.txt | |
#Downloading/unpacking chardet==1.0.1 (from -r python_requirements.txt (line 1)) | |
# Downloading chardet-1.0.1.tar.gz (156kB): 156kB downloaded | |
# Running setup.py (path:/tmp/pip_build_root/chardet/setup.py) egg_info for package chardet | |
# | |
#Downloading/unpacking argparse==1.2.1 (from -r python_requirements.txt (line 2)) | |
# Could not find a version that satisfies the requirement argparse==1.2.1 (from -r python_requirements.txt (line 2)) (from versions: 0.1.0, 0.2.0, 0.3.0, 0.4.0, 0.5.0, 0.6.0, 0.7.0, 0.8.0, 0.9.0, 0.9.1, 1.0.1, 1.0, 1.1) | |
# Some externally hosted files were ignored (use --allow-external to allow). | |
#Cleaning up... | |
#No distributions matching the version for argparse==1.2.1 (from -r python_requirements.txt (line 2)) | |
#Storing debug log for failure in /home/ubuntu/.pip/pip.log | |
#Install Varnish | |
#Varnish is a web application accelerator. Components like Windshaft use it to speed up serving tiles via the Maps API. | |
sudo apt-get install -y varnish | |
#Install Mapnik | |
#Mapnik is an API for creating beautiful maps. CartoDB uses Mapnik for creating and styling map tiles. | |
sudo apt-get install -y libmapnik-dev python-mapnik mapnik-utils | |
#Install CartoDB SQL API | |
#The CartoDB SQL API component powers the SQL queries over HTTP. To install it: | |
cd /mnt | |
sudo git clone git://github.com/CartoDB/CartoDB-SQL-API.git | |
sudo chown -R ubuntu:ubuntu CartoDB-SQL-API | |
cd CartoDB-SQL-API | |
git checkout master | |
npm install | |
#To run CartoDB SQL API in development mode, simply type: | |
##Added: | |
cp config/environments/development.js.example config/environments/development.js | |
node app.js development | |
### Ok going to need Python 2.7 maybe: | |
cd /mnt | |
sudo mkdir python | |
sudo chown ubuntu:ubuntu python | |
cd python | |
wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz | |
tar xzf Python-2.7.3.tgz | |
cd Python-2.7.3 | |
./configure | |
make | |
sudo make altinstall | |
PATH=/mnt/python/Python-2.7.3:$PATH | |
#Install Windshaft-cartodb | |
#The Windshaft-cartodb component powers the CartoDB Maps API. To install it: | |
cd /mnt | |
sudo git clone git://github.com/CartoDB/Windshaft-cartodb.git | |
sudo chown -R ubuntu:ubuntu Windshaft-cartodb | |
cd Windshaft-cartodb | |
git checkout master | |
### Dammit fails here! | |
#To debug, I did this: npm config set rollback false | |
npm install | |
#To run Windshaft-cartodb in development mode, simply type: | |
## First: cp config/environments/development.js.example config/environments/development.js | |
node app.js development | |
#Install ImageMagick | |
sudo apt-get install imagemagick |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment