Apache2 on Ubuntu 14.04 LTS

I am just poking around the latest LTS from Canonical. It looks like the Apache configs have a new directory hierarchy. There are now conf-available and conf-enabled directories. A small intellectual jump, before looking things up, led me to the command a2enconf. How nice! I wonder if this will complicate things…

Java on Ubuntu 13.04 (Raring Ringtail)

Installing Oracle Java on Ubuntu can be a pretty daunting task. After reading the Ubuntu documentation here:

Java

I came across this nice github project:

oab-java6

Simply run

git clone https://github.com/flexiondotorg/oab-java6.git

Then cd into oab-java6 and run

sudo ./oab-java.sh

This will set up a local apt repository for Sun Java 6 and Oracle Java 7. Now run

sudo apt-get update

to add the packages from the repository. As the documentation states, you can now run

sudo apt-get install sun-java6-jre

To install Java 6 runtime environment.

One small thing to note:

I had to run

sudo update-alternatives --config java

and select the Sun JRE since the system defaulted to IcedTea.

Now do

java -version

to see what you have!

Install Oracle JDK 8 on Ubuntu Server

I am trying to evaluate the MySQL plugin for NewRelic so I have to install a JRE on the MySQL server. Gut instinct tells me to go with Oracle JRE….not the alternatives. So, Here is what I did to install JRE 8.

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

If you receive an error while adding the ppa, something like this:

error sudo: add-apt-repository: command not found

then

sudo apt-get install python-software-properties

Add Your own Script to Default Run Levels in Ubuntu

This uses the old Sys V init.d scripts. Not upstart. I may write a post on upstart at a later date. So, you write a cool script that you want to run at startup. Place it in /etc/rc.d/init.d and make it executable. Next run the following command:

sudo update-rc.d my_cool_script defaults

This will set the script to run on all the default run levels.

Install vmware tools on Ubuntu 13.04 (Raring Ringtail)

I am doing this on server edition.
First do an apt-get update, then apt-get upgrade to bring the entire system current. Then install build tools and kernel headers with the following command:

sudo apt-get install build-essential linux-headers`uname -r`

Now click on the Install VMWare Tools option on your Guest. On your VM, run the following command:

sudo mount /dev/sr0 /mnt

Then copy the tools image to the Guest:

cp /mnt/VMwareTools-8.6.10-913593.tar.gz /tmp

You may have a different version of VMwareTools. Now ruun the following commands:

cd /tmp
tar -xzvf VMwareTools-8.6.10-913593.tar.gz
cd vmware-tools-distrib

Now start the install:

sudo ./vmware-install.pl

I chose all the default values. I did not install any options marked [EXPERIMENTAL]. When the installer is searching for valid headers, I received an error that they could not be found in “”. So, a little searching and I found that some of the headers moved so:

sudo ln -s /usr/src/linux-headers-$(uname -r)/include/generated/uapi/linux/version.h /usr/src/linux-headers-$(uname -r)/include/linux/version.h

Installing mod_security

sudo aptitude install libapache2-modsecurity

sudo mkdir /etc/apache2/modsecurity

sudo vi /etc/apache2/conf.d/modsecurity.conf

## /etc/init.d/apache2/conf.d/modsecurity.conf
Include modsecurity/*.conf

cd /etc/apache2/modsecurity/

sudo cp -R /usr/share/modsecurity-crs/base_rules/* .

sudo vi /etc/apache2/modsecurity/modsecurity_crs_20_protocol_violations.conf

Replace this line:

SecRule REQBODY_ERROR “!@eq 0” \


with this one:

SecRule REQBODY_PROCESSOR_ERROR “!@eq 0” \ 

sudo service apache2 restart

cat /var/log/apache2/error.log | grep modsecurity

Installing packages in Ubuntu from cdrom (no Internet)

In many cases, the dev class vm’s do not have Internet access (annoying) so you cannot install software vi the Internet.

Mount the ISO in the VM.

On the server run the following command:

sudo mount /dev/sr0 /cdrom

ensure that only the following line is uncommented in /etc/ap[t/sources.list

deb cdrom:[Ubuntu-Server 10.04 LTS _Lucid Lynx_ – Release amd64 (20100427)]/ lucid main restricted

Run sudo apt-get update to update the repository. Then install what you need.