Monday, March 31, 2014

Install Zentyal 3.5 from apt repository

This is arguably the easiest install I've ever done.  Hats off to the Zentyal team for making a very clean and robust piece of software.

This works on Ubuntu 13.10 and 14.04, I have not tested on any other distro so use at your own risk!

add the source:
deb http://archive.zentyal.org/zentyal 3.5 main extra
to /etc/apt/sources.list

run:
sudo apt-get update
sudo apt-get install zentyal

open up your favorite web browser (Zentyal recommends firefox), and navigate to the ip address of your server.
for example, mine is https://192.168.3.186/
should be greeted with a login screen for Zentyal.
enter in your main user just as if you were logging in remotely.

Just a note, some modules are processor intensive.  Be aware of what you are enabling.

And that's it! Enjoy!

**I recently upgraded to 14.04 and zentyal does not work, conflicting perl versions are preventing zentyal-core from installing properly as seen here:
https://bugs.launchpad.net/ubuntu/+source/zentyal-core/+bug/1310694

UPDATE 05/29/2014:
Zentyal now works with ubuntu 14.04.
using the repository deb http://archive.zentyal.org/zentyal 3.5 main extra
(notice the 3.5, not 3.4)
 do a "sudo apt-get update && sudo apt-get install zentyal"

Saturday, March 29, 2014

Automated Water Softener

Using an arduino, a relay, and some buttons I have created an alternative for a very expensive control unit for a water softener.

The control unit had time and a set schedule for cycling the water softener refresh process.  I don't need a set time for the water softener to recycle, just someone to press a button on the thing.

So the code is posted here https://github.com/slimjim2234/Automated-Water-Softener
enjoy!

Friday, March 28, 2014

Install Xen Orchestra from source

Instructions to come.

git clone https://github.com/vatesfr/xo-server.git
cd xo-server
npm install
git clone https://github.com/vatesfr/xo-web.git
cd xo-web
npm install

node.js did not work properly for me through apt-get so I installed it from source.

git clone https://github.com/joyent/node.git

./configure
make
make install

To solve the error:
Error: "pre" versions of node cannot be installed, use the --nodedir flag instead
use the following commands:
npm config set nodedir /directory/to/node
or
npm config set nodedir /directory/to/node --global

this is because npm install needs node's source as well as the node executable.  Make sure that directory is permanent.  I have mine so that I can git pull a newer version right in that directory without any other major modifications.  The first line represents the current user's npm config file and the second represents the global config file.

Also, make sure you are running the latest node version of 10.x, 11.x is not compatible.

Thursday, March 27, 2014

Home Configuration

