Clone your Debian server’s packages to new server with dpkg

May 2, 2013 Leave a comment

Make sure /etc/apt/sources.list is identical to your the file on the original server.
You may have to rsync /etc/apt from your old server to your new server if you have
installed different apt keys.

First run
dpkg –get-selections | awk ‘{print $1}’ >installed-packages ## on existing server
then sftp the installed-packages file to your new server.
on your new server, make sure you have /etc/apt/sources.list exactly like the
one on your old server.

On your new machine run:
apt-get install `cat installed-packages`

Your new server should now have all the packages your old server has.
You can copy the /etc/*.conf files to your new server (I would make a new place for them)
and add them back as needed to the new server.

Categories: sysadmin

Clone your Debian server’s packages to new server with dpkg

April 28, 2013 Comments off

First run
dpkg –get-selections * > installed-packages on your old server
then sftp the installed-packages file to your new server.
on your new server, make sure you have /etc/apt/sources.list exactly like the
one on your old server.

On your new machine run:
dpkg –set-selections < installed-packages
and then run
apt-get -u dselect-upgrade –yes

Your new server should now have all the packages your old server has.
You can copy the /etc/*.conf files to your new server (I would make a new place for them)
and add them back as needed to the new server.

Categories: sysadmin

fix OSX Mountian Lion sleep connectivity problem

October 21, 2012 Comments off

If your imac or other osx device has no network connectivity after entering the sleep mode, you can fix it by entering the su mode and editing this file:

/Library/Preferences/SystemConfiguration/com.apple.PowerManagement.plist

Locate the two lines containing PrioritizeNetworkReachabilityOverSleep

and change the value in the next line from <integer>0</integer> to <integer>1</integer>

Now your ethernet connection should remain active even while the computer is in the sleep mode.

Categories: sysadmin

Update — Airprint for IOS6

October 15, 2012 Comments off

IOS6 requires these additions to my previous instructions to work with airprint.

Create the following files

/usr/share/cups/mime/airprint.types

##contents of airprint.types##

image/urf urf string(0,UNIRAST<00>)

/usr/share/cups/mime/airprint.convs

##contents of airprint.convs###

image/urf application/pdf 100 pdftoraster

recreate /etc/avahi/services with airprint-generate.py

wget https://github.com/tjfontaine/airprint-generate/blob/master/airprint-generate.py

chmod +x airprint-generate.py

./airprint-generate.py -d /etc/avahi/services/

service restart cups

service restart avahi-daemon

Printing should now work!

 

Categories: sysadmin

Add logrotate to unbound nameserver – Debian Squeeze

September 26, 2012 Comments off

You can add logrotate to your unbound nameserver. Just create a file named unbound and place it in /etc/logrotate.d.

File contents below:

/var/log/unbound.log {
rotate 12
weekly
compress
missingok
notifempty
postrotate
/etc/init.d/unbound restart
endscript
}

Categories: sysadmin

Install apache2 mpm worker and php5-fpm on Debian/Ubuntu

September 4, 2012 Comments off

To install apache2-mpm-worker with php5-fpm support just apt-get install apache2-mpm-worker apache2-utils apache2.2-bin apache2.2-common libapache2-mom-fastcgi php5-fpm.

Create a php5-fpm.conf (or whatever .conf) and add it to /etc/apache2/conf.d. My file contains this (includes cgi support). After installing the above do a2enmod fastcgi and add the below php5-fpm.conf file to /etc/apache2/conf.d

##php5-fpm.conf ###

<IfModule mod_fastcgi.c>
AddHandler php5-fcgi .php
Action php5-fcgi /php5-fcgi
Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /var/run/php5-fpm.sock -pass-header Authorization
</IfModule>
<IfModule mod_alias.c>
ScriptAlias /cgi-bin/ /var/www/cgi-bin/

<Directory /var/www/cgi-bin/>
AllowOverride None
Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
</IfModule>
<IfModule mod_actions.c>
Action application/x-httpd-php /cgi-bin/php5
</IfModule>

Also add this to /etc/php5/fpm/pool.d/www.conf

listen = /var/run/php5-fpm.sock

You should be able to restart apache2 and start php5-fpm and have php support. The same setup also works for nginx.

Categories: sysadmin

Add airprint (wireless IOS printing) to Debian Squeeze

August 26, 2012 Leave a comment

You can enable wifi printing on your IOS device with a Debian box connected to your local wired network assuming your wireless ap is also connected to the same network. Here’s how

Before you start you should have a cups compatible printer connected to the Debian box.

apt-get install cups-pdf avahi-daemon python-cups cups-driver cups-driver-gutenprint  foomatic-db foomatic-db-engine foomatic-filters foomatic-filters-ppds

Test cups printing and make sure it’s functional. Add this to /etc/cupsd.conf

ServerAlias *

mkdir /opt/airprint (or wherever you want)

wget https://github.com/tjfontaine/airprint-generate/blob/master/airprint-generate.py

chmod +x airprint-generate.py

./airprint-generate-py -d /etc/avahi/services

Restart avahi ie /etc/init.d/avahi-daemon restart

ls /etc/avahi/services and you should see your printer listed.

Try printing from your IOS device (iphone, ipad, etc) connected to your wifi network. It should work!

Categories: sysadmin

Airprint (wireless IOS printing) for Debian Squeeze

August 21, 2012 Leave a comment

You can enable wifi printing on your IOS device with a Debian box connected to your local wired network assuming your wireless ap is also connected to the same network. Here’s how

Before you start you should have a cups compatible printer connected to the Debian box.

apt-get install cups-pdf avahi-daemon python-cups cups-driver cups-driver-gutenprint  foomatic-db foomatic-db-engine foomatic-filters foomatic-filters-ppds

Test cups printing and make sure it’s functional. Add this to /etc/cupsd.conf

ServerAlias *

mkdir /opt/airprint (or wherever you want)

wget https://github.com/tjfontaine/airprint-generate/blob/master/airprint-generate.py

chmod +x airprint-generate.py

./airprint-generate-py -d /etc/avahi/services

Restart avahi ie /etc/init.d/avahi-daemon restart

ls /etc/avahi/services and you should see your printer listed.

Try printing from your IOS device (iphone, ipad, etc) connected to your wifi network. It should work!

Categories: sysadmin

Start Debian 6 without X (in text mode)

July 18, 2012 Leave a comment

You can boot Debian 6 without starting X by doing this:

edit /etc/X11/default-display-manager and change as indicated below:

# /usr/sbin/gdm3 (leave this in place in case you want to re-enable X)                                                                                                                                                        false

Categories: sysadmin

repeated errors in /var/log/messages

May 23, 2012 Leave a comment

If your seeing repeated messages like this in /var/log/messages on your Debian/Ubuntu server, you need to install sysklogd.

rsyslogd: [origin software=”rsyslogd” swVersion=”4.6.4″ x-pid=”1015″ x-info=”http://www.rsyslog.com”%5D rsyslogd was HUPed, type ‘lightweight’.

Categories: sysadmin