Install Postgis
sudo apt-get install -y postgresql postgis
sudo apt-get install -y postgresql-contrib postgresql-12-postgis-3 postgresql-12-postgis-3-scripts
sudo service postgresql start
locale
git --version # to verify whether git is already installed
sudo apt-get install -y git
sudo apt-get install -y postgresql-contrib postgresql-12-postgis-3 postgresql-12-postgis-3-scripts
sudo service postgresql start
echo $USER
locale -c
locale
createdb gis --encoding="UTF8" --lc-collate="en_US.UTF-8" --lc-ctype="en_US.UTF-8" --template=template0
sudo -u postgres createuser -s $USER
createdb gis --encoding="UTF8" --lc-collate="en_US.UTF-8" --lc-ctype="en_US.UTF-8" --template=template0
psql -d gis -c 'CREATE EXTENSION postgis; CREATE EXTENSION hstore;'
psql -d gis -c "create user jan;grant all privileges on database gis to postgres;"
psql -d gis -c "grant all privileges on database gis to postgres;"
psql -d gis -c 'create user "www-data";grant all privileges on database gis to "www-data";'
psql -d gis -c 'ALTER TABLE geometry_columns OWNER TO postgres;'
psql -d gis -c 'ALTER TABLE spatial_ref_sys OWNER TO postgres;'
sudo vi /etc/postgresql/*/main/pg_hba.conf
history
wget https://ipinfo.io/ip -qO -
sudo vi /etc/postgresql/*/main/pg_hba.conf
sudo vi /etc/postgresql/*/main/postgresql.conf
sudo /etc/init.d/postgresql restart
psql -U postgres -h $HOSTNAME -c "\l+"
sudo su - postgres psql -U postgres -h $HOSTNAME -c "\l+"
sudo su - postgres
sudo -u postgres psql
sudo vi /etc/postgresql/*/main/pg_hba.conf
sudo /etc/init.d/postgresql restart
psql -U postgres
Install Apache
lsb_release -a
sudo apt install apache2
sudo ufw app list
sudo ufw allow 'Apache'
sudo ufw allow 'Apache Secure'
sudo ufw app list
sudo ufw status
sudo systemctl status apache2
hostname -I
sudo apt-get install -y apache2 apache2-dev
sudo service apache2 status
sudo vi /etc/apache2/apache2.conf
sudo service apache2 reload
curl localhost| grep 'It works!'
Setup Mapnik
sudo apt-get -y install ca-certificates gnupg curl unzip gdal-bin tar
wget bzip2 build-essential clang python3-psycopg2 python3-yaml
python3-requests postgresql-client
sudo apt-get -y install munin-node munin protobuf-c-compiler libtiff5-dev
swapon -s
free -h
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
swapon -s
free -h
sudo
apt-get install -y git autoconf libtool libxml2-dev libbz2-dev
libgeos-dev libgeos++-dev libproj-dev gdal-bin libgdal-dev g++
libmapnik-dev mapnik-utils python3-mapnik
ls
mapnik-config -v
mapnik-config --input-plugins
python3 -c "import mapnik;print(mapnik.__file__)"
sudo apt-get install -y python-setuptools python3-setuptools
wget https://ipinfo.io/ip -qO -
sudo add-apt-repository -y ppa:osmadmins/ppa
sudo apt-get update
sudo apt-get install -y libapache2-mod-tile # this includes both mod-tile and renderd
sudo apt-get install -y python3 python3-distutils
# Verify Python installation:
python -V
python3 -V
sudo apt-get install -y python3 python3-distutils python
python -V
sudo apt-get install -y python-yaml
pip -V # to verify whether pip is already installed
sudo apt-get install -y python3-pip
python3 -m pip install --upgrade pip
sudo python3 -m pip install --upgrade pip
sudo apt-get install -y mapnik-utils
cd
mkdir -p ~/src
cd ~/src
Openstreetmap Carto
Create style
git clone https://github.com/gravitystorm/openstreetmap-carto.git
cd openstreetmap-carto
sudo apt-get install -y fonts-noto-cjk fonts-noto-hinted fonts-noto-unhinted fonts-hanazono ttf-unifont
cd ~/src
git clone https://github.com/googlefonts/noto-emoji.git
git clone https://github.com/googlefonts/noto-fonts.git
sudo cp noto-emoji/fonts/NotoColorEmoji.ttf /usr/share/fonts/truetype/noto
sudo cp noto-emoji/fonts/NotoEmoji-Regular.ttf /usr/share/fonts/truetype/noto
sudo cp noto-fonts/hinted/ttf/NotoSansArabicUI/NotoSansArabicUI-Regular.ttf /usr/share/fonts/truetype/noto
sudo cp noto-fonts/hinted/ttf/NotoNaskhArabicUI/NotoNaskhArabicUI-Regular.ttf /usr/share/fonts/truetype/noto
sudo cp noto-fonts/hinted/ttf/NotoSansArabicUI/NotoSansArabicUI-Bold.ttf /usr/share/fonts/truetype/noto
sudo cp noto-fonts/hinted/ttf/NotoNaskhArabicUI/NotoNaskhArabicUI-Bold.ttf /usr/share/fonts/truetype/noto
sudo cp noto-fonts/hinted/ttf/NotoSansAdlam/NotoSansAdlam-Regular.ttf /usr/share/fonts/truetype/noto
sudo cp noto-fonts/hinted/ttf/NotoSansAdlamUnjoined/NotoSansAdlamUnjoined-Regular.ttf /usr/share/fonts/truetype/noto
sudo cp noto-fonts/hinted/ttf/NotoSansChakma/NotoSansChakma-Regular.ttf /usr/share/fonts/truetype/noto
sudo cp noto-fonts/hinted/ttf/NotoSansOsage/NotoSansOsage-Regular.ttf /usr/share/fonts/truetype/noto
sudo cp noto-fonts/hinted/ttf/NotoSansSinhalaUI/NotoSansSinhalaUI-Regular.ttf /usr/share/fonts/truetype/noto
sudo cp noto-fonts/hinted/ttf/NotoSansArabicUI/NotoSansArabicUI-Regular.ttf /usr/share/fonts/truetype/noto
sudo cp noto-fonts/hinted/ttf/NotoSansCherokee/NotoSansCherokee-Bold.ttf /usr/share/fonts/truetype/noto
sudo cp noto-fonts/hinted/ttf/NotoSansSinhalaUI/NotoSansSinhalaUI-Bold.ttf /usr/share/fonts/truetype/noto
sudo cp noto-fonts/hinted/ttf/NotoSansSymbols/NotoSansSymbols-Bold.ttf /usr/share/fonts/truetype/noto
sudo cp noto-fonts/hinted/ttf/NotoSansArabicUI/NotoSansArabicUI-Bold.ttf /usr/share/fonts/truetype/noto
sudo cp noto-fonts/unhinted/ttf/NotoSansSymbols2/NotoSansSymbols2-Regular.ttf /usr/share/fonts/truetype/noto
sudo cp noto-fonts/hinted/ttf/NotoSansBalinese/NotoSansBalinese-Regular.ttf /usr/share/fonts/truetype/noto
sudo cp noto-fonts/archive/hinted/NotoSansSyriac/NotoSansSyriac-Regular.ttf /usr/share/fonts/truetype/noto
mkdir NotoSansSyriacEastern-unhinted
cd NotoSansSyriacEastern-unhinted
wget https://noto-website-2.storage.googleapis.com/pkgs/NotoSansSyriacEastern-unhinted.zip
unzip NotoSansSyriacEastern-unhinted.zip
sudo cp NotoSansSyriacEastern-Regular.ttf /usr/share/fonts/truetype/noto
cd ..
sudo apt install fontconfig
sudo apt autoremove
sudo fc-cache -fv
fc-list
fc-list | grep Emoji
sudo apt-get install -y fonts-dejavu-core
node -v
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - &&\
cd ..
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - &&sudo apt-get install -y nodejs
node -v
nodejs -v
npm -v
sudo apt install nodejs
nodejs -v
sudo apt-get -y nodejs
sudo apt-get install -y nodejs
node -v 2>/dev/null || sudo ln -fs /usr/bin/nodejs /usr/local/bin/node
nodejs -v
ls /usr/local/bin/node
ls /usr/local/bin//node
sudo ls /usr/local/bin//node
sudo ls /usr/local/bin/node
sudo ls /usr/local/bin//node
nodejs -v
echo $PATH
ls /usr/local/bin/
ls -l /usr/local/bin/
which node
ls /usr/bin
ls /usr/bin/no*
sudo ln -fs /usr/bin/node /usr/local/bin/nodejs
nodejs -v
sudo npm install -g carto
sudo npm install -g npm@9.6.5
sudo npm install -g carto
carto -v
npm install mapnik-reference
node -e "console.log(require('mapnik-reference'))"
cd
cd src/openstreetmap-carto/
carto -a "3.0.22" project.mml > style.xml
Download data and load into db
cd openstreetmap-carto/
ls scripts/
export POSTGRES_USER=postgres
export PG_MAINTENANCE_WORK_MEM=256MB
export PG_WORK_MEM=16MB
export psql=psql
bash scripts/tune-postgis.sh
sudo vi /etc/postgresql/*/main/postgresql.conf
sudo /etc/init.d/postgresql restart
sudo apt install -y osm2pgsql
sudo add-apt-repository -y ppa:osmadmins/ppa
apt-key adv --keyserver keyserver.ubuntu.com --recv A438A16C88C6BE41CB1616B8D57F48750AC4F2CB
sudo apt-get update
sudo apt-get install -y osm2pgsql
cd
wget -c https://download.geofabrik.de/europe/germany/hessen-latest.osm.pbf
ls -ltr
sudo sysctl -w vm.overcommit_memory=1
cd
wget -c https://download.bbbike.org/osm/extract/planet_8.294,49.99_8.979,50.252.osm.pbf
ls -ltr
cd ~/src
cd openstreetmap-carto
export OSM2PGSQL_CACHE=${OSM2PGSQL_CACHE:-512}
export OSM2PGSQL_NUMPROC=${OSM2PGSQL_NUMPROC:-1}
export OSM2PGSQL_DATAFILE=${OSM2PGSQL_DATAFILE:-data.osm.pbf}
osm2pgsql --cache $OSM2PGSQL_CACHE --number-processes $OSM2PGSQL_NUMPROC --hstore --multi-geometry --database gis --slim --drop --style openstreetmap-carto.style --tag-transform-script openstreetmap-carto.lua ~/hessen-latest.osm.pbf
python3 -m pip install psycopg2-binary
cd ~/src
cd openstreetmap-carto
scripts/get-external-data.py
cd ~/src
cd openstreetmap-carto
HOSTNAME=localhost # set it to the actual ip address or host name
psql -d gis -f indexes.sql
psql -d gis <<\eof
REVOKE CONNECT ON DATABASE gis FROM PUBLIC;
GRANT CONNECT ON DATABASE gis TO "www-data";
GRANT CONNECT ON DATABASE gis TO "jan";
eof
psql -d gis -c "\dt+"
Setup renderd
mapnik-config --input-plugins
sudo vi /etc/renderd.conf
ls /var/run/renderd/
ls -l /home/jan//src/openstreetmap-carto/style.xml
grep '^;xxx=\*\*' /usr/local/etc/renderd.conf
grep '^;xxx=\*\*' /etc/renderd.conf
sudo cp ~/src/mod_tile/debian/renderd.init /etc/init.d/renderd
sudo vi /etc/init.d/renderd
sudo mkdir -p /var/lib/mod_tile
sudo systemctl daemon-reload
sudo systemctl start renderd
sudo systemctl enable renderd
sudo vi /etc/apache2/mods-available/mod_tile.load
sudo ln -s /etc/apache2/mods-available/mod_tile.load /etc/apache2/mods-enabled/
test -f /etc/apache2/sites-enabled/000-default.conf || sudo ln -s /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-enabled
sudo vi /etc/apache2/sites-enabled/000-default.conf
sudo systemctl restart apache2
wget --spider http://localhost/osm_tiles/0/0/0.png
history | grep wget
tail -1000 /var/log/syslog
sudo tail -1000 /var/log/syslog
wget --spider http://localhost/osm_tiles/0/0/0.png
renderd -f -c /etc/renderd.conf
sudo service renderd enable
sudo service renderd start
sudo tail -1000 /var/log/syslog
sudo chown renderd /run/renderd/renderd.sock
sudo service renderd status
sudo chown _renderd /run/renderd/renderd.sock
sudo chown _renderd /run/renderd/
sudo service renderd start
sudo tail -1000 /var/log/syslog
sudo vi /etc/renderd.conf
sudo vi /etc/init.d/renderd
wget --spider http://localhost/osm_tiles/0/0/0.png
wget http://localhost/osm_tiles/1/0/1.png
wget http://localhost/osm_tiles/11/0/1.png
Comments