Posts Tagged Ubuntu

Enabling Apache SSL and installing own certificates

This is for Ubuntu Server 12.04 64-bit.

The easiest way to activate Apache’s SSL is:

a2enmod ssl
a2ensite default-ssl
service apache2 restart

That’s all for the setup, now for installing the certificates. I am using certificates from StartSSL, so your installation may be slightly different.

Copy the unencrpyted SSL private key to /etc/ssl/private, chown it www-data:www-data, chmod it 700.

Find the line containing SSLCertificateKeyFile, uncomment it, and change it to point to your private key file, like so:

SSLCertificateKeyFile /etc/ssl/private/(your private key file)

Copy your public key to /etc/ssl/certs.

Change the SSLCertificateFile line to point to your public certificate, like so:

SSLCertificateFile /etc/ssl/certs/(your certificate file)

Find the following line and uncomment it:

SSLCACertificatePath /etc/ssl/certs/

That’s it.

, , ,

Leave a comment

Installing AjaXplorer on Ubuntu Server

Instructions are here, reposted for my own convenience:

This is for Ubuntu Server 12.04 64-bit.

edit /etc/apt/sources.list and add to the bottom:

deb stable main
deb-src stable main

Then, install the gpg key

wget -O - | sudo apt-key add -


sudo apt-get update
sudo apt-get install ajaxplorer

A few more steps to get it working…

copy the sample config file over (and make it readable by the web server):

cp /usr/share/doc/ajaxplorer/apache2.sample.conf /etc/apache2/sites-enabled/ajaxplorer.conf
chown www-data:www-data /etc/apache2/sites-enabled/ajaxplorer.conf

Restart apache…

service apache2 restart


/etc/init.d/apache2 restart

Make AjaXplorer redirect to HTTPS… (this is displayed during the initial page visit anyway)

edit /usr/share/ajaxplorer/conf/bootstrap_conf.php and uncomment the following line (or add it to the bottom)

define("AJXP_FORCE_SSL_REDIRECT", true);

If HTTPS doesn’t load, it’s probably because apache isn’t configured for SSL. That’s in the next section.

If you get a warning about Server charset encoding, uncomment this line in /usr/share/ajaxplorer/conf/bootstrap_conf.php

define("AJXP_LOCALE", "en_US.UTF-8");

Lastly, since I have /srv on a separate partition, I want ajaxplorer data stored there. By default it’s stored in /usr/share/ajaxplorer/data, which is actually a symlink to /var/lib/ajaxplorer/data.

