Monday, July 1, 2013

Installing Minecraft 1.6 on Ubuntu

I had previously blogged about Installing Minecraft on Ubuntu. As of Minecraft version 1.6 these instructions no longer work because of a newly introduced launcher. The following is updates instructions for version of Minecraft 1.6 and above.

First we need to install Java. The website claims it needs Oracle Java, but the open source Java in the Ubuntu repos works just fine in my experience.
sudo apt-get install openjdk-7-jre
Now we need the launcher
sudo wget https://s3.amazonaws.com/Minecraft.Download/launcher/Minecraft.jar -O /usr/games/Minecraft.jar
sudo chown root:games /usr/games/Minecraft.jar
sudo chmod 755 /usr/games/Minecraft.jar
Change the vi part in the next section to gedit if you want a graphical text editor.
sudo vi /usr/games/minecraft
The file contents should be as follows.
#!/bin/bash
java -jar /usr/games/Minecraft.jar
And then set the proper permissions on the file
sudo chown root:games /usr/games/minecraft
sudo chmod 755 /usr/games/minecraft
Again, change vi with something else if that is easier for you.
sudo vi /usr/share/applications/minecraft.desktop
And put this in the file.
[Desktop Entry]
Name=Minecraft
Comment=Build your own world
Exec=minecraft
Icon=minecraft
Terminal=false
Type=Application
Categories=GNOME;Applications;Game
Keywords=minecraft;Game
StartupNotify=true
The last piece we need is an icon. There are many good Minecraft icons at http://www.rw-designer.com/icon-detail/5547 I like http://www.rw-designer.com/icon-image/5547-256x256x32.png as it gives us the highest resolution available. Replace the URL of the icon you prefer to use in the following command.
sudo wget http://www.rw-designer.com/icon-image/5547-256x256x32.png -O /usr/share/pixmaps/minecraft.png
Now you should be able to play Minecraft by simply typing minecraft in the command-line, in the Unity dash, the KDE prompt, or by browsing to the games menu in the applications menu in your desktop environment of choice. It is also available to all users of your desktop.

You also do not need to do anything to update. Minecraft updates itself each time you start it.

BONUS

I've got one more neat trick up my sleeve. If a CraftBuntu spin sounds good to you, here's how you can setup Ubuntu to just run Minecraft when you sign in. It assumes you have already done the above.
sudo cp /usr/share/applications/minecraft.desktop /usr/share/xsessions/
Now Minecraft is an available option when you select your desktop environment. This works best if you set Fullscreen in the Minecraft options.

You could do a number of things with this setup. You could setup a minimal Ubuntu installation that has no desktop environment, or other desktop-related software installed. You could also allow guests to play Minecraft without touching any of your stuff by them selecting the Ubuntu guest account and setting Minecraft for the login. I have even found that on my struggling laptop this setup allows Minecraft to run more smoothly as there is no other desktop cruft running in the background.


UPGRADING FROM 1.5

If you had already followed my instructions back in the days before 1.6, the following will get you updated to 1.6
sudo rm /usr/games/minecraft.jar
sudo wget 
https://s3.amazonaws.com/Minecraft.Download/launcher/Minecraft.jar -O /usr/games/Minecraft.jar
sudo chown root:games /usr/games/Minecraft.jar
sudo chmod 755 /usr/games/Minecraft.jar
Change the vi part in the next section to gedit if you want a graphical text editor.
sudo vi /usr/games/minecraft

The file contents should be as follows.

#!/bin/bash
java -jar /usr/games/Minecraft.jar