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 {} \;

Sunday, December 5, 2010

Developing with Android Devices on Linux, the complete solution!

To summarise some previous posts regarding the process for getting Android adb to see your device in Linux (Mint/Ubuntu) and tie the whole lot up in a nice convenient script:

1 - create /etc/udev/rules.d/51-android.rules and add
  SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
    This assumes you're using an HTC phone. For more vendor IDs, see here

2 - execute
  sudo udevadm control --reload-rules
     to load the new android rule

3 - create restart_adb.sh and add the following:
  #!/bin/bash
  # android_device_reset script
  sudo /usr/bin/android/android-sdk-linux_86/tools/adb kill-server
  sudo service udev stop
  sudo /usr/bin/android/android-sdk-linux_86/tools/adb start-server
  sudo /usr/bin/android/android-sdk-linux_86/tools/adb devices
  eclipse

    Change your SDK path accordingly. 'eclipse' starts eclipse(!) so is of course optional.

4 - make your script executable:
  chmod 744 restart_adb.sh

5 - Bob's your uncle. Double-click your script to start eclipse and run your app/tests on a device rather than the emulator

An extra step for 64bit environments is:
  apt-get install ia32-libs


Thanks to Marc Cooper (@auxbuss) for help with the script

Saturday, December 4, 2010

Auto mounting of drives in Linux

Here's a nice GUI tool for managing the mounting of drives in Linux:
    sudo apt-get install pysdm

Saves faffing about in /etc/fstab

Sudo PATH problem

I was having problems getting sudo to see my Android adb tool. My own path was set correctly but sudo reported command not found. Putting the following in my /bashrc solved it:
    alias sudo env PATH=$PATH

Thanks to http://stackoverflow.com/questions/257616/sudo-changes-path-why/257666#257666

Additionally, if you want to go full blown superuser, execute
    su -p
The '-p' preserves your PATH for use as superuser

Saturday, November 27, 2010

Android adb on 64-bit Mint

For some reason, I have to kill and restart the adb server as root in order to be able to use my Android device for development. Otherwise, adb devices displays

    List of devices attached
    ???????????? no permissions

So:
    sudo su
    adb kill-server
    adb start-server
    adb devices
which displays:
    HT849KV01850    device

Don't forget you also need a .rules file in /etc/udev/rules.d - details here. Then execute
    sudo udevadm control --reload-rules

Might be worth a read next time I'm fight with Eclipse and SVN...

http://www.damonkohler.com/2009/07/make-eclipse-ignore-svn-directories.html

Monday, November 22, 2010

Android Dev on 64 bit

Don't forget to...
    apt-get install ia32-libs
...on 64 bit Linux machines when setting up an Android environment

Adding to PATH in a clean Linux Mint install

I needed to add the android sdk tools directory to my path in a clean Mint install. There was no existing ~/.bashrc or ~/.bash_profile. I tried creating a ~/.bash_profile and adding the path but it didn't work, but I had more success when I created a ~/.bashrc.

This is the line I added:
   export PATH=${PATH}:/usr/local/android-sdk-linux_x86/tools

atp-get vs aptitide

Just been reading about the difference between apt-get and aptitude under Debian based linux. Apparently, they do very much the same job but aptitude handles dependencies much better.

If you see a package has been held back when running sudo apt-get upgrade, try sudo aptitude upgrade and the package will probably be installed.

Sunday, November 14, 2010

Free online cartoonizer

For those occasions where you need a cartoon version of yourself!

Many sites provide this via a downloadable exe, but that's no good on Linux. This is 100% online!

http://www.converttocartoon.com/

Sunday, September 5, 2010

Ditched Ubuntu

I've ditched Ubuntu for Mint. We already have Mint running on the laptop downstairs. I am studying for the CompTIA Linux+ exam, and for that you need a Red Hat based system. OpenSUSE was horrible as a virtual machine so I thought I'd install it as a dual boot. To cut a long story short, Ubuntu ended up getting zapped (nothing important on there so no worries) and I had to reinstall. I made the decision to go with Mint...

I'll see how it goes, but I'm sure I'll be happy with Mint.

Installing VBoxAdditions on Linux

You need to install kernel headers in order to install VirtualBox Additions. To do this in Fedora, execute:
  su
  yum install kernel-devel-$(uname -r)

(sudo apt-get install linux-headers-$(uname -r) on Debian based systems)

The uname bit gets the correct version for your particular machine, otherwise you'd get the latest which may not be appropriate.

You may also need to install gcc and dkms to get the module to build:
  su
  sudo yum -y install dkms gcc

(sudo apt-get install dkms gcc on Debian based systems)

