How to Install on Linux
Scenarios for Linux
Before Start: There aren't any siginificant difference between Linux and Windows installation processes. Only differences are escape characters (^ for windows and for linux) which are used to keep commands in multiline style.
Please follow one of the scenarios below which fits your setup or plan:
- Scenario A) I don’t have a 3DCityDB instance on docker and want to create a new one, import the features and test upgrade scripts on this new docker image.
- Scenario B) I have already a 3DCityDB instance on a docker container and want to try upgrade scripts on it.
- Scenario C) I have already a 3DCityDB instance in a physical computer and want to try upgrade scipts on it.
- Scenario D) If you want to create a 3DCityDB instance in a physical computer, please visit the official documentation page.
Scenario A
(I don’t have a 3DCityDB instance on docker and want to create a new one, import the features and test upgrade scripts on this new docker image.)
Tasks: Create 3DCityDB instance, import features and upgrade it to v5 using docker
- 1) Pull the latest docker image
docker pull tumgis/3dcitydb-v5
- 1 Optional) Force to remove docker container if doesnt run first time
docker rm -f -v YOURCONTAINERNAME
Also you can remove the docker image to download latest one:
docker rmi tumgis/3dcitydb-v5
- 2) Run docker container with a specific port forwarding Note: If you need specify shared_buffer for PG, add following parameter: "--shm-size=1g "
docker run -d --name YOURCONTAINERNAME -p YOURCUSTOMPORT:5432 \
-e SRID=YOURSRIDNUMBER \
-e POSTGRES_PASSWORD=YOURDATABASEPASSWORD \
-e POSTGRES_DB=YOURDATABASENAME \
-e POSTGRES_USER=YOURPOSTGRESQLUSERNAME \
tumgis/3dcitydb-v5
- 3) Run importer with edge-alpine tag Run terminal from the folder in which you have GML files. ...or just specify relative path of GML files after "/share"
docker run --interactive --rm -t \
--network host \
--name impexp \
-v $PWD:/share \
3dcitydb/impexp:edge-alpine import \
-H localhost -d YOURDATABASENAME -p 'YOURDATABASEPASSWORD' \
-u YOURPOSTGRESQLUSERNAME -P YOURCUSTOMPORT \
/share/
- 4) Run upgrade script inside the container "demo13" Your database connections will be same with you defined, but hostname is "localhost" and the port number will be "5432". (It is because you will run the script already inside the container.)
docker exec -i -t YOURCONTAINERNAME /3dcitydb-v5/upgradeto_citydb_v5.sh
- 4 Optional) You can check for errors if any exists:
docker exec -i -t YOURCONTAINERNAME cat /3dcitydb-v5/logs/errors.txt
Scenario B
(I have already a 3DCityDB instance on a docker container and want to try upgrade scripts on it.)
Tasks: Upgrade an existing docker 3dcitydb to v5 using docker
- 1) Download whole package as ZIP file and extract it.
- 2) Run following command and copy your container's ID:
docker ps -a
3) Start by commiting and paste as "existingContainersID":
docker commit -m "created to upgrade citydb v5." existingContainersID newimagename
- 4) Run following command to create a new container with an image name which given in previously command. Please consider that, you should give the directory of extracted ZIP as volume sharing (-v) directory.
docker run --name newcontainername -d \
-e POSTGRES_PASSWORD=yourPassword \
-e SRID=yourSRIDNumber \
-v "/yourDirectory/inwhichYouExtracted/theZIPFile":/share \
-e POSTGRES_DB=yourDatabaseName \
-e POSTGRES_USER=yourUsername \
newimagename
- 5) You can now run following command in this new container:
docker exec --interactive --tty \
newcontainername \
bash /share/3dcitydb-v5-master/upgradeto_citydb_v5.sh
Scenario C
(I have already a 3DCityDB instance on a physical computer and want to try upgrade scripts on it.)
-
1) Download whole package as ZIP file and extract it.
-
2a) If you are on a linux machine, make "upgradeto_citydb_v5.sh" executable by: Right Click to file, go to properties menu, click to permessions tab and check execute box. or just open terminal in current directory and enter "chmod +x upgradeto_citydb_v5.sh".
-
2b) If you are on windows machine: You need to activate "Windows Subsystem for Linux (WSL)" feature on Control Panel. and additionally install a linux package from Microsoft Store. Then simply run following script on hat package.
-
3) Run the script:
./upgradeto_citydb_v5.sh
Scenario D
- If you want to create a 3DCityDB instance in a physical computer, please visit the official documentation page.