Router: WNDR3700 running barrier breaker (I upgrade about once a week.
I use this with ddns (http://www.dnsdynamic.org/) to access my home network from anywhere.  Also use for port forwarding, static hostnames, ssh tunneling, and network monitoring.

Server (not that great): I use an old dual core amd-based server with a couple hdd attached just for testing/hosting purposes.  I am running Ubuntu 13.10 as my base OS.  Just a couple running services; Jenkins, RabbitMQ, Owncloud 6, Seafile 2.1.5, Codiad from git, cloud9, SoftEther VPN from git, webmin, zentyal (really neat software)... and much more.

Raspberry Pi #1: Running raspbian, solely used for testing bluez from git.

Raspberry Pi #2: Running raspbian, CUPS server connected to Canon S530d.

Raspberry Pi #3: Running raspbian, testing other packages like owncloud.

Beaglebone black A5C #3: Running ubuntu 13.10 on the eMMC and Fedora on the micro sd card

Macbook pro 13" 2009 5,5:
2 x 2 GB g.skill ram
240GB Kingston SSD
750GB WD HDD (replaced super drive for second internal HDD)
Running:
osx 10.9.2
Windows 7
Ubuntu 14.04
Kali 1.0.6
Opensuse 13

Friday, March 21, 2014

Cups 1.7.5, 2.0, or 2.1 on Raspberry Pi Raspbian

In my attempt to turn the raspberry pi into a wireless printer server for my usb connected Canon s530d printer (yes, i'm well overdue for a 21st century printer upgrade, just wanted to see if I could make it work), I have concluded that cups and a bunch of other requirements need to be installed.  To accomplish this, the prerequisite list is long and compiling is time consuming, so patience must be a prerequisite to these prerequisites.  I chose to compile all of these from scratch instead of apt-get all of them because the raspbian and ubuntu-based distros have versions of cups that are highly outdated.  As of writing this I believe they are still on 1.5.3, not good.  To stay up-to-date, you should go with my route to ensure you are running the latest cups software.
A great source for looking up the proper way to install the programs is linuxfromscratch.org.

Update 12/23/2014
cups 1.7 is no longer maintained.
choose either cups 2.0 or 2.1 

Few disclaimers:
*** Needs adequate power ***
Some printers are power hungry (like mine) and the pi will incidentally freeze without warning due to too much current drawl through the host USB port.  I have been working just fine with plugging in a pair of iphone usb chargers totaling approximately 2 amps joint by a usb y-cable.  This one exactly http://www.amazon.com/gp/product/B0047AALS0/ref=wms_ohs_product?ie=UTF8&psc=1

*** Will not work with all printers ***
My Canon s530d requires experimental gutenprint drivers so I have included those steps below

*** Lengthy compile times ***
 Seriously, if you are compiling all of the sources below, you're gonna have a lot of down time.  It usually takes me about 2-3 hours from the first step to the last for a full installation.

Download the following sources:
qpdf  "git clone https://github.com/qpdf/qpdf.git"
poppler "wget http://poppler.freedesktop.org/poppler-0.24.5.tar.xz"
cups-filters "http://www.openprinting.org/download/cups-filters/cups-filters-1.0.54.tar.bz2"
cups "https://www.cups.org/software/1.7.5/cups-1.7.4-source.tar.bz2" or "git clone -b branch-1.7 http://www.cups.org/cups.git cups-1.7" or "git clone http://www.cups.org/cups.git cups-2.0" or
"git clone http://www.cups.org/cups.git cups-2.1"
ghostscript - "git clone http://git.ghostscript.com/ghostpdl.git"
foomatic-db - "wget http://www.openprinting.org/download/foomatic/foomatic-db-current.tar.gz"
gutenprint - "http://sourceforge.net/projects/gimp-print/files/gutenprint-5.2/5.2.10/gutenprint-5.2.10.tar.bz2"

Bonus! Google Cloud Print!
Cloud Print "git clone git://github.com/simoncadman/CUPS-Cloud-Print.git"

To start off:
So the process goes smoothly, remove all references to cups, ghostscript, foomatic, cups-filters, and gutenprint in the apt package manager and file system.  To do this I normally use apt-get remove cups* and "locate cups" on the command line to find the files and remove the files manually.  That way I am not accidentally ruining my system by removing files that should not be removed.

The process is nearly the same with all of the installs (with a few excepts on a few of them) and using sudo before every command is highly recommended
  • autoconf
  • ./configure
  • make
  • sudo make install

Initial cleanup:
Find unnecessary  preinstalled packages by running the following:
dpkg --get-selections | grep -v deinstall | grep cups
dpkg --get-selections | grep -v deinstall | grep poppler
dpkg --get-selections | grep -v deinstall | grep ghostscript
dpkg --get-selections | grep -v deinstall | grep foomatic-db

or you could simply run this:
dpkg --get-selections | grep -v deinstall | egrep '^(cups|poppler|ghostscript|foomatic-db)' | awk '{print $1 }' | tr '\n ' ' ''' | xargs sudo apt-get remove 


Remove all preinstalled packages that look like this:
cups-*
poppler-*

So the compiler doesn't find any precompiled libraries find any files that have the reference of libcups* and libpoppler*, then remove them.

For me, I had to do the following:
sudo rm  /usr/lib/arm-linux-gnueabihf/libcups*
sudo rm  /usr/lib/arm-linux-gnueabihf/libpoppler*
sudo find . -name cups* -not -path "./home/pi/*" -exec rm -rf {} \;

--------------------------------------------------------------------------------------------------------------

1. QPDF
cd qpdf
autoconf
./configure --enable-doc-maintenance
make (at the end of the make you should see a summary of what is available, resolve any dependencies as you wish like docbooks)
sudo make install

there should be no errors, if there are it is most likely dependency issues.  Also, this part has the longest compile time.

--------------------------------------------------------------------------------------------------------------

2. POPPLER
cd poppler
./autogen.sh
./configure --enable-libcurl
make
sudo make install

once again, resolve dependencies as necessary.  At the end of the poppler configure you should see a summary that resembles the following code.  Make sure you have cairo output, libjpeg, libpng, libtiff, and libopenjpeg checked off with yes.  You have to have at least those checked for cups-filters to install properly.


Building poppler with support for:
  font configuration: fontconfig
  splash output:      yes
  cairo output:       yes
  qt4 wrapper:        yes
  qt5 wrapper:        no
  glib wrapper:       yes
    introspection:    no
  cpp wrapper:        yes
  use gtk-doc:        no
  use libjpeg:        yes
  use libpng:         yes
  use libtiff:        yes
  use zlib:           yes
  use libcurl:        yes
  use libopenjpeg:    yes
  use cms:            yes
      with lcms2
  command line utils: yes
  test data dir:      /home/pi/Projects/poppler-0.24.5/./../test


--------------------------------------------------------------------------------------------------------------

3. CUPS
Just follow these instructions http://www.linuxfromscratch.org/blfs/view/svn/pst/cups.html
They did a good job, and i'd basically be copy and pasting.  You don't have to do the patch so here are the instructions without it.
For <username> , insert an admin user you would like to have control over the printer settings.  I used my default "pi" user.  You can add as many as you would like.

useradd -c "Print Service User" -d /var/spool/cups -g lp -s /bin/false -u 9 lp
groupadd -g 19 lpadmin
usermod -a -G lpadmin <username>

cd cups-1.7.5
or
cd cups-2.0*

./configure
make
sudo make install
echo "ServerName /var/run/cups/cups.sock" > /etc/cups/client.conf

--------------------------------------------------------------------------------------------------------------

4. GHOSTSCRIPT
cd ghostpdl/gs
sudo apt-get install libxt-dev
./autogen.sh
./configure
make
sudo make install
sudo make install-so

--------------------------------------------------------------------------------------------------------------

5.CUPS-FILTERS
cd cups-filters-1.0.54
autoconf
./configure
make
sudo make install

--------------------------------------------------------------------------------------------------------------


****This step is optional and is dependent upon the requirements of your printer driver****6. FOOMATIC-DB
cd ghostpdl
sudo apt-get install libxt-dev
./configure
make
sudo make install

--------------------------------------------------------------------------------------------------------------

****This step is optional and is dependent upon the requirements of your printer driver**** 
7. GUTENPRINT
cd gutenprint-5.2.10
sudo apt-get install texlive-fonts-extra doxygen
./configure
make
sudo make install

--------------------------------------------------------------------------------------------------------------

8. Google Cloud Print
cd CUPS-Cloud-Print
./configure
make install

--------------------------------------------------------------------------------------------------------------

Add the following at the top of /etc/init.d/cups by sudo vim /etc/init.d/cups
then run "sudo update-rc.d"

### BEGIN INIT INFO
# Provides:          cups
# Required-Start:    $syslog $remote_fs
# Required-Stop:     $syslog $remote_fs
# Should-Start:      $network avahi
# Should-Stop:       $network
# X-Start-Before:    samba
# X-Stop-After:      samba
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: CUPS Printing spooler and server
### END INIT INFO

this prevents the following loop message when trying to install other packages and invoking update-rc.d:
"insserv: Starting cups depends on plymouth and therefore on system facility `$all' which can not be true!"

--- 
The installation should be finished with no errors, now we have to fix some issues with cups because the new cups-filters uses newer methods for test banners.
Follow the instructions to fix this here: http://www.bsmdevelopment.com/Reference/Tech_20130002.html

Easiest way to get to the web interface without editing the conf file for cups is use lynx and do the following:

apt-get install lynx
lynx http://localhost:631
Use the arrows to navigate to the administration word, type "y" to enable the cookie, and a new page should populate.  In the middle of the page you should see "Allow remote adminstration".  Navigate with the "down" arrow to the bottom and press enter on the desired highlighted box.  It will ask for authentication, use the root or current username and password as long as it is part of the lpadmin group described in the CUPS link.

sudo cupsctl --remote-admin

Trial and error resolutions:

If you receive the error:
syntax error near unexpected token `win32-dll' trying to run ./configure
for qpdf or poppler, run the command:
aclocal
then
autoreconf -i
try ./configure again and you should be good to go
___________________________________________________________________

If you receive the error
libqpdf/SecureRandomDataProvider.cc:92:4: error: #error "Don't know how to generate secure random numbers on this platform.  See random number generation in the top-level README" 
trying to configure qpdf, configure using:
./configure --enable-insecure-random
___________________________________________________________________

If you receive the error:
/home/pi/Projects/cups-filters-1.0.48/filter/pdftoraster.cxx:1807: undefined reference to `GfxColorSpace::setDisplayProfile(void*)'
Make sure you have libopenjpeg-dev installed.  Configure, recompile, and install poppler again.  Then cups-filters again.
___________________________________________________________________

If you receive an error that contains anything with an undefined reference to pwg* like pwgMediaForLegacy
The compiler is linking to an older library which means you may have a previous version of cups or a cups library installed.
When I received this error I had to remove all cups libraries in the following folder:
/usr/lib/arm-linux-gnueabihf/
to find all references to the libraries for your computer, use locate to find installation files don't appear to be in the correct or "ls -l" a folder to check the date and see if it's rather old.  The files I had removed had the date of October 13th, 2013.  They definitely should not be there and should be removed.
apt-get remove cups*
rm /usr/lib/arm-linux-gnueabihf/"cups libraries"
and you should be good to go
___________________________________________________________________

If you receive the error "Error: Success" (or something along those lines) when trying to automatically find the driver for the printer or "lpinfo -m" doesn't populate any drivers, most likely the foomatic drivers are conflicting with the gutenprint drivers.
To fix it, locate every "foomatic" reference and "sudo rm -r" it.
Reinstall the cups-filters and gutenprint drivers and run "lpinfo -m" if any drivers populate you should be good to go.
OR
you could change the permissions of the foomatic driver database by "chmod 644 /usr/lib/cups/driver/foomatic-db-driver"
___________________________________________________________________

If you receive the following error in your error page under the administrative menu:
no profiles specified in PPD
Then you need to install ghostscript.  See step 4.