Friday, February 4, 2011

Rsync

Decided I'd have a go at using rsync to do my backups. I played around with a few switches, but settled upon:
    -rltpDiv

I tried
    -aiv
but this attempts to preserve owner/group of files. This is no good for me, as the NSLU2 changes these attributes. I'm not bothered about this at the moment, I'm just interested in getting a backup to run which does transfer 10s of GB each time when all that's changed is file ownership.

So the full command to back up my home directory is:
    rsync -rltpiv /home/barry /media/nslu2/backup/rsync_home_backup --exclude '.gvfs' --exclude 'Dropbox'
where
    -r means recursive
    -l means copy symlinks as symlinks
    -t means preserve modification times
    -p means preserve permissions
    -i means display differences between source and destination
    -v means verbose output

Thursday, December 30, 2010

Mantis Part 2

I can't leave well alone... Having another go at Mantis. Have followed the instructions here and installed phpmyadmin:
    sudo apt-get install apache2 php5-mysql libapache2-mod-php5 mysql-server
    sudo apt-get install phpmyadmin
During the install of phpmyadmin, it will do some config work. Select apache as the web server and answer yes when it offers to setup the database. I supplied 'root' and 'password' when prompted for credentials :-o. Also, I had to set the permissions on the mantis directory otherwise the browser returned a 403 message:
    sudo chmod 755 /var/www/mantis/

I could then navigate to http://localhost/mantis/admin/install.php and fill in the form and click the button. The resulting page requested that I add:

    $g_hostname = 'localhost';
    $g_db_type = 'mysql';
    $g_database_name = 'bugtracker';
    $g_db_username = 'root';
    $g_db_password = 'password';

to /var/www/mantis/config_inc.php as it could not do it itself, for some reason. Ahh - there was no such file as mantis ships with config_inc.php.sample. I added the code and renamed it and the install script was happy.


Clicking continue led me to the mantis login page. Using 'administrator' and 'password' as the credentials I was able to log in. So, up to this point I think I haven't actually needed phpmyadmin at all...


However, if I wanted to create a new user, a password is sent to the user's email address which they use to log in for the first time. As I don't know how to set up emailing, a shortcut would be to look at the mantis database via phpmyadmin and retrieve the password from the sent email. Sneaky eh?


I think I'm gonna call it a day on this little mantis project of mine. Kept me quiet for a bit...

Beware of tasksel!

One of the things I messed about with yesterday when doing the Mantis project was to use tasksel to install all necessary packages for a LAMP server:
    sudo tasksel install lamp-server

When eventually I gave up on the project (at about 2:30am this morning!) I reverted with:
    sudo tasksel remove lamp-server

I noticed something strange - the remove process took quite a long time and I noticed unexpected package names whizzing by on the tasksel dialogue. Anyway, when I came to boot up this morning I got a message about not being able to configure my display hardware or something. It looks like tasksel remove removed some things it shouldn't have alright.

I only had a low graphics console environment available, and could not connect to my wireless network. In short, I've spent the last couple of hours reinstalling Mint :-(

Setting up apache/mySql/PHP/Mantis

Fancied having a go at setting up the Mantis bug tracker on Mint. Here's what I did:


    sudo apt-get install apache2
    sudo apt-get install mysql
    sudo apt-get install libdbd-mysql (stopped browser d'loading php files instead of executing them)


Download Mantis
Download PHP
Unzip PHP
Run ./ configure --with-mysqli=mysqlnd in the php directory
- Had to install libxml2-dev due to error
make
make tests
sudo make install
...
...
...
...
I gave up :-( Too much hassle trying to get PHP and mySQL working together. Maybe another time...

Wednesday, December 29, 2010

Backup script using 7Zip, cron and NSLU2

Have written a script to zip and archive important folders on the NSLU2:
    sudo 7za u /media/nslu2/backup/backup /media/Pictures /media/Documents -mx9 -mmt -mhe -ppassword

This backs up my Pictures and Documents drives to a 7zip archive called backup in the backup folder on the NSLU2. The command 'u' means update the archive, which will check for what has updated rather than just archiving everything each time. The options are:
    -mx9 - maximum compression
    -mht - use multi-threading where there's more than one CPU. I think this is on by default anyway
    -mhe - encrypt the file headers. I think this relies on the next option:
    -ppassword - supplies the password 'password'. Not sure whether it does any encryption with this or it's just to restrict access

I've put this in my crontab:
    0 3 * * 7 sudo 7za u /media/nslu2/backup/backup /media/Pictures /media/Documents -mx9 -mmt -mhe -ppassword
It'll run at 3am every Sunday.

Sunday, December 19, 2010

Setting up the NSLU2 on Linux Mint

Create a mount point:
    mkdir /media/nslu2

Mount the share you set up on the NSLU2 (assumes the default NSLU2 IP address):
    sudo mount -t smbfs "//192.168.1.77/DISK 1/music" /media/nslu2 -o "workgroup=Home,username=barry"

Copy your files over, using -r to copy folders:
    sudo cp -r "/home/barry/Desktop/Abba greatest hits"/ .
;-)

I'll put the mount line in fstab and it should mount at boot up. - Update - this is a bit trickier than I'd hoped. I've had to escape the space in the share name (which I can't get rid of as far as I can see - dictated by NSLU2) with \040:
    //192.168.1.77/DISK\0401/music/ /media/nslu2 smbfs "workgroup=Home,username=admin,password=password,auto,user" 0 0

This means I could lose the "", which were also causing a problem.

After testing - by jove it works! Was a bit worried as of course my wireless connection on the laptop is not fully set up when fstab is processed during boot up, but as soon as I was connected up popped my samba share as a drive on the desktop.

Saturday, December 18, 2010

Tip for removing distributed directories in Linux

I needed to strip out the .svn folders from a project which was no longer version controlled. These appear in each folder of an svn hierarchy, so could be a lengthy job!

This did it in a second:
    find . -name .svn -exec rm -rf {} \;