If you want to install in Ubuntu, those commands should be:
sudo apt update
sudo apt install gcc make default-libmysqlclient-dev mysql-server libpcre3-dev git zlib1g-dev
sudo systemctl start mysql
sudo mysql
sudo mysql hercules < main.sql
sudo mysql hercules < logs.sql
sudo mysql hercules < item_db_re.sql
sudo mysql hercules < mob_db_re.sql
sudo mysql hercules < mob_skill_db_re.sql
sudo ufw allow 6900/tcp
sudo ufw allow 6121/tcp
sudo ufw allow 5121/tcp
sudo ufw reload
=======
On Ubuntu you may want to give permission to remote access on your database.
You will need to change the bind-address configuration from mysql:
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
change bind-address = 127.0.0.1 to bind-address = 0.0.0.0
don't forget to port forward on the router and to configure the firewall