Monday 1 December 2014

The Must Have Script For A Moxa V2616A Industrial Computer

For anyone who gets their hands on a MOXA v2616A industrial Computer,  this script will automatically update the system with the MOXA repos as well an ip subnet etc.
Change the IP and Default Gateway to suit your needs.

Copy and Paste the below script
Save the File to .sh 
Give the file execution permissions
Execute the script as root or with sudo


#!/bin/bash
ifconfig eth0 192.168.1.1
route add default gw 192.168.1.254
echo "nameserver 192.168.1.254" > /etc/resolv.conf
cd /opt
apt-get install -y unzip
wget http://www.moxa.com/drivers/UC/V2616A/V2616A-LX_V1.0_Utility_MOXA_SYS_DEB_KEY.zip
unzip V2616A-LX_V1.0_Utility_MOXA_SYS_DEB_KEY.zip
rm -rf V2615A-LX_V1.0_Utility_MOXA_SYS_DEB_KEY.zip
cd V2616A-LX_V1.0_Utility_MOXA_SYS_DEB_KEY
mv NEW-MOXA-SYS-DEBIAN-KEY NEW-MOXA-SYS-DEBIAN-KEY.gpg
apt-key add NEW-MOXA-SYS-DEBIAN-KEY.gpg
echo "#Moxa Repos" >> /etc/apt/sources.list
echo "deb http://debian.moxa.com/debian wheezy main" >> /etc/apt/sources.list
echo "#Backported packages for Debian 7 'Wheezy'" >> /etc/apt/sources.list
echo "deb http://http.debian.net/debian/ wheezy-backports main contrib" >> /etc/apt/sources.list
apt-get update
apt-get install -y linux-headers-$(uname -r|sed 's,[^-]*-[^-]*-,,')
echo "#Virtual Box Repos"
echo "deb http://download.virtualbox.org/virtualbox/debian wheezy contrib" >> /etc/apt/sources.list
cd /opt
wget "http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc" >> /etc/apt/sources.list
apt-key add oracle_vbox.asc
apt-get update
apt-get -t wheezy-backports install virtualbox-4.3 curl git zsh -y
apt-get upgrade -y
curl -L http://install.ohmyz.sh | sh
chsh -s /bin/zsh