Howto install H-MDM

Starting from Open Source Mobile Device Management? here’s a quick install howto of H-MDM for testing.

We install with postgressql db password “topsecret”, you may change it to be more secure.

# Download dependencies
yum -y install nethserver-tomcat tomcat8 java-1.8.0-openjdk nethserver-postgresql unzip

# Enable and start tomcat8 instead of 7
systemctl disable tomcat --now
systemctl enable tomcat8 --now
signal-event firewall-adjust
config setprop tomcat status disabled

# Create DB and user with password topsecret
su - postgres -c psql
CREATE USER hmdm WITH PASSWORD 'topsecret';
CREATE DATABASE hmdm WITH OWNER=hmdm;
\q

# Download and unzip and prepare h-mdm and aapt
wget -nc https://h-mdm.com/files/hmdm-3.09-install-ubuntu.zip
wget -nc https://dl.google.com/android/repository/build-tools_r28.0.2-linux.zip
unzip -o build-tools_r28.0.2-linux.zip
mv -f android-9/* /usr/local/bin/
unzip -o hmdm-3.09-install-ubuntu.zip
cd hmdm-install
chmod +x hmdm_install.sh

# change tomcat path for installing to tomcat8
sed -i 's!/var/lib/tomcat8!/opt/tomcat8!' hmdm_install.sh

# run installer
./hmdm_install.sh

Then go through the installer, you just need to enter the postgresql password and your domain / IP address.

Please choose the installation language (en/ru) [en]: en

PostgreSQL database setup
=========================
Make sure you've installed PostgreSQL and created the database:
# CREATE USER hmdm WITH PASSWORD 'topsecret';
# CREATE DATABASE hmdm WITH OWNER=hmdm;

PostgreSQL host [localhost]: localhost
PostgreSQL port [5432]: 5432
PostgreSQL database [hmdm]: hmdm
PostgreSQL user [hmdm]: hmdm
PostgreSQL password:
Password:
Failed to connect to localhost:5432/hmdm as hmdm!
Please make sure you've created the database!
[root@testserver hmdm-install]# ./hmdm_install.sh
Please choose the installation language (en/ru) [en]: en

PostgreSQL database setup
=========================
Make sure you've installed PostgreSQL and created the database:
# CREATE USER hmdm WITH PASSWORD 'topsecret';
# CREATE DATABASE hmdm WITH OWNER=hmdm;

PostgreSQL host [localhost]: localhost
PostgreSQL port [5432]: 5432
PostgreSQL database [hmdm]: hmdm
PostgreSQL user [hmdm]: hmdm
PostgreSQL password: topsecret

File storage setup
==================
Please choose where the files uploaded to Headwind MDM will be stored
If the directory doesn't exist, it will be created

Headwind MDM directory [/opt/hmdm]: /opt/hmdm

Web application setup
=====================
Headwind MDM requires access from Internet
Please assign a public domain name to this server

Protocol (http|https) [http]: http
Domain name or public IP (e.g. example.com): example.com
Project path on server or ROOT [/hmdm]: /hmdm
Tomcat virtual host [localhost]: localhost

Ready to install!
Location on server: /opt/hmdm
URL: http://joomla.local:8080/hmdm
Is this information correct [Y/n]? y
Tomcat config file created: /opt/tomcat8/conf/Catalina/localhost//hmdm.xml
Deploying hmdm-3.09.0004.war to Tomcat: /opt/tomcat8/webapps//hmdm.war
.................................
Deployment successful, initializing the database...

======================================
Headwind MDM has been installed!
To continue, open in your web browser:
http://example.com:8080/hmdm

Now just create a reverse proxy in web UI for “example.com” to http://localhost:8080

Browse to https://example.com/hmdm and test H-MDM

You need a domain for the reverse proxy but it works at https://<NETH_IP>:8080/hmdm too.

Sources:

https://androidaapt.com/

6 Likes

Wasn’t there something else using port 8080? I know Collabora wanted that port, but I had to change it to 8082 because of a conflict.

Yes but just tomcat. It’s a tomcat app so it shouldn’t matter.

https://wiki.nethserver.org/doku.php?id=network_ports

Thank you for the HowTo! I tried to install it and the installation went through…

What I would like to ask is how can/should the Android client access the server from outside?

I would like to use my Linux-Firewall and forward the port 8080, is this possible?

Is it safe to forward the port into the green zone to the MDM-Server or is it better to put the MDM-Server in the DMZ?

Thanks for testing!

I didn’t test connection with mobile phones but I assume via https. Maybe @h-mdm can help?

Yes but if you use the reverse proxy you use https and don’t need extra firewall config.

I’d prefer DMZ for webservers in production

A post was merged into an existing topic: Open Source Mobile Device Management?

Hi mrmarkuz. I did follow your post and everything was ok. But something is strange. I am not expert in Linux so i need a help if possible. https://mydomain/hmdm is working fine. But if i use http (not secure) is working too. How can i fix this? And beyond that when i click on QR Code button it send me to http://mydomain:8080/hmdm/#/login

Can you help me to fix?

Tks
Junior

Hi and welcome to Nethserver Community,

Tomcat is used, a redirect to https as explained here should help, I’m going to test it.

The installer asks for an URL, I assume it is used for the QR code link.

3 Likes

Markuz I decided to install again…
But i don’t know why i am getting this message. Where am i going wrong?

error

:disappointed:

do you have tomcat9 installed and is the install path /var/lib/tomcat9?

also what version of the installer are you using?

1 Like

Yes, take a look:

Screenshot at Aug 05 11-05-26

“what version of the installer are you using?”

I used what is on this page: Advanced installation of Headwind MDM suitable for production

  1. Build Headwind MDM

git clone github.com/h-mdm/hmdm-server.git
cd hmdm-server/
apt install -y maven mvn install

  1. Alternative: download and unzip the binary installer
    wget h-mdm com/files/hmdm-5.09-install-ubuntu.zip
    unzip hmdm-5.09-install-ubuntu.zip
    cd hmdm-install/

that doesn’t work for CentOS 7… can you verify if the packages needed are provided via centos repositories?

1 Like

I am using Ubuntu 20.04 LTS Server. I only followed the tutorial…

I’m really sorry, but this community is about another distro… currently based on CentOS7 .
Maybe the community of Ubuntu Server or H-MDM might be a environment closer to yours, with a better knowledge and comprehension about the application server and the distro.

I didn’t know. The first post talks about Ubuntu so I thought I was in the right place.
Tks.

Hoping the best for your test installation, @Ed_Junior :wink:

in hmdm-server folder try running
cp server/build.properties.example server/build.properties
then re run mvn install

after that run ./hmdm_install.sh

3 Likes

I’ve managed to get it installed on proxmox and I’m just in the process of building there app (with android studio) if I can get it to enrol and more importantly control the device I’ll get a workaround setup for centos and hopefuly an install script

1 Like

Shane i’d like to thank you very much. After your tip:

in `hmdm-server` folder try running
`cp server/build.properties.example server/build.properties`
then re run `mvn install`
after that run `./hmdm_install.sh`

Installation was perfect and server is already in production. Thank you very much. Sorry my english

3 Likes

Glad I could help

2 Likes