Minecraft
[FREE] {PT: 1} MC server hosting! Guide (GOOGLE CLOUD PLATFORM)
Submitted by ZECHEESEDEV, 07-08-2020, 08:57 PM, Thread ID: 178206
Thread Closed
07-08-2020, 08:57 PM
#1 This post was last modified: 07-08-2020, 08:58 PM by ZECHEESEDEV
Hi guys! I've seen some posts recently around here regarding people wanting to make MCservers, but they dont have the money to spend on paid hosting. I have the perfect solution for you!
Google Cloud Platform: You gain $400 dollars worth of credit when you sign up: so if you get a somewhat high capacity server (10gb ram 2 vcores), you can maintain that for around 6-7 Months. You will need some experience with the linux ssh shell and such, but if you aren't that familiar with it, I'm here to teach you! I have written a guide (to the best of my abilities),Hope you enjoy the guide!
~cheese
Google Cloud:<- Click to go to google cloud. (Sign up, and verify using your bank card [NO CHARGES WILL BE APPLIED REQUIRES CARD FOR VERIFICATION PURPOSES])
Step 1: Create a VM:
When you first login,we need to create a instance, so click "Go to compute Engine" to make a VM.
[/url]
When you get redirected, you should see something like this:
[url=https://ibb.co/rZNpTN9]
Click "Create Instance"
[url=https://ibb.co/rZNpTN9]
Click "Create Instance"
Name the VM whatever you want
Choose the ram and cores to your liking. For optimal performance and minimal costs (Reminder: this is paidhosting. You are using the welcome credits to pay for it.) If you ask me, I would recommend 2 cores and 10 gb of ram.
Estimated costs will show up in the side bar.
You can see that you can run a 10gb 2vcore Server (Doesn't just have to be MC for almost 7 months... thats quite insane.)
For the OS installation, choose ubuntu. (I KNOW THAT CentOS is optmized for server performance, but I haven't gotten to that level yet :shrug
After that click create. Your Virtual Machine will now be created.
STEP 2: How to open a SSH shell:
1. Navigate to the compute engine tab
2. Click VM instances
3. Select the VM instance that you would like to SSH into and click SSH
4. Done
STEP 3: How to update Java (INSIDE SSH SHELL):
(!) Remember to NOT INCLUDE ?$: When entering commands!
1. Open a SSH Shell (STEP 2)
2.To install this version, first update the package index:
$: sudo apt update
3. Next, check if Java is already installed:
$: java -version
4. If Java is not installed, youll see the following output:
Command 'java' not found, but can be installed with:
apt install default-jre
apt install openjdk-11-jre-headless
apt install openjdk-8-jre-headless
5. Execute the following command to install the default Java Runtime Environment (JRE), which will install the JRE from OpenJDK 11:
$: sudo apt-get install -y default-jre-headless
6. Verify installation by running:
$: java -version
Console should output:
openjdk version "11.0.7" 2020-04-14
OpenJDK Runtime Environment (build 11.0.7+10-post-Ubuntu-2ubuntu218.04)
OpenJDK 64-Bit Server VM (build 11.0.7+10-post-Ubuntu-2ubuntu218.04, mixed mode, sharing)
7. Done Good job, youre now you can put systems administration on your resume :wink:
STEP 4: How to install a FTP server (FTP Access):
By default, Google cloud Linux does not come with FTP server application, that is why were going to install vsftpd daemon. Lets update our package list before vsftpd installation.
1. After you have opened the ssh shell (Step 2), Well create a new Linux User by executing the below command. You also can use your existing user.
Run the following commands:
$: sudo apt-get update
$:sudo apt-get install vsftpd
2. After Installation, Create a backup file of vsftpd.conf.
$: sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.back
With a backup of the configuration in place, were ready to configure vsftpd.
3. After you have opened the ssh terminal, Well create a new Linux User by executing the below command. You also can use your existing user.
$: sudo adduser whateveryouwantyourusernametobe
4. We need to configure some things in the vsftpd config file.Uncommment the write_enable setting. This will allow user to upload files
$:sudo nano /etc/vsftpd.conf
5.Next, add the two line below, the first setting will insert the username in our local_root directory path. And the second will define our ftp user default directory.
$: user_sub_token=$USER
$: local_root=/home/$USER/ftp
6. Save the file by pressingctrl+xthenY, and thenenter.
7. Now, we need to restart the server for the changes to take effect:
$:sudo systemctl restart vsftpd
8. For the sake of this guide, I will use Filezilla Ftp client application.
After you have installed Filezilla. Open it and navigate to File>> Site manager>> New site.
Now, paste the external IPaddress on the Host field. Then select the Encryption as Only use FTP(insecure).
After that type your user name and password. Next, Press the Connect button.
STEP 5: How to open ports (Opening Ports):
1. Direct yourself to the VM instance:
2. Click Setup Firewall Rules:
3. Create a new firewall rule:
4. Set a name for the port opening (MAKE IT CLEAR AND CONCISE)
5. For the description: Set what process will be using that port (Set it as Open port {port number - port number} for {process name} - {inbound/outbound traffic}
6. Leave Logs OFF
7. Set the priority. (1 means that it has the highest priority and will override all ports below 1, vice versa for 65535. ) REMEMBER THAT THE HIGHEST YOU CAN GO IS 65535!!
8. For the ?Targets Selection, select ?All instances on the network
9. Set ?Source IP ranges to 0.0.0.0/0 (CIDR Notation) (0.0.0.0/0) Means ALL IPs.
10. To select the ports, select which protocol you would like to use, and enter ports, or port ranges. (XX, X-XXXX are all valid formats.)
11. Click ?Create And youre done! GGs. You just opened a port!
STEP 6: How to Import files from the bucket (IF YOU DONT WANT TO USE FTP)
1. Create a bucket.
2. Upload files to said bucket
3. Open a SSH shell as we are going to upload some files:
4. You should understand how the directory paths work. For our case, they look like this: /home/{user}/
5. To transfer files, we are going to use ?gsutil
6. The command we use to download files from the bucket to the VM is:
$: gsutil cp gs://[BUCKET_NAME]/[OBJECT_NAME] [SAVE_TO_LOCATION]
For our sake, were going to upload the files to the /home/ folder.
7. Replace [BUCKET_NAME]/[OBJECT_NAME] with the name of the bucket. (The name of the bucket we are using is: skywarsmain)
8. Replace [SAVE_TO_LOCATION] with /home/
9. In the end you should have something like this: gsutil cp gs://bucketname /home/
10. Good job, you just found a replacement to FTP :D
STEP 7: How to install and use ?screen (SCREEN APP):
1. Open a SSH shell (CHECK STEP 2)
2. What is ?screen? Screen is an application that allows multiple use of terminal sessions within one window. This allows you to simulate multiple terminal windows where it may not be normally possible. For example, If I wanted to run multiple MC server instances on one machine, I would need screen to keep them separate from each other.
3. To install screen, run: $: sudo apt-get install screen
4. To verify the installation, run screen -v If it is properly installed, it should show the screen version.
5. Screen installation done.
STEP 8: Start the server (Execute the Java Executable):
1. Open a SSH shell (CHECK STEP 2):
2. Open a new screen session: $: screen -S ?whateveryouwantthisprocesstobe (The -S stands for start, include the " ")
3. Navigate to the path where the jarfile is, In our case it is located at /home/skywarsmain/, so we will navigate to that path by running:
$: cd /home/skywarsmain/
4. Start the server using $: java -Xmx4608m -jar spigot.jar (The -Xmx is the max amount of memory that the process will use, in megabytes (Total mem used is 4.5 GB))
5. You have started the server instance. Good job. Return to the main shell, using: ctrl + a + d
6. If you need to connect to the instance, then you will need to change some things in the server.properties configuration file (Port).
7. Return to main directory by running $: cd /
STEP 9: Change the server port (NANO):
1. Open a SSH Shell (CHECK STEP 2
2. What is nano? GNU nano is a simple terminal-based text editor. Though not as powerful as Emacs or Vim, it is easy to learn and use. Nano is ideal for making small changes to existing configuration files or for writing short plain text files.
3. We will be using nano to make changes to the server port and IP. To do this we first need to navigate to where our file is: In our case, the server.properties file is located at /home/skywarsmain/, so we will navigate there using the cd command. You should know how to run this, if not, refer to Step 8; Part 3.
4. After you have navigated to the /skywarsmain/ directory, run: $: nano server.properties
5. You are now inside the GNU text editor. Navigate up or down using your arrow keys. Change server IP to be: 0.0.0.0 and change the port to be whatever port you opened in the firewall (Default MC port is 25565)
6. To save your changes, Press: ctrl + o, and then press enter. Your changes have been saved.
7. To exit the text editor and go back to the console, Press: ctrl + x
STEP 10: Apply the changes made (START+JOIN):
Open a SSH shell (CHECK STEP 2)
Return to the screen you detached from by running: $: screen -r
Stop the MC server (stop)
Start the server ($: java -Xmx4608m -jar spigot.jar)
Good job, Now we can connect to the server.
STEP 11: Connect to the server:
1. Go to the main VM instances panel:
2. Copy the external IP (Yours will be different)
3. Paste into your client, and add the port that you set in the config and opened in the firewall:
4. Connect: If you have completed all the steps properly, then you should be able to log on!
5. For console access, just reopen the detached screen (screen -r) and run console commands from there.
This guide is made by ZECHEESEDEV! If you would like to use this somewhere else, please provide credit!
Good job! You're all done! If you enjoyed this guide, be sure to like! If you have any issues, leave a comment and i'll try to reply as soon as I can! If you would like to contact me via discord, my discord is Harold#6478
hmmm apparently i screwed up on formatting...
ill see if i can fix
Users browsing this thread: 2 Guest(s)