Installing CentOS 6.4 Using USB

One would think that installing CentOS using USB is fairly easy, however Linux often requires additional steps that go beyond ‘it just works’. I purchased a Dell PowerEdge T110 II server and decided on to run KVM on it. CentOS is built from RedHat sources so if you don’t want to pay RedHat, then CentOS is a good option.

1. Download CentOS from http://www.centos.org/modules/tinycontent/index.php?id=30. I used the 6.4 server image which is two DVD images, one is 4.1GB and the other is  1.4GB. For me Stanford mirror was the closest http://mirror.stanford.edu/yum/pub/centos/6.4/isos/x86_64/CentOS-6.4-x86_64-bin-DVD1.iso. I used wget and also tried curl. After downloading for a few minutes, both would just stop downloading.  I used the verbose option to both to see if I could see some error messages, however that did not help.  Wget supports –continue option which will continue to download from where it left off if you kill wget or if the previous wget hangs, I found this option useful to download the file.

2. Next step was to create a USB bootable stick, I downloaded http://unetbootin.sourceforge.net/ which allows you to create bootable USB disks. I pointed Unetbootin to the ISO using my 8GB memory stick, and within 15 minutes I had a bootable USB drive.

3. I booted my Dell server and from the boot menu picked USB, which started CentOS. When CentOS came to the disk partition page it asked me for the CentOS ISO. Of course I did not have the ISO on the same USB stick, so I removed the stick and tried to copy the ISO on it, which did not work, since the file is 4.1GB and the USB was formatted with vfat which does not support files larger than 4GB. I then reformmated the USB with ext2, ran Unetbootin, copied the ISO, and tried to boot, but my Dell server would not boot from the ext2 partition of the USB. So I went back and got a 16GB USB stick, and made 2 partitions, one vfat size 4GB and another ext2 size 8GB. On the 8GB I copied the ISO image, and the 4GB vfat I made a bootable partition using Unetbootin. Using this I was able to boot the Dell and start the install. After that you should use Ctrl-Alt-F2 to switch to a shell prompt, and then try the following: ‘umount /mnt/isodir’, followed by ‘mount -t ext2 /dev/sda2 /mnt/isodir’.  Partition 2 of my USB had the ISO and it was /dev/sda2.  Then I switched back to the installer using Ctrl-Alt-F6 and choose Retry which caused the installed to continue.

4. CentOS default partition is not ideal, since it does not separate /var or /tmp. I created my own partition with /tmp, /var, swap, /boot, /boot/efi, /, /vm1, /vm2, /home. I used LVM for all of them except for /boot and /boot/efi. Since I had set my server to be in UEFI boot mode instead of BIOS, CentOS created /boot/efi partition as well.

5. A minimal server installation is what I picked when asked during the install, since I wanted to complete the installation quickly. I had used a USB 2.0 stick, my previous USB stick was 1.0 which was slow. It would have been nice to see USB 3.0 support on the Dell.

6. Once the installation completed, I was able to login with the account I had created earlier during the install.

A few links that you may find useful are:

  1. http://wiki.centos.org/HowTos/InstallFromUSBkey
  2. https://www.centos.org/modules/newbb/viewtopic.php?topic_id=32286
  3. http://www.centos.org/docs/5/html/Installation_Guide-en-US/s1-diskpartitioning-x86.html

How was your experience with installing CentOS using USB? Do share your comments below.

Installing an Ubuntu Minecraft Server

