I struggled setting up a server so i figured i write a gist to help me in the future/anyone wanting to set one up too. I do not recomend that you run the server as root. yes there are better ways to do this but this was what i did and it works.
self explainatory.
sudo passwd
enter what ever password you want for
su root
apt-get update || apt-get upgrade
apt-get install glibc-source
wget --content-disposition https://www.factorio.com/get-download/latest/headless/linux64
tar xf factorio <tab to autocomplete>
cd factorio/data
cp server-settings.example.json server-settings.json
nano server-settings.json
make all of the changes that you want to the server-settings
cp map-gen-settings.example.json map-gen-settings.json
cp map-settings.example.json map-settings.json
you dont have to change anything in these files if you dont want to they are just there as the settings to generate the world.
cd ~/factorio
./bin/x64/factorio --create saves/my-save.zip --map-gen-settings ./data/map-gen-settings.json --map-settings ./data/map-settings.json
./bin/x64/factorio --start-server <file> --server-settings ./data/server-settings.json
after your first run you can use
./bin/x64/factorio --start-server-load-latest --server-settings ./data/server-settings.json
thats it you should be able to connect to your server now through the server browser or direct connecting.