How to Install CraftBukkit Minecraft Server on Raspberry Pi

First we need to Install Java.

sudo apt-get install openjdk-7-jre

Next lets create a CraftBukkit directory to store all the files.

mkdir ~/mc-bukkit
cd ~/mc-bukkit

And lets download CraftBukkit.

wget "http://dl.bukkit.org/downloads/craftbukkit/get/02389_1.6.4-R2.0/craftbukkit.jar" -O "craftbukkit.jar"

Now lets create a script that we can use to start the Server.

sudo vi /etc/init.d/mcstart.sh

Copy and paste the following text.

#! /bin/sh
# /etc/init.d/mcserver

### BEGIN INIT INFO
# Minecraft CraftBukkit Start script
### END INIT INFO

case "$1" in
  start)
    echo "Starting mcserver"
    MCDIR=$("/home/pi/craftbukkit")
    cd "$MCDIR"
    java -Xmx512M -jar craftbukkit.jar -o true &
;;
  stop)
    echo "Stopping mcserver"
    kill `pgrep mcserver`
    ;;
  *)
    echo "Usage: /etc/init.d/mcserver {start|stop}"
    exit 1
    ;;
esac
exit 0

Now lets make the file executable.

chmod +x mcstart.sh

And launch

sudo /etc/init.d/mcstart.sh

The first lunch will take a long time so be patient.

If you want to start CraftBukkit when your Pi boots up then run the following command.

sudo /etc/init.d/mcstart.sh start

Turn Your Raspberry Pi into a Wireless Hotspot

Goal:

The goal of this guide is to turn a Raspberry Pi into a wireless home/mobile router.

Equipment:

  1. Raspberry Pi with raspbian
  2. Wireless USB device.  The guide uses a Edimax Nano USB Wifi (EW-7811Un) adapter
  3. Ethernet cat5 cable to connect to the Internet

Lets get started.

Install the following packages.

sudo apt-get install hostapd dnsmasq iptables

Open up “/etc/network/interfaces” and add the following lines.  If there is a line for wlan0 you can comment it out with a “#”.

iface wlan0 inet static
address 192.168.42.17
netmask 255.255.255.0

Configure Hostapd

Edit the following file “/etc/default/hostapd” so it looks like this.

DAEMON_CONF="/etc/hostapd/hostapd.conf"

Now edit the hostapd config file “/etc/hostapd/hostapd.conf” and configure the wireless access point.

interface=wlan0
driver=rtl871xdrv
bridge=br0
ssid=MC
channel=1
wmm_enabled=0
wpa=1
wpa_passphrase=min3cr@ft
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
auth_algs=1
macaddr_acl=0 

 Configure the DHCP Server

For the DHCP server we just need to add the following lines to “/etc/dnsmasq.conf”

interface=wlan0
dhcp-range=192.168.42.20,192.168.42.152,255.255.255.0,12h
dhcp-option=3,192.168.42.17

Configure Iptables

Now we need to set it up so the pi can forward traffic from wlan0 to eth0.

Edit “/etc/sysctl.conf” and uncomment the following line

net.ipv4.ip_forward=1

then execute

sysctl -p

Next create an iptables “config” file.

sudo touch /etc/network/if-up.d/router.sh
sudo chmod +x /etc/network/if-up.d/router.sh
sudo su -c "echo '/etc/network/if-up.d/router.sh' >> /etc/rc.local"

Add the following line to the file.

sudo iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
sudo iptables --append FORWARD --in-interface wlan0 -j ACCEPT

If you are using the same wireless adapter that is used in this guide then you will need to execute the following commands to replace the hostapd binary.  You can find more info here.

wget http://www.daveconroy.com/wp3/wp-content/uploads/2013/07/hostapd.zip
unzip hostapd.zip
sudo mv /usr/sbin/hostapd /usr/sbin/hostapd.bak
sudo mv hostapd /usr/sbin/hostapd.edimax
sudo ln -sf /usr/sbin/hostapd.edimax /usr/sbin/hostapd
sudo chown root.root /usr/sbin/hostapd
sudo chmod 755 /usr/sbin/hostapd

That should do it. Plug in the Ethernet cable and reboot  your pi and you should be good to go.

How to Create a NFS Share Server on Slackware

  1. Create the NFS Share directory. You can change the name “/nfs” to wherever and whatever you want. Just be sure to remember the path and name
    mkdir /nfs
  2. Add the NFS Share to the /etc/exports file. Change the ip address to your NFS Servers ip address.
    echo "/nfs 192.168.200.250/24(rw,sync,no_subtree_check)" >> /etc/exports
  3. Next we chmod /etc/rc.d/rc.nfsd and rc.rpc so that they can be executed to start the service
    chmod 755 /etc/rc.d/rc.nfsd
    chmod 755 /etc/rc.d/rc.rpc
  4. Start rpc and nfsd
    /etc/rc.d/rc.nfsd start
    /etc/rc.d/rc.rpc start
    
  5. Export the Share
    exports -a
  6. Connect a Client and have fun

