Normally, you would use a service to run as a specific user at a certain time during boot.
I think the ideal solution to "How to run a Minecraft server at login" is to create a new user, minecraft
, and make sure that your HTTP server (apache
or nginx
) has access to those files generated by overviewer
. When you run overviewer
, you want to do it as the minecraft
user.
The following assumes that /home/minecraft/minecraft-1.7/
is the directory that contains your minecraft server files, such as the world
directory, and that within that directory, you have minecraft_server.jar. Also, nginx
is used to act as an HTTP server.
You can create the this user with sudo useradd minecraft -m
. By not setting a password, you'll only be able to become this user with sudo su - minecraft
.
The minecraft
user would have the following cron entry (crontab -e
as minecraft
):
0 * * * * /usr/bin/overviewer.py --rendermodes=smooth-lighting,cave /home/minecraft/minecraft-1.7/world/ /home/minecraft/minecraft-1.7/www-overviewer/
Ideally, you'll have the Minecraft server run using upstart (/etc/systemd/system/minecraft-server.service
):
[Unit]
Description=Minecraft Server
[Service]
WorkingDirectory=/home/minecraft/minecraft-1.7/
User=minecraft
Group=minecraft
Restart=on-failure
RestartSec=20 5
ExecStart=/usr/bin/java -Xms1536M -Xmx1536M -jar minecraft_server.jar nogui
[Install]
WantedBy=multi-user.target
Enable it to start at boot with sudo systemctl enable minecraft-server
, and tell it to start now with sudo systemctl start minecraft-server
.
...while you configure NGINX with:
server {
listen 8888;
client_max_body_size 50M;
server_name _ minecraft.DOMAIN.tld
charset UTF-8;
expires max;
gzip on;
gzip_buffers 16 8k;
gzip_comp_level 4;
gzip_http_version 1.0;
gzip_min_length 1280;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript text/x-js;
gzip_vary on;
gzip_static on;
add_header Cache-Control "public";
location / {
root /home/minecraft/minecraft-1.7/www-overviewer;
}
}
There is no reason to run minecraft
, overviewer
, etc as root, and should be avoided.
Best Answer
I finally figured out the answer to the real question I was asking. "would Ubuntu be taken over by RetroPie, or would it run in a window."
I watched this install instruction video which showed the install, how to run it, and how to escape it and get back to the desktop.
I know the instructions for the install are the same as what was posted already, here and on github, but none of them explained if the GUI would take over my Ubuntu desktop environment or not. I now know that it will run as a normal full-screen app, which you can easily shut down when done playing with it.