Uninstall the old version
sudo dpkg --purge postgis postgresql-9.3-postgis
1. Install postgresql $sudo apt-cache search postgresql //find the latest postgresql package $sudo apt-get install postgresql package name//Select the package name to install
2. Install postgis
$sudo apt-cache search postgis
$sudo apt-get install postgis
3. Change the password
sudo -u postgres psql
alter user postgres with password 'postgres';
/q quit
4. Install the graphical management tool pgadmin
sudo apt install pgadmin3
Use the graphical management tool to create a spatial database, and add the corresponding extension (postgis must be added).