Create an Image of a SD Card

The following command works on both OS X and Linux.  It creates an image from the SD card called raspi.img which you can later use to clone to another SD Card or just keep as a backup.  It is exceptionally useful for backing up a Raspberry Pi.

Replace “mmcblk0” with your SD cards name.  Take a look at this post if you need help finding the name.

sudo dd if=/dev/mmcblk0 of=~/raspi.img

How to Change, Add, and Delete Users in Linux

Changing a users name:

sudo usermod -l new-username old-username

To change the users directory name do the following.

 sudo usermod -d /home/new-username

You might need to log in as root or another user to successfully execute the commands.

Adding a user:

sudo useradd -m newuser

The -m option create the new users home directory

Then to activate the user we need to setup a password.

sudo passwd newuser

Enter and reenter the password and your done.

If you need to add the user to a certain group(s) (sudo?) you can do that with usermod

sudo usermod -G sudo,othergroups newuser

 

Deleting a user:

sudo userdel -r username

The “-r” option deletes the users mail and home directory.  If you wanted to keep them then just discard that option.

Installing Raspbian on Raspberry Pi from the Linux Command Line

First download the Rasbian zip from here.

Unzip the zipped file.

unzip 2014-01-07-wheezy-raspbian.img

You need to find your sdcard name.  If you don’t now how to, take a look at this post.

Next format your card as Fat32.

Now write the image to the sdcard with the following command.  Replace the mmcblk0 part of “of=/dev/mmcblk0” with your drive name.

sudo dd if=~/2014-01-07-wheezy-raspbian.img of=/dev/mmcblk0 bs=4M

It will not display any information until it is finished, so be patience.

Once it is complete, eject it and plug it into your Raspberry Pi and boot it up.

Finding a Drives Name in Linux From the Command Line

There are a few different ways to find out a drives(sdcard, usb drive, external hard drive) name.

dmesg command

One way to do it is to look at dmesg. Insert your drive and then run the command. It displays a lot of info, what we are interested in is the end which should say something about your drive.

dmesg
[ 4443.109976] mmc0: new high speed SDHC card at address aaaa
[ 4443.111857] mmcblk0: mmc0:aaaa SU04G 3.69 GiB 
[ 4443.120836]  mmcblk0: p1 p2
[ 4453.045338] EXT4-fs (mmcblk0p2): recovery complete
[ 4453.086165] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[ 4453.086184] SELinux: initialized (dev mmcblk0p2, type ext4), uses xattr

This tells us that the device is mmcblk0. The “p2” at the end is the partition number.

df Command

Another way to do it is to run the df command.
Run the below command without your drive plugged in.

df -h

it’ll return something like this

Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/fedora-root   50G   12G   36G  24% /
devtmpfs                 1.9G     0  1.9G   0% /dev
tmpfs                    1.9G  600K  1.9G   1% /dev/shm
tmpfs                    1.9G  1.0M  1.9G   1% /run
tmpfs                    1.9G     0  1.9G   0% /sys/fs/cgroup
tmpfs                    1.9G   28K  1.9G   1% /tmp
/dev/sdb1                477M  115M  333M  26% /boot
/dev/mapper/fedora-home   76G   45G   23G  87% /home

The above command returns all the partitions that are mounted on your computer.
Now mount your drive and run the command again, it should show your drive at the bottom.

[me@fedora ~]$ df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/fedora-root   50G   12G   36G  24% /
devtmpfs                 1.9G     0  1.9G   0% /dev
tmpfs                    1.9G  600K  1.9G   1% /dev/shm
tmpfs                    1.9G  1.1M  1.9G   1% /run
tmpfs                    1.9G     0  1.9G   0% /sys/fs/cgroup
tmpfs                    1.9G   28K  1.9G   1% /tmp
/dev/sdb1                477M  115M  333M  26% /boot
/dev/mapper/fedora-home   76G   45G   23G  87% /home
/dev/mmcblk0p2           3.6G  2.3G  1.1G  69% /run/media/me/fc522c75-9sws

You can see that the bottom one “/dev/mmcblk0p2 ” is the partition of the drive you just plugged in.

Using fdisk

You can also use fdisk.

sudo fdisk -l

It will return something similar to the following.

