Windows 8.1/Server 2012 Set Network Location

Since I have started using Windows more I have run into this problem a few times. Sometimes it can be a driver issue but that has never been the case for me. It is usually I didn’t pay attention during the install and selected Public by accident or Windows is acting weird and switched an existing network to Public. This will fix the problem if nothing else works and you think your system is sane.

Start up Powershell
Just search for it if you don’t know where to find it under the start menu.

Check the current adapter settings
run > Get-NetConnectionProfile

Name : This will vary depending on how the network is configured
InterfaceAlias : Ethernet
InterfaceIndex : 3
NetworkCategory : Public/Private/DomainAuthenticated depends on current Category
IPv4Connectivity : Internet
IPv6Connectivity : LocalNetwork

You need to remember the InterfaceIndex for the network you want to modify.

Change the current NetworkCategory
run > Set-NetConnectionProfile -InterfaceIndex 3 -NetworkCategory Private

This command will change the NetworkCategory to Private or any category you want.

Building lsi mpt fusion drivers in centos 5


In trying to test a set of SAS cables recently I had to build the lsi mpt fusion driver in Centos 5.9.  I really don’t recommend you do this on a production machine or a machine you care much about.  I was seeing errors while trying to uses disks in a JBOD disk array. This worked for me in CentOS 5.9. The documentation that lsi gives for doing this in the readme with the drivers is for old kernels. My instructions work for a 2.6 kernel.

kernel-devel usual gcc glib and make packages I might be missing some packages here but again I expect you to know how to setup the kernel source so that this works. If the commands start failing most likely you missed a package.

Preparing kernel source
Download the lsi mpt linux driver bundle. It should contain a directory with the kernel source.
cd /usr/src/kernels
Now cd into the directory for your current kernel uname -r
Something like 2.6.18-348.1.1.el5-x86_64
cd 2.6.18-348.1.1.el5-x86_64/drivers/message
Backup the current driver source.
tar -cvf fusion_orig.tar fusion
rm -rf fusion
mkdir fusion
pwd to get the current working directory
change into the directory where you uncompressed the lsi driver.
cd message/fusion
find . -print |cpio -pdvm directory from pwd above
find . -print |cpio -pdvm /usr/src/kernels/2.6.18-348.1.1.el5-x86_64/drivers/message/fusion
Your source should be setup now.

Building module
In the kernel source directory /usr/src/kernels/2.6.18-348.1.1.el5-x86_64
make oldconfig
make prepare
make modules_pepare
make M=drivers/message/fusion
cd drivers/message/fusion
cp *.ko /lib/modules/`uname-r`/drivers/message/fusion
depmod -a

Finally reboot the machine. After reboot run modprobe -l |grep mpt to get the path to the mpt driver. Then run modinfo /lib/modules/2.6.18-348.1.1.el5/kernel/drivers/message/fusion/mptbase.ko (change this to output from modprobe). This should show the version of the driver you downloaded.

Hex code wallet for iphone4/4s

I bought the Hex Code Wallet in October of 2011 and used it for about 10 months. I paid $49.95 plus tax and shipping for the wallet from Amazon. I bought the case because I wanted to not have to carry my wallet and phone all of the time. I pretty much keep a debit card, credit card, and drivers license in the case which covers almost everything for me.

The Good
The case does a great job protecting the phone. It looks nice and a lot of people have commented on it while I used it.

The Bad
Probably the worst part of the case is the lack of a hole in the back for the camera. I always had to take the phone out of its case to take a picture. I ended up just not taking pictures most of the time. I made the mistake of putting more than one card in the slots and ended up stretching the slots out. After that my cards were falling out all the time. By the time I stopped using the case the corners where it folds were starting to crack and the leather in general wasn’t holding up well. I think the price is a little high for for the quality of the product they are selling.

Why I stopped using it
I stopped using the case when I switch to my Galaxy S3. I could have kept using the case but it was showing wear so I just got rid of it. I bought a similar case for the S3 and will be posting a review sometime soon.


Hex wallet back

Hex wallet back

Hex wallet open

Hex wallet open