Minecraft has a lot of servers which you can connect to and play online with others. I wanted to setup a private server for my son so that I have some control over who he gets to play.  I hope you find my experience on setting up a server useful.

  1. All the steps below assume Ubuntu 12.04 LTS, you can probably use similar versions of Ubuntu as well.
  2. The authoritative server  twiki is here http://www.minecraftwiki.net/wiki/Server, so do read that, however you will find the below instructions easier than the twiki since I have condensed them down for Ubuntu based server. If you need to install Minecraft server for different platforms use the steps here http://www.minecraftwiki.net/wiki/Setting_up_a_server.
  3. To start off look at the bare minimum server requirements here http://www.minecraftwiki.net/wiki/Server/Requirements. My server is running as a VM guest with 2GB RAM, and 1 VCPU. The VCPU is on a host/hypervisor that has a single Quad Core Xeon processor which is multi-threaded. I also allocated 10GB disk space for my VM. You can run the server on your laptop if it meets the minimum requirements, as long as you open up the Minecraft port through the firewall. The only problem with running it on your laptop is that the server will be down when your laptop is turned off so you may not get many friends who want to join your server. My server is hosted online with a co-location provider. I would suggest looking at Amazon EC2 if you want to get your own server here http://aws.amazon.com/ec2/.
  4. You need this package in order to run apt-add-repository later: sudo apt-get install software-properties-common -y
  5. sudo apt-get install python-software-properties -y
  6. sudo apt-add-repository ppa:webupd8team/java
  7. sudo apt-get update
  8. sudo apt-get install oracle-java7-installer -y
  9. java -version
  10. I am running my server as user ‘minecraft’ which has no login shell for security. sudo adduser –system –no-create-home –home /home/minecraft-server minecraft
  11. sudo mkdir /home/minecraft-server
  12. sudo chown -R minecraft minecraft-server/
  13. Next is to add user ‘minecraft’ to ‘games’ group, so edit the group file by running  ‘sudo vi /etc/group’ and in the games line add user ‘minecraft’ or you can use the usermod command as well
  14. sudo chgrp -R games minecraft-server/
  15. I want all files in the minecraft directory to belong to the games group so run: sudo chmod g+s minecraft-server/
  16. It is a good idea to have start and stop scripts that start/stop minecraft when the server reboots, so in the next step I created a file which allowed me to specify that. In terms of the Xms sizes, adjust the size based on how much RAM you have, I decided to give the JVM 1.5GB RAM.
  17. $cat /etc/init/minecraft-server.conf
     chdir /home/minecraft-server
     exec su -s /bin/sh -c 'exec "$0" "$@"' minecraft -- \
     /usr/bin/java -Xms1536M -Xmx1536M -jar \
     minecraft_server.jar nogui > /dev/null</pre>
     start on runlevel [2345]
     stop on runlevel [^2345]
     
  18. Now download the server itself : cd /home/minecraft-server; sudo wget http://s3.amazonaws.com/Minecraft.Download/versions/13w18c/
  19. sudo mv  minecraft_server.13w18c.jar minecraft-server.jar
  20. sudo vi server.properties and look here to see which entries to modify
  21. Test starting the server usingjava -Xms1G -Xmx1G -jar minecraft_server.jar nogui
  22. Once the server is up and running view the server commands which can be run by joining the server here http://www.minecraftwiki.net/wiki/Server_commands
  23. sudo stop minecraft-server && sudo start minecraft-server && ps axu | grep -i mine 
  24. That’s it, you are not ready to use this server. Start a minecraft client, and type in this server name in multiplayer mode. The server name is the hostname of the server.

How has your experience been with setting up Minecraft? Share your comments below.

Installing a Minecraft Fedora 17 Linux client

I am writing my experience on setting up an Fedora minecraft client in the hopes that the reader finds it useful.  Minecraft is a hugely popular game which can be downloaded from https://minecraft.net/download. As of the writing of this blog there are Windows, Mac and Linux versions of the game available. To setup the client follow the below instructions:

  1. Visit https://minecraft.net/download and create a free login account by clicking on Register at the top right
  2. Once you create an account, and login to the site, your login by the way is your email address, you can purchase the game by clicking on Store, then Buy Minecraft for this account. The price is $26.95 as of the writing of this blog
  3. Now you are ready to download the game. I have a Fedora laptop, so I download the Linux version here https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft.jar.
  4. You will also need Java. On my Fedora box I already had Java installed, if you need Java installed try the following steps which are pretty good http://www.if-not-true-then-false.com/2010/install-sun-oracle-java-jdk-jre-6-on-fedora-centos-red-hat-rhel/. Fedora ships with OpenJDK which has issues with Minecraft and that is why we need Sun/Oracle Java installed.
  5. Now that you have a Minecraft.net acount, Java installed on your desktop and also downloaded Minecraft Jar file, you are ready to start Minecraft, which you can do by running the following command ‘java -Xmx1024M -Xms512M -cp minecraft.jar net.minecraft.LauncherFrame,’ The command assumes you are in the same directory as minecraft.jar which you had downloaded above.
  6. Once you run the above command Minecraft should start and ask for a login/password, enter the information from the purchase time, and you are ready to play! For further help on how to play watch howto videos here http://minecraft.net/game/howtoplay.

How has your experience been with installing a Minecraft client on Linux or other platform? Do share your comments!

%d bloggers like this: