We have discussed how to start with Postgresql / Postgis. Once you have your database, the next most common need is to upload online the data.
Of course, there are many technical possibilities to do this. To keep within the most standard, the WFS and WMS streams setting from Postgresql / Postgis data is one of the most robust ways.
Therefore, we will now see how to start with Geoserver.
NOTE: The original article was written for Geoserver version 2.8. I updated it on 9/9/2016 to take into account the installation changes for version 2.9.1.
GeoServer is an open source computer server written in Java that allows users to share and modify geographic data. Designed for interoperability, it publishes data from all major sources of spatial data using open standards: PostGIS, Oracle Spatial, ArcSDE, DB2, MySQL, Shapefiles, GeoTIFF, GTOPO30, ECW, MrSID, JPEG 2000.
Using standard protocols, it provides KML, GML, Shapefile, GeoRSS, PDF, GeoJSON, JPEG, GIF, SVG, PNG files and more. GeoServer OpenLayers includes an integrated client for the preview of data layers.
Downloading Geoserver
You can download the latest Geoserver stable version of at http://geoserver.org/release/stable/
Installing Geoserver 2.9.1
The installation itself is very simple. On the other hand, a prerequisite for Geoserver is the installation of the Java Runtime Environment (JRE).
A further complication is that Geoserver does not work with the latest version (JRE9). It needs Jre8.
It is not a problem in itself, each Jre version is installed in a separate directory and several versions can coexist in the same place.
To download the Jre version that corresponds to your computer (32 or 64 bits)
Install Jre 8 and mark the directory in which you perform this installation (usually Program Files / Java / jre1.8.0_65), you will need to fill it during the Geoserver installation.
Launch the Geoserver installing programme. The following slideshow guides you through the answers of the different windows. Note: if you place the mouse pointer over the image, automatic scrolling stops

If you have a 64-bit jre installation, the first option is mandatory

If you have a 64-bit jre installation, the first option is mandatory

If you have a 64-bit jre installation, the first option is mandatory

If you have a 64-bit jre installation, the first option is mandatory

If you have a 64-bit jre installation, the first option is mandatory

If you have a 64-bit jre installation, the first option is mandatory

If you have a 64-bit jre installation, the first option is mandatory


If you have a 64-bit jre installation, the first option is mandatory

If you have a 64-bit jre installation, the first option is mandatory The only fundamental point is one before last window:

If you have installed a Jre 8 64-bit version, you must check the first option.
If not, you have the choice.
The second option is clear. Geoserver launches itself as a Windows service, at the start of your post. You do not have to worry about it.
If you check the first option, you will have to manually start and stop Geoserver. In the Windows program bar, under Geoserver, you have two programs: Start Geoserver and Stop Geoserver.
The first opens a command window that you can minimize (not close!). The second stops the server and permanently closes the command window.
Tip: Always close Geoserver strictly using the Stop Geoserver program.
Once the installation is completed, either Geoserver is running (Service option) or you can launch it with the Start Geoserver program.
Interface administration Geoserver is managed from a web interface. To access it, type the following address in your browser: http: // localhost: 8080 / geoserver.

Enter your username and password to login.

For a “quickstart” visit http://docs.geoserver.org/stable/en/user/gettingstarted/web-admin-quickstart/index.html
Uploading the Postgis table created in the Postgresql / Postgis tutorial.
We’ll refer to the basics, to upload a WFS / WMS feed from the Postgis table created in the previous tutorial.
We will use two Geoserver concepts: the Data Store and the Layer.
If we want to upload a shapefile, we’ll have to use two concepts: Data Directory and Workspace.
The Data Directory has been defined during the installation. By default it is geoserver / data_dir / data.
If you want to upload a shapefile, you have to create a subdirectory in the Data Directory, and copy it into this subdirectory.
Physically, the data is correctly place in Geoserver. But it must also be logically placed. We must, therefore, define this subdirectory as Workspace in the administration interface-> Workspace> Add workspace. Then, you will allocate a name that may be the same or not.
In the case of a Postgis database, it cannot be in the Data Directory. These two notions are then omitted, the Postgis database being in itself a workspace for Geoserver.
Here are some examples of data warehouses in a Geoserver installation:

Adding a Data Store – Data Warehouse – Postgis In the left menu bar, click Warehouses

Click Add New Datastore. The following window opens

Click Postgis, the configuration window opens:

Leave the workspace by default (quote)
Give a name to the data source (name that will appear in the admin interface and not necessarily the same as the layer name)
Give the database connection information: host (localhost), port (5432), database (postgis_22_sample), schema (public), user (postgres), passwd (the postgres password for your database).
Click the Save button at the very bottom of the page.
Adding a layer Click on the Layers option in the left menu. The available layers page opens

Click Add New Resource

You will see the Data Store you just created (quote: your name). Select it. In the line corresponding to the layer you want to upload, click Publish.

The configuration page fort the uploading of your layer opens:

Enter a title and a summary. Leave the rest by default, except the rights-of-way. Click on ” Data based »And« Calculated on native rights of way To fill the control values .

Fill in the definition of the coordinate system for the layer.

To do this, click on the Search button and look for the coordinate system of your layer. In this case it’s Lambert 93. The Native SRC is not defined. (When loading the layer into the Postgis database it was set to zero = no system).
In CRS Management select Force the variable definition.
You can now save the layer. To see the result, on the left menu bar, click Layer Preview, and then in the corresponding line for the layer you just created, click OpenLayers.

A page with the result of the layer is displayed:

Note that the address of the page, in the browser address bar “C” is the address that you will be using if you want to connect with the WMS stream with QGis (http: // localhost: 8080 / geoserver / cite / wms?) or to the WFS feed (http: // localhost: 8080 / geoserver / quote / wfs?)