Minecraft photos

Home » Minecraft photos


Pictures from my server.


Setting up denyhosts in centos 6

Denyhosts is a script that checks logs for brute force login attacks. If an IP goes over a certain number of failures denyhosts will add the IP to /etc/hosts.deny blocking that host from accessing the server.

yum install denyhosts

If you have a static IP or one that doesn’t change very often you should add it to /etc/hosts.allow. This prevents denyhosts from blocking that IP if you fail to login. To find out what your external IP address is go to a site like whatismyip. Your IP will be displayed on the page. Add a line like: sshd: to /etc/hosts.allow. Replace with the IP you received.

The denyhosts config file is located in /etc/denyhosts/denyhosts.cfg. The config file explains all the settings. You can set it up to send out email reports. Also thresholds for failed logins can be changed. I usually just leave it alone.

Setting up MySQL in CentOS

This setup is fairly basic and is for CentOS 6.


mysql, mysql-server

First time setup

Start the database service mysqld start

Run /usr/bin/mysql_secure_installation

This script will walk you through the basic securing of mysql.  It will also set the root password for mysql.  The defaults should be fine here.


This part is for users who want to run mysql on a separate disk from the OS.  You will need to have created a filesystem and mounted it some place else on the system to do this.  I mount my mysql partition at /mysql1 for example.  I’m not including partitioning or filesystem creation here because you really should know that if you are reading and doing this.   Also I realize my.cnf can be changed to point to this new location but it’s easier to just use a symlink from the default location.

service mysqld stop to stop the database.

Now copy all the files from the default mysql location to the new mount point.

find /usr/lib/mysql -print |cpio -pdvm /mysql1/mysql

Move old files to a different location in case we break something.

cd /var/lib

mv mysql mysql.os

Now create a symlink to the new location.

cd /var/lib

ln -s /mysql1/mysql

service mysqld start


I’m not going to put specifics here.  Configuring mysql depends a lot on your hardware and how large your database is.  I set mine up to use innodb.  For a small database I setup a single data file set to autoextend.  For a larger database I use the file per table setting.  Most other settings depend on how much ram you want to give mysql.  On my server I have it setup to use about 1GB of ram.  Typically mysql will use less than what you configure it for if it doesn’t need it.


This is an example of my mysql config file.  My database is about 1GB in size.  The server has a lot of ram so I give MySQL a decent amount to use.


key_buffer = 16M
max_allowed_packet = 1M
table_cache = 64
sort_buffer_size = 512K
read_buffer_size = 256K
read_rnd_buffer_size = 512K

innodb_data_file_path = ibdata1:4096M:autoextend
innodb_buffer_pool_size = 512M
innodb_additional_mem_pool_size = 2M
innodb_log_file_size = 128M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50



Before doing this backup your databases using mysqldump.

service mysqld stop

yum update I usually update the entire system at the same time.

service mysqld start

/usr/bin/mysql_upgrade  This script updates all of the mysql internal tables.  It is not always needed but it is good to run after an update.

Setting up webalizer in centos 6

I am building this from source.  I realize the package comes with cent but I want to keep it up to date.  If you build your own from source make sure yum doesn’t stomp on it.

Packages needed

gcc, gcc-c++, gd-devel


webalizer source from

GeoIP source from


tar zxvf GeoIP.tar.gz

cd into the directory created


make && make install

tar zxvf webalizer.tar.gz file

cd into directory created

./configure –prefix=/usr/local/webalizer –sysconfdir=/usr/local/etc/webalizer –enable-geoip

make && make install

Setup ld properly

This step prevents this error “error while loading shared libraries: cannot open shared object file: No such file or directory” when running webalizer.

cd /etc/

vi geoip.conf  (This can be named anything.conf)

add “/usr/local/lib” to the file and save it.

Run ldconfig

Update GeoIP database

Download from

gunzip GeoIP.dat.gz

mv GeoIP.dat /usr/local/share/GeoIP/GeoIP.dat

Configure webalizer

cd /usr/local/etc/webalizer

cp webalizer.conf.sample

vi and change the following lines