mkdir /srv/ajaxplorer
cp -r /var/lib/ajaxplorer/data/* /srv/ajaxplorer
chown -R www-data:www-data /srv/ajaxplorer
rm /usr/share/ajaxplorer/data
ln -s /srv/ajaxplorer /usr/share/ajaxplorer/data

Warning: AjaXplorer will start acting odd if /srv isn’t mounted at boot time. Keep that in mind.

By default, PHP max file upload is 2M, and this setting will carry over to AjaXplorer. In order to increase it, you have to change it in three places.  The AjaXplorer documentation says that this is set by php’s upload_max_filesize, but I’ve found that you also have to change php’s post_max_size to match. (/etc/php5/apache2/php.ini). After which, go into AjaXplorer settings repository, then Global Configurations > Core Configs > Common ‘uploader’ core configs. Expand Limitations, then set File Size to 0 to inherit the PHP setting. (Note: It won’t stay 0, it will auto-set to php’s setting. Keep this in mind if you want to change it later.)

More later…

, ,


Installing webmin on Ubuntu Server

Same disclaimer as last post: This is mostly for my memory, but you’re welcome to the comments section below.

This is for Ubuntu Server 12.04 64-bit.

In order to install webmin from apt, follow these instructions, reposted here for my own convenience:

edit /etc/apt/sources.list and add to the bottom:

deb sarge contrib
deb sarge contrib

then, to add the gpg signature, run:

sudo wget -O - | sudo apt-key add -

lastly, install:

sudo apt-get update
sudo apt-get install webmin

If it complains about missing dependencies, first edit /etc/apt/sources.list and uncomment any lines for universe. Then, install these:

sudo apt-get install perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl apt-show-versions python

Coming up…even more…

, ,

1 Comment

Installing Ubuntu Server 12.04 LTS x64 on the HP MicroServer N40L

I’m mostly documenting this as a way for me to remember it, but anyone is free to learn from my doings or leave their own comments.

Configuration is 3x2TB hard drives in bays 0, 1, 2. Bay 3 is empty. (I’m considering adding a 4th 2TB drive and reshaping to RAID-6 at some point in the future.)

Partitioned as follows (MBR):

  1. 50GB as RAID
  2. 4GB as RAID
  3. 1.9TB (max) as RAID

RAID setup (mdadm) as follows:

  • md0: partition 1 (50GB) RAID-5, 3 units, 0 spares. EXT4, bootable, mounted at / [Total 100GB+parity]
  • md1: partition 2 (4GB) RAID-5, 3 units, 0 spares. swap [Total 8GB+parity]
  • md2: partition 3 (1.9TB) RAID-5, 3 units, 0 spares. EXT4, mounted at /srv [Total 3.8TB+parity]

Packages installed during installation:

  • OpenSSH
  • LAMP
  • Samba

GRUB installed to MBR

The very first thing to do after installation is to update. SSH in and run the following:

sudo apt-get update
sudo apt-get upgrade

May get the following complaint about kernel updates being held back:

The following packages have been kept back:
 linux-headers-generic-lts-quantal linux-image-generic-lts-quantal
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.

This is the fix:

sudo apt-get dist-upgrade

Coming up… more installations…

, , , , , , ,

Leave a comment

Build and install Mozilla Spider Monkey (spidermonkey-bin) on Ubuntu Linux

Here’s how to quickly and easily build spidermonkey-bin from source on Ubuntu Linux.

sudo apt-get install mercurial autoconf2.13
hg clone spidermonkey
cd spidermonkey/js/src
sudo make install


, , , ,

Leave a comment

How to retrieve EXIF data from the command line in Ubuntu Linux

If you want to make use of the EXIF data stored in a JPEG (.jpg or .jpeg) or TIFF (.tif or .tiff) file from the command line in Ubuntu Linux — or most other Linux variants — here’s how.

This was tested on Ubuntu 11.10 (Oneiric Ocelot).

First, you will need to have imagemagick installed to provide the identify command.

sudo apt-get install imagemagick

Next, you can retrieve the data on an image with the following example:

identify -verbose /usr/share/backgrounds/WildWheat_by_Brian_Burt.jpg

If you want just the EXIF data, you can use something like the following:

identify -verbose /usr/share/backgrounds/WildWheat_by_Brian_Burt.jpg | grep "exif:"

, , ,


Bash script to automatically sort photos into folders based on EXIF data for Ubuntu Linux

If you — like me — take a lot of digital pictures, you probably have a hundred folders full of images on your hard drive or external drives, and not nearly as sorted as you would like them to be. you have probably gotten to the point that you don’t know what’s in them or can’t find an image when you’re looking. I had around 10,000 images in over a dozen folders spanning 5+ years, and I had no intention of even trying to sort them manually :) So I wrote this script.

The following script was written in bash on Ubuntu Linux and automatically sorts your images into directories based on the date and time the photo was taken. How does it do this? By making use of the EXIF data your digital camera stores inside the image. The date and time the photo was taken is stored in that EXIF data. When an image doesn’t have EXIF data (such as when it was downloaded from the Internet, or taken from a camera that doesn’t support adding EXIF data), it will use the files last-modified time.

First, this should be run in the top-most directory of wherever your pictures are stored. If you have pictures/foldername/somepics/ and pictures/anotherfolder/morepics, run it from your pictures/ directory.

There are quite a few opportunities to improve this script — and some cautionary notes as well — marked within the script with FIXME tags. I’m already finished sorting my images, but anyone is welcome to contribute suggestions and improvements, which I’ll look into incorporating the next time I’m using this. You are welcome to include any suggestions or code improvements in the comments below using <code> and/or <pre> tags.
Usage: Copy the script into a file, editing options where appropriate, and save it. Make it executable and run it from the command line or window, from the directory where your pictures are stored. No command-line arguments. Back up your stuff first :)

UPDATE: Because WordPress keeps mangling this code, it has been moved to github, here.

Questions, comments, or feedback can be left in the comments below, or please use the contact form. Thank you!

, , , ,


Basic Ubuntu VPS server backup via FTP or SSH SFTP

In my quest for the perfect “in my dreams” backup solution for my Ubuntu VPS, I created this very simple script which can be run as a cron job and can be easily modified to backup any amount of data to any remote FTP or SFTP server.

You could very easily include a database backup by running mysqldump beforehand, but I’m not including it in this script.

This required yafc to be installed, but Ubuntu installations can easily install it by running

sudo apt-get install yafc

And now, for the script:

# format of the open command is proto://username:password@HOSTorIP/
# proto is either ftp or ssh
# special characters in the username or password are not well tolerated
# anything in the EOF tags are direct commands to yafc. Test if unsure
DIR=`date +%F`
yafc <<EOF
cd backup-dir
mkdir $DIR
cd $DIR
put -p -r *

Enjoy! Questions, comments, and feedback are welcome and appreciated. Thank you!

, , , , , , , , ,

1 Comment

How to run a game or other program in a new X session in Ubuntu Linux

To do this, CTRL-ALT-F1 to an open terminal, log in, and run:

xinit ./program -- :1

where program is the program file you want to start in a new X session. Assuming your normal X session is on :0 and appears when you CTRL-ALT-F7, your new one will spawn on CTRL-ALT-F8.

Questions, comments? Please feel free to leave them in the comments section below. Thank you.


Leave a comment

Easy Ubuntu data usage monitor

If you’re lucky enough to have a broadband card that works under Linux, your plan probably includes an “allowance” or data usage quota per month. You might be thinking how nice it would be to have a utility that tracks your data usage for the month (or other period) and gives you an easy-to-read report. You might also want said monitoring utility to have pre-built packages for Ubuntu / Debian.

NTM (Network Traffic Monitor) is what you want. As of this post the latest version is NTM 1.2.4.

Start by going to the NTM download site and downloading ntm-1.2.4.deb. Then double-click on it to install it using Ubuntu Software Center.

Once installed, you will find NTM at Applications > Internet.

Upon starting, it minimizes to the tray (next to the clock). You can open the interface by left-clicking the icon, and open the menu to access preferences by right-clicking the icon.

By default NTM monitors ppp0, which is the most likely interface that your broadband card will use. If you want to monitor a different interface, change that under the General tab. If you’re not sure what interface to use, run the following command:

ifconfig -a

This lists all interfaces and will help you locate your desired connection by IP / MAC and other info.

Also by default, NTM is configured with some other settings, such as auto-disconnecting after a data threshold has been reached (98MB by default), and disconnecting after a certain number of usage hours (30). These are likely too low for most mobile broadband users. Be sure to change these settings, under the Traffic, Time Slot, and Time tabs, to prevent unexpected disconnections.

Questions, comments, or other feedback? Please comment below. Thanks!

, ,

Leave a comment


Get every new post delivered to your Inbox.

Join 60 other followers