Saturday, May 21, 2016

OS X Bootable USB

This post is mainly something to write down so there is a place that I can refer back to if I ever need to go back and refer to it later on down the road and not have to dig through a Google search. That may make me sound lazy, but hopefully it can help others as well.

There is a post where I created a multi-boot USB for OS X, but I also needed just a single USB for each version of OS X (Mavericks, Yosemite, and El Capitan). So I am going to break this post up into making a single bootable USB for each version. This assumes that the installer application is located in /Applications on your hard drive. I do like to move it outside of that location so if it is needed later on than it doesn't need to be re-downloaded.

Mavericks:

sudo /Applications/Install\ OS\ X\ Mavericks.app/Contents/Resources/createinstallmedia \
--volume /Volumes/Untitled \
--applicationpath /Applications/Install\ OS\ X\ Mavericks.app \
--nointeraction

Yosemite:

sudo /Applications/Install\ OS\ X\ Yosemite.app/Contents/Resources/createinstallmedia \
--volume /Volumes/Untitled \
--applicationpath /Applications/Install\ OS\ X\ Yosemite.app \
--nointeraction

El Capitan:

sudo /Applications/Install\ OS\ X\ El\ Capitan.app/Contents/Resources/createinstallmedia \
--volume /Volumes/Untitled \
--applicationpath /Applications/Install\ OS\ X\ El\ Capitan.app \
--nointeraction

Create OS X NetInstall Images from Command Line

Creating NetInstall images on OS X is quite easy, there are a number of different ways to do so. There are tools such as AutoNBI, or Casper NetInstall Creator. But third party tools are not required to make the NBI for Mavericks, Yosemite, or El Capitan. The System Image Utility is a great tool with a GUI to make the images. The only caveat to this that I have found is that you can only create an image from the installer of that version you are on. So let's say you have a MacBook Pro running Yosemite and you have the Install application for Mavericks in your applications folder. When opening the System Image Utility, it would not recognize the installer.

One way to go around this is to use the imagetool through the command line. This is a Unix Executable File located in the Contents folder of the System Image Utility.

'/System/Library/CoreServices/Applications/System Image Utility.app/Contents/MacOS/imagetool'

From Terminal, this can be run to create a NetInstall Image with the install application that was downloaded from the App Store and no other tools are required. To create a Mavericks NetInstall, I have copied the Install OS X Mavericks.app outside of the Applications folder for safe keeping, but in order to run the tool the installer must be in the Applications folder. Open up terminal and run this command (note, you must be sudo to run):

sudo /System/Library/CoreServices/Applications/System\ Image\ Utility.app/Contents/MacOS/imagetool --netinstall --index 1001 --source '/Applications/Install OS X Mavericks.app' --destination '/Mavericks/NetInstall of Mavericks OS X' --name 'Mavericks NetInstall'

The same can be done with Yosemite on the same MacBook Pro mentioned earlier.

sudo /System/Library/CoreServices/Applications/System\ Image\ Utility.app/Contents/MacOS/imagetool --netinstall --index 1002 --source '/Applications/Install OS X Yosemite.app' --destination '/Yosemite/NetInstall of Yosemite OS X' --name 'Yosemite NetInstall'

In order to create the NetInstall image for El Capitan, the machine MUST be running El Capitan. Otherwise, image tool will throw an error and will not complete. However, on an El Capitan machine the command is the same and you can create all three versions from there.

sudo /System/Library/CoreServices/Applications/System\ Image\ Utility.app/Contents/MacOS/imagetool --netinstall --index 1003 --source '/Applications/Install OS X El Capitan.app' --destination '/El Capitan/NetInstall of El Capitan OS X' --name 'El Capitan NetInstall'

The only version of OS X where the imagetool command is different is in Mavericks, where the executable is located: 

'/System/Library/CoreServices/System Image Utility.app/Contents/MacOS/imagetool'

Sunday, May 15, 2016

Enable epel repo CentOS

The following command for me would not work on my CentOS minimal installation.

sudo yum install epel-release

If this command fails, there is another way to install the epel repo on CentOS. Just make sure that wget is installed. If you are unsure, you can find out if it is installed by typing:

which wget

This should return /bin/wget. If it does not then install wget with

yum install -y wget

Once that is installed, pick which version of CentOS you have and type the commands to install the epel repo

CentOS 5:

wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-5.noarch.rpm
sudo rpm -Uvh epel-release-latest-5*.rpm

CentOS 6:

wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
sudo rpm -Uvh epel-release-latest-6*.rpm

CentOS 7:

wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo rpm -Uvh epel-release-latest-7*.rpm

After that completes, then activate the repo with the following command

yum repolist

With the extra epel repo enabled, you should now be able to install extra software needed to finish setup of the CentOS distro.

Tuesday, May 10, 2016

Ubuntu 14.04 Server Static IP

By default, Ubuntu 14.04 server sets the network interface using DHCP. In most cases this is eth0, but could vary. To set that interface using a static IP address, the interfaces file needs to be edited. At the console type the command in bold to open the nano editor. (Replace nano with your editor of choice). For this exercise we are going to give the server a static IP of 10.0.1.5 in a 24-bit network.

user@server:/# nano  /etc/network/interfaces

Find this line:
iface eth0 inet dhcp

and change dhcp to static, then append the following lines after:
address 10.0.1.5
netmask 255.255.255.0
network 10.0.1.0
broadcast 10.0.1.255
gateway 10.0.1.1
dns-nameservers 10.0.1.2

The last line can be replaced with a public DNS server such as Google, or OpenDNS.  In this, I chose my private DNS server running a simple Bind9 instance in my network. The interfaces file can be saved and exited. Next the nameservers need to be added to the resolv.conf file located at /etc/resolv.conf

user@server:/# nano  /etc/resolv.conf

Add the nameservers of your choice, public or private, or a combination of both, as well as a search domain if you have one, or you can make up one.

nameserver 10.0.1.2
nameserver 10.0.1.3
search network.domain

Save the file and exit. The last step is to add the server name to the hosts file.

user@server:/# nano  /etc/hosts

10.0.1.5    ubuntu-srv.network.domain    ubuntu-srv

Save and exit. The final step is to restart the network service for the server to get the new IP address.

user@server:/# sudo ifdown eth0 && sudo ifup eth0

That's all, from another computer on the local network you should be able to ping the server's static IP address if all went well and there were no errors.