LogFile /var/log/httpd/ point to your access_log file

OutputDir  /var/www/ point to where you want to serve your stats from.  Usually some place under your web root.  You might want to protect it with an htaccess file.


GeoIP yes

GeoIPDatabase /usr/local/share/GeoIP/GeoIP.dat

Run webalizer

/usr/local/webalizer/bin/webalizer -c /usr/local/etc/webalizer/

If it runs fine add to run in your crontab.

My minecraft server

This is the website for server and the group of people I play games with.

The server wiki.

Minecraft server info:
port: 25565 the standard minecraft server port

Server info:
Current player limit 60

What we have:
– PVP world with arena
– Updated world for current minecraft version that all players can use
– Dungeon world that players can add to and play in.
– mcMMO
– MobArena
– Economy
– TreasureHunt
– Lottery
– Anti Xray
– Anti Cheat
– Portals in the spawn for towns and places in the world
– No PVP in main world
– No creeper or tnt explosions/damage
– No whitelist

Coming Soon
– Dungeons

Bukkit control script

This post is a work in progress I’m sure I’m forgetting things.

This is a heavily modified version of this startup script. If you don’t know what you are doing please find someone who does. Some of the stuff I do here can break your server. This script is provided as is and will probably be updated ever once in a while to fix problems.  So check back for updates or send me your changes. Also remember if you have a very large map this can add several minutes to your servers boot time as the files are copied from disk to the ramdisk at boot.

Things I have modified

  1. Changed script to work with bukkit instead of vanilla Minecraft.
  2. Replaced cp and rm commands with simpler and faster rsync.
  3. Added MAX_RAM setting for startup
  4. Changed options for startup. I’m sure some options are debatable.
  5. Added sndmsg command so that simple messages can be sent to the server console.
  6. Removed update command. I just don’t want it for bukkit.
  7. Added 60 second sleep on shutdown to give users time to logout after server says it is going down.

Just a warning about using this script. It is not fully tested. You really should understand what is going on in the script before using it. This version has been sanitized a bit and is not fully tested.

You will need to install some version of linux or similar OS to run this script.  I personally use CentOS.  See here for how I setup CentOS for Minecraft.

This startup script assumes you are running Bukkit from a ramdisk. The ramdisk is simple to setup. Figure out where you want to mount the ramdisk. I use /minecraft1 for the mount point. mkdir /minecraft1 to create the mount point. Now edit /etc/fstab and add

tmpfs /minecraft1 tmpfs defaults,size=6144m 0 0

That line will create a 6GB ramdisk at boot. You should change the size option to match the amount of ram you want for the bukkit map files and plugins. I store everything in the ramdisk. It can be broken up if you don’t want to store all the plugin data on the ramdisk.  Remember you need enough ram in your system for MAX_RAM and the ramdisk.  In my case I need over 12GB of ram to run bukkit and basic system services.

Next you will need to add the code below to the startup script.  I place mine in /etc/init.d/minecraft.  Once the script is added run chkconfig –add minecraft to add the script to the normal startup of the server.  chkconfig –list will list all running services.  You should see something like this for minecraft:
minecraft 0:off 1:off 2:on 3:on 4:on 5:on 6:off
If all the run levels are off do chkconfig --levels 2345 minecraft on. You should be able to test your server startup now by running /etc/init.d/minecraft start.

# /etc/init.d/minecraft
# original version of script
# Heavily modified by drewmtb
# version 0.6 2012-02-17
# changes made drewmtb
# removed the world2 stuff mv and rm -r
# changed cp -R to rsync its faster
# added MAX_RAM variable
# innvocation has been modified. Your mileage may vary
# added sndmsg option for sending messages to server
# added 60 second sleep to mc_stop before stop is run to give users time to logout
# update removed we don't want to do that for bukkit

# Provides: minecraft
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Should-Start: $network
# Should-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Minecraft server
# Description: Starts the minecraft server