Disk /dev/mapper/fedora-home: 78.8 GiB, 191931351040 bytes, 374865920 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/mmcblk0: 3.7 GiB, 3965190144 bytes, 7744512 sectors

The bottom section is the drive “mmcblk0”.

Using lsblk

lsblk is another cool tool to list drives and partions. When run with the -p option it shows the path to the drive and partition.

Example output of what you may get with “lsblk -p”

admin@localhost:~$ lsblk -p
NAME                              MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
/dev/nvme1n1                      259:0    0   450G  0 disk  
├─/dev/nvme1n1p1                  259:1    0   499M  0 part  
├─/dev/nvme1n1p2                  259:2    0   100M  0 part  
├─/dev/nvme1n1p3                  259:3    0    16M  0 part  
└─/dev/nvme1n1p4                  259:4    0 449.3G  0 part  
/dev/nvme0n1                      259:5    0   477G  0 disk  
 ├─/dev/nvme0n1p1                  259:6    0   512M  0 part  /boot/efi
 ├─/dev/nvme0n1p2                  259:7    0   732M  0 part  /boot
 └─/dev/nvme0n1p3                  259:8    0   400G  0 part  
   └─/dev/mapper/vg-root           253:1    0   391G  0 lvm   /
   └─/dev/mapper/vg-swap_1         253:2    0   7.9G  0 lvm   [SWAP]
admin@localhost:~$ 

How To Make a Live Bootable Fedora Thumb Drive in Linux

Insert your thumb drive into the computer.

We need to find out where the thumb drive is mounted.  We can do this with the “df” command as shown below or you can find it in dmesg.

So if we run the df command

df -h

It returns something like this

[me@fedora ~]$ df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/fedora-root   50G   11G   37G  23% /
devtmpfs                 1.9G     0  1.9G   0% /dev
tmpfs                    1.9G  1.2M  1.9G   1% /dev/shm
tmpfs                    1.9G  1.1M  1.9G   1% /run
tmpfs                    1.9G     0  1.9G   0% /sys/fs/cgroup
tmpfs                    1.9G   52K  1.9G   1% /tmp
/dev/sdb1                477M  115M  333M  26% /boot
/dev/mapper/fedora-home  176G  125G   42G  75% /home
/dev/sdc1                3.8G  3.2G  592M  85% /run/media/me/136A-7360
[me@fedora ~]$

Note that the bottom one is the thumb drive /dev/sdc1 yours may differ.

Now that we know where the drive is mounted we can write the image to the thumb drive.

Change the path in “if=/” to the path to your Fedora iso and change “of=/” to you thumb drive path

su -c "dd if=/home/me/Downloads/Fedora-Live-x86_64-20-1.iso of=/dev/sdc bs=8M"

It will take a couple of minutes to complete and it will not give you any information until it is finished.

Congratulations, you now have a live working Fedora thumb drive.

How to Install Flash on Linux

Installing flash on Ubuntu is pretty straight forward.  Type the following command into a terminal and press enter and away you go.

sudo apt-get install flashplugin-installer

On Fedora need to do the following

(64-bit)

sudo yum install http://linuxdownload.adobe.com/adobe-release/adobe-release-x86_64-1.0-1.noarch.rpm -y

(32-bit)

sudo yum install http://linuxdownload.adobe.com/adobe-release/adobe-release-i386-1.0-1.noarch.rpm -y

And install the Adobe Flash web browser plugin.  The first command imports the GPG key for the Adobe Flash plugin repository and the second command installs the plugin itself.

sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux 
sudo yum install flash-plugin -y

Create a Bootable OS X Thumb Drive on Linux

NOTE:  This is a post has not been completely tested.  So use at your own risk.  This text will be removed once the post is completely tested.

 

What you need

  1. InstallESD.dmg
  2. 7zip installed on your computer
  3. Thumb Drive with 8gb of space on it
  4. A few other things installed

Getting Ready

So first we need to make sure we have a few things installed.

yum install hfsplusutils gparted p7zip dmg2img

on Debian based systems use

sudo apt-get install hfsplus hfsprogs hfsutils gparted p7zip-full

Now that we have all the tools we need we can move on.

 

Navigate to were your InstallESD.dmg file is.  Then run the following command.

7z x InstallESD.dmg

After it is finished cd into the InstallMacOSX.pkg

cd InstallMacOSX

now run

dmg2img InstallESD.dmg

Now you have a new file called InstallESD.img.

Open up Gparted (or your favorite disk tool) and find your thumb drive.  Format the drive with a GUID Partition Table and make sure it is HFS+. When it is finished formating, Find the thumb drive and unmount it, and then click restore.  It is under the “More actions” button on the top right.  Find your InstallESD.img file and click Restore.
You are now finished.  Have Fun!