The following are prerequisites to run OptServer:
- OptServer is only available for 64bit Linux.
- Access to a PostgreSQL database is required.
- MOSEK binaries are required. If the OptServer is installed from a standard MOSEK distribution, then it will naturally contain the necessary files, however an external MOSEK installation can also be used.
4.2 Locating files¶
The relevant files of the Optimization Server are organized as reported below
||Scripts and binaries|
||Configuration files and certificates|
||Runtime directory, Web interface|
<MSKHOME> is the folder in which the MOSEK Optimization Suite has been installed.
To install OptServer and test the installation perform the following steps.
4.3.1 Run install script¶
Run the script
<MSKHOME>/mosek/9.2/opt-server/bin/install_MosekServer to configure the server. The full list of supported options can be obtained via
As a reasonable minimum the configuration should specify where to install the server, the port to listen on, the database connection string and the location of an available MOSEK installation. For example:
./install_MosekServer --inplace \ --port $PORT \ --mosekdir ../../.. \ --database-resource "host=/var/run/postgresql user=$USER dbname=$DBNAME sslmode=disable"
The install script creates a configuration file
<MSKHOME>/mosek/9.2/opt-server/etc/Mosek/server.conf which can be edited by hand if necessary.
4.3.2 Initialize the database¶
to initialize the database. It will use the information provided in the database connection string specified in the previous step. This step is not necessary if the database exists from a previous installation.
4.3.3 Initialize admin password (optional)¶
If the Web interface to the OptServer is to be used, run
to set the password for the
admin user. This step is not required if the Web GUI will not be used. Note that the GUI will only be available with SSL enabled, see Sec. 6.3 (Security).
4.3.4 Run the server¶
Start the server by running the script
The server will print its initial configuration and continue writing the log to a file. To obtain the full list of server options run
For debugging purposes it is convenient to use the options
./MosekServer --debug --logfile -
This will increase the amount of debug output and redirect it to standard output.
4.3.5 Test the installation¶
To test that the OptServer is working properly locate, compile (if necessary) and run the example
opt_server_sync.* for either C, Python, Java or C#. Examples and sample data files can be found in the distribution package under
For example, assuming that MOSEK was installed in Python, one can go to the folder with Python examples and run
python opt_server_sync.py ../data/25fv47.mps $SERVER $PORT
$SERVER:$PORT points to the OptServer. If the configuration is correct the example will print a log from solving the problem and a solution summary. In case of issues the log output of the OptServer should be consulted to determine the cause.
This example also demonstrates how to use the OptServer from the MOSEK API.