Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I have seen a few things about servers for Factorio. One of them was how to setup a server, which happens to be one of my favorite things to do with any game. Below i am going to post a step-by-step guide on how to accomplish this.
- The first thing that you should understand however is that my guide is going to be from the Linux perspective. I am going to assume you have zero knowledge on how to do any of it and explain everything in very select detail. If i miss anything please correct me as i want this to be for anyone who needs it.
- The second thing you should understand is that i am also going to assume you are renting a VPS (Virtual Private Server) from a company like OVH (https://www.ovh.com/world/vps/vps-ssd.xml). This is the host i use for everything so i trust them completely. With that in mind if you were wanting to host your own Linux server and build out the OS. You are more than welcome to do so and these steps will work for you as well, if you use the same distro that i am going to be using.
- *****Prerequisites*****
- So to get started you will need a few applications.
- 1 - Filezilla
- 2 - Notepad++
- 3 - Winrar/7zip
- 4 - Putty
- These applications are all windows based and i assume you to be using windows to play the game and setup the server. i suggest making this easy on yourself and going to ninite.com checking the boxes for those apps and then using their installer to set it up.
- Finally you also need the Factorio Headless application. which is avaliable herer: https://www.factorio.com/download-headless
- Download the latest version.
- *****The Initial setup*****
- When you first buy a VPS you will need to tell it what Operating System you want to use. I am using Debian 9+ and i suggest you do the same for simplicity sake{Ubuntu should also work}. After everything is done processing you will be emailed a few things. An ip address, a username, and a password. These are important. First we need to SSH to the server. So open Putty and type the IP address of your new server given to you by OVH/Host this will then ask for a username and password. Use the ones supplied in your email. Once connected you will be given a prompt like root@vps###### This is the root prompt of the server and now we are ready to start setting up. (NOTE: when you type passwords in Linux nothing pops up on the screen. Just keep typing! ALSO DO NOT USE THE NUMBER PAD!!)
- The best thing to do once you log in is to set a new password. I highly suggest doing this even though once we are done you wont be using/needing the root user account again. To do so issue the following command. It will then ask you for the old password. (refer to your email). Then it will ask you for the new one you want to use. Use something you can remember but that isnt to simple and isnt overly to long like 30 characters.
- COMMAND: passwd
- *****Installing Apps*****
- So we have a server and a login, GREAT! Lets install somethings we will need for simplicities sake I will be using the tools i use as i know them best.
- COMMAND: sudo apt-get update
- COMMAND: sudo apt-get install vim
- COMMAND: sudo apt-get install screen
- Vim is a text editing application. Its very powerful and also simple.
- Screen is a tool that allows you to have a persistent window that once detached it allows you to close putty without it stopping the current process. This is where the server will actually run.
- *****Making a new user*****
- Next thing we want to do is secure the username/password and create a new user. This is just basic Linux good practice. To do so There will be some commands below that i will explain as we go. Again, i am assuming you know nothing of Linux so do not feel insulted.
- COMMAND: sudo adduser {USERNAME}
- This command adds a user with the username you choose, it will also tell you to set a password. Make this a pretty good one! {replace {USERNAME} with the username of your choice do so for the rest of the guide.}
- COMMAND: sudo usermod -aG sudo {USERNAME}
- This will give your new user admin rights, in Linux what we call SUDO (Super User Do) rights.
- Awesome we have a user with admin rights! Lets test it. Open a new Putty window. type in the IP, and this time use the username and password you setup.
- If it worked GREAT! We are ready for the next step. If it didnt, then please post below or first try to do it again. you can delete the user if you like with COMMAND: sudo deluser {USERNAME} in the original window.
- *****Disabling Root login*****
- So if it worked for you then you can now close the original window and we can work with JUST your user.
- From here the guide gets a little more advanced however please do not be discouraged! we can work this out.
- We need to disable the root login. To do this we will need to edit a file so type the command below.
- COMMAND: sudo vim /etc/ssh/sshd_config
- This will open a file and you will notice its all blue. use your arrow keys and scroll down to where it says "#PermitRootLogin yes". Vim has many modes, right now we will use the EDIT or INSERT function. Push the letter I and you will notice that -- INSERT -- appears at the bottom of the screen. navigate the little cursor to change the line to read "PermitRootLogin no" So you will need to remove the # and change YES to NO (lowercase). once this is changed press ESC, then type :wq and hit enter. In order this string of actions exits the editor mode, tells the editor we want to perform an action and the two actions we are performaing are WRITE and QUIT. If you find that you screw something up while editing press ESC, type :q! and then hit enter. This is the "escape" without quitting option.
- So if that closed properly then we should be to the point where we need to restart the SSH service. Issue the command:
- COMMAND: /etc/init.d/sshd restart
- You will get a few entries about stopping and starting. This is good and you should get a big OK from the terminal window.
- Now if everything went right then we can test it out. Open another Putty window, and try using the root username with the password you set. If it worked then please go back and try to do this section again. If you got an ACCESS DENIED then it looks like it worked! Perfect! Now we are ready to work on Factorio, whew....alot of work to not even have the game working yet. Dont worry though! it will get better!!
- *****SETTING UP FACTORIO*****
- So you have the headless file for Factorio. Now we need to get it to Canada! Go buy a small envelope.....no no no...there are better ways!
- So in your Putty window you want to make a folder called factorio, issue the command below:
- COMMAND: mkdir factorio
- I know thats easy!
- Now open up the Factorio headless file using Winrar/7zip and drag out the folder inside it. (also named factorio) Save them some place you can easily get to them.
- Open up the factorio folder, you will see 2 folders and one file. Create a few folders here. Each named as such (user lowercase!!) mods, saves, config. Now you will see 5 folders. the 3 you created and the 2 that you already had.
- Now open the data folder. You will see 4 files that each have .example.json on the end. Copy these files into the newly created config folder that you made. You will also want to rename them to not have example in their name.
- They should be named like this:
- map-gen-settings.json
- map-settings.json
- server-settings.json
- server-whitelist.json
- So now, we have a structure.
- Lets also now create a file that we will need to start our server and generate the map. This is important and makes your job 1000x easier.
- Open notepad++ and put the following line in the window.
- ./bin/x64/factorio --create ~/factorio/saves/Server_Save.zip --map-gen-settings ~/factorio/config/map-gen-settings.json --map-settings ~/factorio/config/map-settings.json --server-settings ~/factorio/config/server-settings.json
- Save this in the factorio folder as createmap.sh
- Next open a new tab in notepad++ and put another string of text into the window.
- ./bin/x64/factorio --start-server ~/factorio/saves/Server_Save.zip --map-gen-settings ~/factorio/config/map-gen-settings.json --map-settings ~/factorio/config/map-settings.json --server-settings ~/factorio/config/server-settings.json
- Save this in the factorio folder as startserver.sh
- *****CONFIGURE SERVER SETTINGS*****
- Now would be a great time to configure the actual .json files to the settings you want. This is where Notepad++ comes in. Now what is located where?
- map-gen-settings.json - These are the settings for resources. How righ and how big the veins are.
- map-settings.json - These are the difficulty settings. Biters, recepie and such. These settings are a bit harder to understand.
- server-whitelist.json - This is if you NEED a whitelist. A password should generally keep most people out (if you want to have one.)
- server-settings - These are the actual server settings (imagine that). The important parts are the server name, description, player count, password, and factorio credentials.
- I will provide an example of the specifics you need. Just change the values I have here, leave the rest of the document default.
- "name": "Noob's Private Server"
- "max_players": 0,
- "username": "YOUR_USERNAME",
- "password": "YOUWISH1111",
- "game_password": "YOUWISH1211",
- For the username/password use your factorio username and password. Many suggest using a token however i think this is a better way of doing things. Its also easier.
- Let's now get these files over to your server! I hope you saved all your changes!!!
- *****MOVING FILES*****
- Open up Filezillla. You will see four blanks. HOST, Username, Password, and Port.
- Host: The ip of your server.
- Username: The username you set above.
- Password: The password you set above.
- Port: 22
- You will then be connected to your server. You will notice on the right hand side you see a structure that looks something like this /home/{username}/factorio
- Open the Factorio folder on your computer, and drag the contents of it over to the FileZilla window into the factorio folder on the right.
- It will take some time to copy all the files but thankfully its small.
- Once all the transfers are complete we may now start actually configuring Factorio. Lets verify however that the files are located where we need. First lets learn some Linux!
- Just some small commands that would be good to know and remember. ALL COMMANDS ARE LOWERCASE ANYTHING IN UPPERCASE IS A VALUE TO BE REPLACED.
- COMMAND: ls - displays the contents of the current directory
- COMMAND: cd FOLDER_NAME - changes the current directory to another directory. replace FOLDER_NAMEwithy the name of a folder you want to view.
- COMMAND: cd .. - go up one directory.
- COMMAND: cd ~ - goto your home directory. (/home/{username}/)
- Open your Putty window, it may have timed out so you may have to reconnect to the server. (HINT in putty after the connection times out you can right click the bar at the top and click RESTART SESSION)
- Ok so you know the commands lets look where files are located. This would be a good time to use what you see above and try your own hand at it. If you dont feel comfortable doing so just follow my guide below.
- Issue the commands as you see them.
- COMMAND: cd ~
- COMMAND: cd factorio
- COMMAND: ls
- _-_-_-NOTE: the files you see_-_-_-
- COMMAND: cd config
- COMMAND: ls
- _-_-_-NOTE: the files you see_-_-_-
- everything on your putty window should look identical to what you see in your local folder.
- *****FINAL SETUP*****
- Now, we have a ton of things setup. We just need to run a few commands to make things work right. Run the following commands.
- COMMAND: sudo chown {username}:{username} ~/factorio/* -R
- COMMAND: sudo chmod +x ~/factorio/createmap.sh
- COMMAND: sudo chmod +x ~/factorio/startserver.sh
- COMMAND: sudo chmod +x ~/bin/x64/factorio
- *****Home Stretch!*****
- ALRIGHT!! We have all the parts in place. We just need to make the map and start the server.
- In the putty window again we just need to do a few simple steps. we need to move to the factorio directory. and run the scripts. Run the commands below.
- COMMAND: cd ~/factorio
- COMMAND: ./createmap.sh
- You should see some text across the screen, this is making the map for the server. Once this is done we have all the parts and just need to start the server. Run the following command.
- COMMAND: screen
- This will make a persistent workspace inside the server. now you just need one more command.
- COMMAND: ./startserver.sh
- Ok the server is started! But we have two more very important steps!!!!! DO NOT FORGET THESE!!!
- Press these two key combinations.
- CTRL+A
- CTRL+D
- This will detach you from your SCREEN session. If you do not do this what will happen eventually is when you close or when your Putty window times out your server will crash. Which is BAD JUJU!!
- And finally, thes most important part. TEST IT! Open Factorio and browse the servers for the one you just created. It will be named what ever you named it in the steps above.
- This guide is VERY VERY VERY rough right now and its likely going to need some work. I am going to do everything i can to make this work properly.
Advertisement
Add Comment
Please, Sign In to add comment