# jar file for startup
# username to startup as
# location of minecraft source files for ramdisk
# location of minecraft ramdisk
# number of CPUs to use for startup
# amount of ram to give bukkit
# These settings are up for debate
INVOCATION="java -native -server -Xmx$MAX_RAM -Xms$MAX_RAM -Xmn1024M -XX:NewRatio=3 -XX:+UseThreadPriorities -XX:+U
seConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+CMSIncrementalPacing -oss4M -ss4M -XX:+UseFastAccessorMethods
-Xnoclassgc -XX:+AggressiveOpts -jar $SERVICE nogui"
# path to backup files to
# used by sndmsg to post messages to the server

as_user() {
if [ "$ME" == "$USERNAME" ] ; then
bash -c "$1"
su - $USERNAME -c "$1"

mc_start() {
if ps ax | grep -v grep | grep -v -i SCREEN | grep $SERVICE > /dev/null
echo "Tried to start but $SERVICE was already running!"
echo "$SERVICE was not running... starting."
if [ ! -f "$MCPATH/$SERVICE" ]
echo "Ram drive empty... prepping."
as_user "rsync --archive --update --quiet $MCSTORE/ $MCPATH/"
as_user "cd $MCPATH && screen -dmS minecraft $INVOCATION"
sleep 7
if ps ax | grep -v grep | grep -v -i SCREEN | grep $SERVICE > /dev/null
echo "$SERVICE is now running."
echo "Could not start $SERVICE."

mc_saveoff() {
if ps ax | grep -v grep | grep -v -i SCREEN | grep $SERVICE > /dev/null
echo "$SERVICE is running... suspending saves"
as_user "screen -p 0 -S minecraft -X eval 'stuff \"say SERVER BACKUP STARTING. Server going readonl
as_user "screen -p 0 -S minecraft -X eval 'stuff \"save-off\"\015'"
as_user "screen -p 0 -S minecraft -X eval 'stuff \"save-all\"\015'"
sleep 10
echo "$SERVICE was not running. Not suspending saves."

mc_saveon() {
if ps ax | grep -v grep | grep -v -i SCREEN | grep $SERVICE > /dev/null
echo "$SERVICE is running... re-enabling saves"
as_user "screen -p 0 -S minecraft -X eval 'stuff \"save-on\"\015'"
as_user "screen -p 0 -S minecraft -X eval 'stuff \"say SERVER BACKUP ENDED. Server going read-write
echo "$SERVICE was not running. Not resuming saves."

mc_sndmsg() {
if ps ax | grep -v grep | grep -v -i SCREEN | grep $SERVICE > /dev/null
as_user "screen -p 0 -S minecraft -X eval 'stuff \"say $SRVMSG\"\015'"
echo "$SERVICE was not running. Not resuming saves."

mc_stop() {
if ps ax | grep -v grep | grep -v -i SCREEN | grep $SERVICE > /dev/null
echo "$SERVICE is running... stopping."
as_user "screen -p 0 -S minecraft -X eval 'stuff \"say SERVER SHUTTING DOWN IN 60 SECONDS. Saving m
as_user "screen -p 0 -S minecraft -X eval 'stuff \"save-all\"\015'"
sleep 60
as_user "screen -p 0 -S minecraft -X eval 'stuff \"stop\"\015'"
sleep 5
echo "$SERVICE was not running."
if ps ax | grep -v grep | grep -v -i SCREEN | grep $SERVICE > /dev/null
echo "$SERVICE could not be shut down... still running."
echo "$SERVICE is shut down."

mc_backup() {
echo "Backing up minecraft files"
if [ -f $BACKUPPATH/MCBKUP_`date "+%Y.%m.%d"`-0.tar.gz ]
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
if [ -f $BACKUPPATH/MCBKUP_`date "+%Y.%m.%d"`-$i.tar.gz ]
as_user "cd $MCSTORE && tar czf $BACKUPPATH/MCBKUP_`date "+%Y.%m.%d"`-$i.tar.gz ."
as_user "cd $MCSTORE && tar czf $BACKUPPATH/MCBKUP_`date "+%Y.%m.%d"`-0.tar.gz ."
echo "Backup complete"

mc_disksaverun() {

if ps ax | grep -v grep | grep -v -i SCREEN | grep $SERVICE > /dev/null
echo "Saving ramdrive to disk."
if [ ! -f $MCPATH/$SERVICE ]
echo "Error.. Minecraft not in ram"
as_user "screen -p 0 -S minecraft -X eval 'stuff \"save-off\"\015'"
as_user "screen -p 0 -S minecraft -X eval 'stuff \"save-all\"\015'"
as_user "rsync --archive --update --quiet $MCPATH/ $MCSTORE/"
as_user "screen -p 0 -S minecraft -X eval 'stuff \"save-on\"\015'"
echo "Service is not running"


mc_disksavehalt() {
echo "Saving ramdrive to disk."
if [ ! -f $MCPATH/$SERVICE ]
echo "Error.. Minecraft not in ram"
echo "Saving, screen session closed"
as_user "rsync --archive --update --quiet $MCPATH/* $MCSTORE/"


#Start-Stop here
case "$1" in
if ps ax | grep -v grep | grep -v -i SCREEN | grep $SERVICE > /dev/null
echo "$SERVICE is running."
echo "$SERVICE is not running."

echo "Usage: /etc/init.d/minecraft {start|stop|update|backup|status|restart|disksaverun}"
exit 1

exit 0

Setting up CentOS for Minecraft

Working on updating this post.
Get CentOS here.
Install CentOS, I usually do the basic server install and add packages from there. Once the install is done run yum update to make sure all packages are up to date.

RPMforge setup

Optional packages to add
If you want plugins to store info in a database.
mysql mysql-server mysqlclient
Security related

Add users

Add a user to run minecraft:
    useradd -c "Minecraft" -s/bin/bash -d /home/minecraft -m -g users     minecraft
Add a user for yourself:
    useradd -c "Your name" -s/bin/bash -d /home/username -m -g users username
Set the password for each user added. passwd username

Secure things
Some stuff I do here is actually making the server less secure. I run mine behind a firewall on a trusted network. If you aren’t behind a firewall or your network isn’t trusted do not disable selinux or iptables.
Changes to make:(some of these may already be in place)
Protocol 2
PermitRootLogin no
Banner /etc/banners/sshd
Optional change:
This change will make it so only the listed users can login using ssh.
AllowUsers username1 username2 username3 …
Add a message here telling people to go away.
Restart ssh /etc/init.d/sshd restart
Changes to make:
Disable iptables if you know you don’t need a firewall. If you need iptables make sure you know how to configure it. You will need to open a port for the server.
chkconfig –levels 2345 iptables off
chkconfig –levels 2345 ip6tables off

Install java
From what I have read online java 7 is recommended for the server. I believe Oracle recommends using openjdk on linux. So my choice can be debated. I haven’t had any problems yet. Make sure you keep up to date with the current release though.
Download java 7 here.
Download the JRE most people don’t need the JDK. Make sure you select the correct version for your system. You should be using 64bit. Select the rpm version.

rpm -ivh jre-7u3-linux-x64.rpm

To update java:
yum list |grep jre
should list something like this
jre.x86_64 1.7.0_03-fcs installed
yum remove jre.x86_64
Then run the rpm install command again for the new version.

Setup minecraft startup script and ramdisk
My script.

Controlling the server
startup server
/etc/init.d/minecraft start

stop server
You can set a delay for this so users have time to logout.
/etc/init.d/minecraft stop

restart server
/etc/init.d/minecraft restart

backup server
/etc/init.d/minecraft backup

send a message to the console
The message will appear to all users in game. Useful for messages you repeat throughout the day.
/etc/init.d/minecraft sndmsg ‘Your message here.’

Maintenance tasks
Configure server backups. I have two cronjobs setup to run backups.
The first runs every 5 minutes and syncs the ramdisk copy with the disk copy. The second runs 4 times a day and creates an archive from the disk backup. I also have a shell script to clean out backup copies. I will update this once I post that script.
20 */6 * * * /etc/init.d/minecraft backup >/dev/null 2>&1
*/5 * * * * /etc/init.d/minecraft disksaverun >/dev/null 2>&1

Optional stuff