Thanks to: http://digitizor.com/2009/05/26/how-to-install-virtualbox-guest-additions-for-a-linux-guest/

Saturday, September 4, 2010

Ubuntu 10.04 and Tenda W311U wireless device

To get Ubuntu (or Mint) to play with the Tenda W311U device, just add rt2870sta to the end of /etc/modules:

  sudo su
  echo rt2870sta >> /etc/modules
  exit

Remove the device before rebooting and reinsert.

Thanks to the guys here - http://ubuntuforums.org/showthread.php?t=1444925

Wednesday, August 11, 2010

Dynamode Router Advanced login

The web address tpo get to the advanced setup pages on the Dynamode R-ADSL-C4W-EG - wireless router is http://192.168.1.1/html/index1.html

Tuesday, June 8, 2010

Resolving host problem in Ubuntu

There is a problem in Ubuntu where browsers will hangs for a few seconds, displaying "resolving host..." before displaying your requested page (this was one of the reasons I aborted a previous flirtation with linux). It is connected with DNS and IPv6 apparently.

Anyway, I've found a cure, here. Basically it involved using Google's DNS servers - I was using my routers originally.

Sunday, June 6, 2010

Upgrading Ubuntu

Decided to upgrade from 9.04 to 10.04. Apparently it's advisable to go to 9.10 first but this wasn't being offered as an upgrade path in the package manager.

Found a useful post here. Basically, hit Alt+F2, enter "update-manager -d" and the update manager will show the upgrade to 9.10.

Saturday, May 29, 2010

Killing a daemon in Ubuntu

To kill the ushare daemon:
  start-stop-daemon --signal KILL --stop --name ushare

Friday, May 28, 2010

Setting up Ubuntu - media server

So I'm studying the Open University's Linux course, T155. I decided that rather than sit at the desktop computer whilst studying this (like I did for 6 years and 8 months when doing my OU degree), I'd use my wife's laptop downstairs. It's only a ten week course, and I'm pretty sure I already know a fair bit on basic Linux stuff, so an isolated study environment is not necessary.

However, the laptop runs Windows Vista. I've only ever used it to check my emails etc on this laptop, and any OS can manage that. But, heaven forbid, I now need to use it for a little more than that, e.g. access a shared drive, move files around and use Virtual Box to run Ubuntu.

To cut a long story short... it's painful. I've actually found myself feeling real anger whist watching the little circle thingy that spins round when Vista is working out how to open a folder. So I've partitioned the hard drive and whacked Ubuntu straight on as a 'proper' OS. My intention is to completely move away from Windows, but we'll see how it goes... I need to make sure everything is as accessable as in Windows as other people need to use this laptop too. I also need to ensure there are ways to do all the stuff I do in Windows.

One of these things is to stream media to my XBox360, a task handled admirably by Tversity under Windows. Alas, there is no Linux version as yet, so the search started for an alternative. There are a number of choices, but the one that seems to work for me best is uShare. This is a really simple, lightweight UPnP application. As the title of this blog suggests, I'm going to log stuff I don't want to forget in case I need to do it again, so here are the steps I took to get uShare working in Ubuntu 9.04:
  1. download and install uShare. The easiest way to do this is via the Synaptic Package Manager GUI
  2. we need to state which files to share. Edit the ushare.conf file in /etc (I'm going to do what I wish others would do and assume people don't know much about working with the Linux terminal, so here are the exact steps):
    • sudo gedit /etc/ushare.conf
    • change the USHARE_DIR= to point to directories you want to share, eg USHARE_DIR=/home/john/Documents/Videos
    • change the ENABLE_XBOX line to read ENABLE_XBOX=yes
  3. You can start uShare in the terminal with:
    • ushare start
  4. And that's it!

I wasn't quite satisfied with this, as I wanted to have the media server start automatically after booting up - I don't want to have to explain to others that they need to open a terminal and execute commands to be able to watch a film!

After Googling, it was plain to see this was not a trivial task. There were loads of results on how to configure Linux to start uShare automatically, but none of them worked for me. After hours of trying, I ended up using one of the first tips I'd read (sorry - can't remember the link). I created a file with:

  sleep 30
  ushare -x

in it. (I found it wouldn't work without the sleep bit. I suspect uShare was starting before my wireless network was up and running, deciding something was wrong and bombing out, so I gave it a 30 second 'rest'). I then made it executable:
  • right click the file
  • select properties
  • open the permissions tab
  • check "Allow executing file as program".
You now make an entry in the list of startup applications:
  • go to System | Preferences | Startup Applications
  • click "Add"
  • give it a name
  • browse to your new file
  • add a description if you want
Hey presto, uShare will now start automatically.