tag:blogger.com,1999:blog-4074180944460945272024-02-07T08:40:17.352+00:00linux :: xunilCollected linux snippetsAnonymoushttp://www.blogger.com/profile/13257376651929417526noreply@blogger.comBlogger104125tag:blogger.com,1999:blog-407418094446094527.post-56155110079347570382011-04-02T12:34:00.009+01:002011-04-02T14:03:37.048+01:00Starting a rails project<blockquote></blockquote>This is just a quick reminder about how to start a standard rails project. The assumption is that rvm already installed on an Ubuntu machine (I'm using Natty).<div><ul><li>mkdir projects</li><li>cd projects</li><li>rails new project_name -T</li><li>echo "rvm --create use 1.9.2@project_name" > .rvmrc</li><li>cd project_name</li><li>(agree to the use of the .rvmrc file)</li></ul><div>My default Gemfile at the moment takes into account that I'll be creating a general API and will be using rspec (I tend to use rspec for integration testing too). It includes spork and autotest for a cool autotest environment.</div></div><div><ul><li>(create the following Gemfile)</li><li>gem install bundler</li><li>bundle install</li></ul></div><div><div></div><blockquote><div>source 'http://rubygems.org'</div><div><br /></div><div>gem 'rails', '3.0.1'</div><div>gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3'</div><div>gem 'gravatar_image_tag', '0.1.0'</div><div>gem 'will_paginate', '3.0.pre2'</div><div><br /></div><div>group :development do</div><div> gem 'rspec-rails', '2.0.1'</div><div> gem 'annotate-models', '1.0.4'</div><div> gem 'faker', '0.3.1'</div><div>end</div><div><br /></div><div>group :test do</div><div> gem 'rspec', '2.0.1'</div><div> gem 'webrat', '0.7.1'</div><div> gem 'spork', '0.9.0.rc4'</div><div> gem 'libnotify', '0.3.0'</div><div> gem 'factory_girl_rails', '1.0'</div><div>end</div></blockquote>Add the inital state of the framework to git. Take the opportunity to create a project at github and upload your public key (so that you can push up the project).</div><div><ul><li>git init</li><li>git add .</li><li>git commit -am "Initial commit of Rails framework"</li><li>git remote add origin git@github.com:username/project_name.git</li><li>git push origin master</li></ul><div>Then create a project at heroku (goto heroku.com and sign up) - you may need to install the heroku gem (gem install heroku)</div><ul><li>heroku create</li><li>git push heroku master</li><li>heroku rename project-name #you can't use _ so, I tend to use - instead here</li></ul><div>Finally, it's time to get rspec installed</div></div><div><ul><li>rails generate rspec:install</li></ul><div>Get some generate setup done for static pages:</div></div><div><ul><li><b>remove</b> public/index.html</li><li><b>add</b> public/stylesheet/blueprint</li><li><b>add </b>public/stylesheet/custom.css #see rails3tutorial</li><li>rails generate controller Pages home contact about</li></ul><div>Add some autotesting</div><div><ul><li>sudo apt-get install libnotify-bin </li><li>echo "require 'autotest/growl'" >> .autotest</li><li>spork --bootstrap</li><li><b>edit</b> spec/spec_helper.rb to contain the contents of Listing 3.13 from the <a href="http://ruby.railstutorial.org/chapters/static-pages#sec:spork">Rails3Tutorial Book</a></li><li><a href="http://ruby.railstutorial.org/chapters/static-pages#sec:spork"></a>echo "--drb" >> .rspec</li><li>create /usr/local/bin/runautotest</li></ul></div><div><div><blockquote></blockquote><blockquote>spork&<br />sleep 10s<br />autotest</blockquote></div><div><blockquote></blockquote><ul><li>sudo chmod +x /usr/local/bin/runautotest</li></ul><div><br /></div></div></div></div>Anonymoushttp://www.blogger.com/profile/13257376651929417526noreply@blogger.com0tag:blogger.com,1999:blog-407418094446094527.post-10064779926676475442011-03-13T19:02:00.004+00:002011-03-13T19:07:00.762+00:00Git: upgrading to parent<div>I have a fork of a GIT project. The parent had got ahead of my local repro by quite a bit, so I wanted to pull in all those changes. </div><div><ul><li>cd [child-local-dir]</li><li>git remote add parent [parent-url]</li><li>git pull parent [stable]</li></ul>Clearly, if you want a different branch, you can specify that.</div><div><br /></div><div>Once it's local, if you have a remote location for your repro (such as github) just </div><div><ul><li>git push</li></ul></div>Anonymoushttp://www.blogger.com/profile/13257376651929417526noreply@blogger.com0tag:blogger.com,1999:blog-407418094446094527.post-46109895978455551582011-03-12T12:03:00.002+00:002011-03-12T12:18:25.986+00:00Natty installWe've moved into Alpha3 and beyond and I've been running a distribution upgrade from Maverick for a while now. So, I took the opportunity to test a clean install this morning and it's been a huge success.<div><br /></div><div><b>A:</b><br /><div><ul><li>Downloaded the alpha3 .iso and burnt it to disc.</li><li>Shoved it in the drive and watched it do it's stuff</li><li>Selected "get updates" and "install restricted drivers"</li><li>Before long it was installed and ready to go (am liking the new Unity interface)</li></ul><div><b>B: </b></div><div>Mount the various partitions. I'd previously set up my machine so that the main drive is partitioned into:</div></div><div><ul><li>sda1: 50Gb - Windows</li><li>sda2: 50Gb - Linux</li><li>sda3: the rest - data</li></ul><div>So, after doing a clean install onto sda2, I mounted sda3 to /home and another drive to /backup.</div></div><div><ul><li>Create the folders that you want to mount the drives to</li><li>List your drives to make sure you know where they are: "sudo fdisk -l"</li><li>Test that they mount okay: "mount /dev/sda3 /home"</li><li>Add a link to /etc/fstab "/dev/sda3/ /home defaults 0 0"</li><li>Remove the previous mount: "sudo umount /home"</li><li>Use fstab to mount all: "sudo mount -a"</li></ul><div><b>C:</b></div><div>Install some helpful programs</div></div><div><ul><li>sudo apt-get install joe guake geany gdebi</li></ul><div>Install some programs from downloaded debs: for some reason, installing them with the software centre triggers an error in alpha, so I just used gdebi to install them and everything worked fine. With ~/.chrome unaffected by the reinstall, all the previous settings were preserved.</div></div><div><ul><li>chrome</li><li>dropbox</li><li>skype</li></ul></div><div>Install Crashplan (ensuring that the jre from the restricted extras in installed). Adopt the old version of the machine so that a new seed of data isn't required. Copy over CrashPlanRemote (see previous blog post).</div></div><div><br /></div><div><b>D:</b></div><div>Setup apache, PHP, mysql etc.</div><div><ul><li>sudo apt-get install php5 apache2 mysql-server phpmyadmin</li></ul><div>Copy over /etc/hosts and the config files from sites-available and then use "sudo a2ensite blah" to enable them; follow that with a "sudo /etc/init.d/apache2 reload" and everything should be working. Import data into mysql.</div></div><div><br /></div><div><b>E:</b></div><div>Passwordless login is key to great workflow. Because ~ was preserved (on a partition unaffected by the reinstall), my ~/.ssh directory was unchanged. So, after /etc/hosts was reinstated, passwordless login was back up and running.</div><div><br /></div><div>All in all - a complete reinstall in less than 2 hours!</div>Anonymoushttp://www.blogger.com/profile/13257376651929417526noreply@blogger.com0tag:blogger.com,1999:blog-407418094446094527.post-39480341287999971592011-02-22T11:19:00.002+00:002011-02-22T11:37:16.020+00:00Mysql backupsI have found the most wonderful tool for backing up mysql databases. It's not new... it's just that I've only found it recently!<div><br /></div><div><a href="http://sourceforge.net/projects/automysqlbackup/">automysqlbackup </a>does exactly what is says on the tin - it backs up your mysql database. There are some <a href="http://www.debianhelp.co.uk/mysqlscript.htm">great todos</a>, but I thought I'd post what I did on out Plesk servers so that I've got it noted down for the future!</div><div><ul><li>sudo -s</li><li>mkdir /var/mysql</li><li>mv automysqlbackup /usr/local/bin/</li><li>ln -s /usr/local/bin/automysqlbackup /etc/cron.daily/automysqlbackup</li><li>joe /etc/crontab (edit the time that the daily cron takes place and save)</li></ul><div>When setting up automysqlbackup, these are the settings I used:</div></div><div><div><div><span class="Apple-style-span"></span></div></div><blockquote><div><div><span class="Apple-style-span">### START CFG ###</span></div><div><span class="Apple-style-span"># Username to access the MySQL server e.g. dbuser</span></div><div><span class="Apple-style-span">USERNAME=admin</span></div><div><span class="Apple-style-span"><br /></span></div><div><span class="Apple-style-span"># Password to access the MySQL server e.g. password</span></div><div><span class="Apple-style-span">PASSWORD=YourAdminPasswordForPlesk</span></div></div><div><span class="Apple-style-span"><br /></span></div><div><span class="Apple-style-span"># Host name (or IP address) of MySQL server e.g localhost</span></div><div><div><span class="Apple-style-span">DBHOST=localhost</span></div><div><span class="Apple-style-span"><br /></span></div><div><span class="Apple-style-span"># List of DBNAMES for Daily/Weekly Backup e.g. "DB1 DB2 DB3"</span></div><div><span class="Apple-style-span">DBNAMES="all"</span></div><div><span class="Apple-style-span"><br /></span></div><div><span class="Apple-style-span"># Backup directory location e.g /backups</span></div><div><span class="Apple-style-span">BACKUPDIR="/var/mysql/"</span></div><div><span class="Apple-style-span"><br /></span></div><div><span class="Apple-style-span"># Mail setup</span></div><div><span class="Apple-style-span"># What would you like to be mailed to you?</span></div><div><span class="Apple-style-span"># - log : send only log file</span></div><div><span class="Apple-style-span"># - files : send log file and sql files as attachments (see docs)</span></div><div><span class="Apple-style-span"># - stdout : will simply output the log to the screen if run manually.</span></div><div><span class="Apple-style-span"># - quiet : Only send logs if an error occurs to the MAILADDR.</span></div><div><span class="Apple-style-span">MAILCONTENT="log"</span></div><div><span class="Apple-style-span"><br /></span></div><div><span class="Apple-style-span"># Set the maximum allowed email size in k. (4000 = approx 5MB email [see docs])</span></div><div><span class="Apple-style-span">MAXATTSIZE="4000"</span></div><div><span class="Apple-style-span"><br /></span></div><div><span class="Apple-style-span"># Email Address to send mail to? (user@domain.com)</span></div><div><span class="Apple-style-span">MAILADDR="support@domain.com"</span></div><div><span class="Apple-style-span"><br /></span></div><div><span class="Apple-style-span"># ============================================================</span></div><div><span class="Apple-style-span"># === ADVANCED OPTIONS ( Read the doc's below for details )===</span></div><div><span class="Apple-style-span">#=============================================================</span></div><div><span class="Apple-style-span"><br /></span></div><div><span class="Apple-style-span"># List of DBBNAMES for Monthly Backups.</span></div><div><span class="Apple-style-span">MDBNAMES="${DBNAMES}"</span></div><div><span class="Apple-style-span"><br /></span></div><div><span class="Apple-style-span"># List of DBNAMES to EXLUCDE if DBNAMES are set to all (must be in " quotes)</span></div><div><span class="Apple-style-span">DBEXCLUDE=""</span></div><div><span class="Apple-style-span"><br /></span></div><div><span class="Apple-style-span"># Include CREATE DATABASE in backup?</span></div><div><span class="Apple-style-span">CREATE_DATABASE=no</span></div><div><span class="Apple-style-span"><br /></span></div><div><span class="Apple-style-span"># Separate backup directory and file for each DB? (yes or no)</span></div><div><span class="Apple-style-span">SEPDIR=yes</span></div><div><span class="Apple-style-span"><br /></span></div><div><span class="Apple-style-span"># Which day do you want weekly backups? (1 to 7 where 1 is Monday)</span></div><div><span class="Apple-style-span">DOWEEKLY=6</span></div><div><span class="Apple-style-span"><br /></span></div><div><span class="Apple-style-span"># Choose Compression type. (gzip or bzip2)</span></div><div><span class="Apple-style-span">COMP=gzip</span></div></div><div><br /></div><div><div><span class="Apple-style-span"># Compress communications between backup server and MySQL server?</span></div><div><span class="Apple-style-span">COMMCOMP=no</span></div><div><span class="Apple-style-span"><br /></span></div><div><span class="Apple-style-span"># Additionally keep a copy of the most recent backup in a seperate directory.</span></div><div><span class="Apple-style-span">LATEST=yes</span></div><div><span class="Apple-style-span"><br /></span></div><div><span class="Apple-style-span"># The maximum size of the buffer for client/server communication. e.g. 16MB (maximum is 1GB)</span></div><div><span class="Apple-style-span">MAX_ALLOWED_PACKET=</span></div><div><span class="Apple-style-span"><br /></span></div><div><span class="Apple-style-span"># For connections to localhost. Sometimes the Unix socket file must be specified.</span></div><div><span class="Apple-style-span">SOCKET=</span></div><div><span class="Apple-style-span"><br /></span></div><div><span class="Apple-style-span"># Command to run before backups (uncomment to use)</span></div><div><span class="Apple-style-span">#PREBACKUP="/etc/mysql-backup-pre"</span></div><div><span class="Apple-style-span"><br /></span></div><div><span class="Apple-style-span"># Command run after backups (uncomment to use)</span></div><div><span class="Apple-style-span">#POSTBACKUP="/etc/mysql-backup-post"</span></div><div><span class="Apple-style-span">### END CFG ###</span></div></div></blockquote><div><div><span class="Apple-style-span"></span></div></div></div>Anonymoushttp://www.blogger.com/profile/13257376651929417526noreply@blogger.com2tag:blogger.com,1999:blog-407418094446094527.post-33692804904191133392011-02-22T11:11:00.006+00:002011-02-22T11:37:43.788+00:00Plesk, Backup and CrashplanFinally, I think I've found a good solution for Plesk and backup. For ages, I've been trying to find ways of efficiently backing up server data (www, mail mysql) and have tried to the Plesk solution, TotalBackup from 4psa and other rsync methods. To date, they all create a massive amount of data.<div><br /></div><div><a href="http://www.4psa.com/index.php?pag=4psatbackup&pcat=products">TotalBackup</a> has served us okay. It does manage a backup of the whole server and then performs daily deltas, but each week, we still have a massive backup split up into 1000Mb files moving from server to server to facilitate an offline backup solution. And, potentially, with a server going down, we're still 24 hours out of date. Added to that, the restore process (which needs to knit all the parts of the backup together, apply the deltas and then unzip it, before offering the chance to actually get at your files) and we're in a position that doesn't really allow us the best backup/restore cycle.</div><div><br /></div><div>I've been using Crashplan at home for a while now and love the product (especially after seeing what <a href="http://community.mozy.com/t5/My-Account/New-MozyHome-Plans/m-p/20279">Mozy did with their pricing strategy</a> and <a href="http://www.crashplan.com/switcher/">Crashplan promise not to do the same</a>).</div><div><br /></div><div>So, why not use the same technology with the servers... that's the plan, and that's what I've been spending the last couple of days thinking about. The plan is to backup:</div><div><ul><li>/var/www/vhosts (where all the www data is)</li><li>/var/qmail/mailnames (where all the mail is)</li><li>/var/mysql/latest (where my latest mysql db backups are)</li></ul><div>For more information about the mysql backup process, see the <a href="http://linuxhints.blogspot.com/2011/02/mysql-backups.html">separate post</a>.</div></div><div><div><span class="Apple-style-span"></span></div></div><div><br /></div>Anonymoushttp://www.blogger.com/profile/13257376651929417526noreply@blogger.com0tag:blogger.com,1999:blog-407418094446094527.post-63673926975083016432011-02-22T10:23:00.003+00:002011-02-22T10:42:30.931+00:00Putty tunnels<a href="http://linuxhints.blogspot.com/2011/02/crashplan-headless.html">In a previous post</a>, I was talking about getting a headless instance of <a href="http://www.crashplan.com/">Crashplan </a>setup on an Ubuntu server and then administrating it from a local machine (in that case, Ubuntu). However, I needed to do a similar thing with a windows machine.<div><br /></div><div><a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html">Get putty</a>: the best (maybe only) SSH client worth having on Windows.</div><div><br /></div><div>On the <a href="http://support.crashplan.com/doku.php/how_to/configure_a_headless_client">support page at Crashplan</a>, there is some discussion about how to use putty to create the remote connection via a tunnel, but either I'm daft, or it's not quite explicit enough. So, here's a little reminder about creating tunnels using putty.</div><div><br /></div><div>Make sure that the Crashplan desktop client is not open (the tray icon can continue to run in the background).</div><div><br /></div><div><b>Change the config</b></div><div><ul><li>edit C:\Program Files\CrashPlan\conf\uk.properties</li><li>uncomment the servicePort line and make sure it reads <b>servicePort=4200</b></li><li>save the file</li></ul><div>NB. Have just found <a href="http://notepad-plus-plus.org/">Notepad++</a> which is a great little replacement for notepad.</div></div><div><br /></div><div><b>Create the tunnel</b></div><div><ul><li>open putty</li><li>in the first screen, enter the server details (as you would if just SSHing normally)</li><li>now in the left hand column, under "Connection" and then "SSH" is a tab helpfully titled "Tunnels"</li><li>in the source port box, type 4200</li><li>in the destination box, type localhost:4243</li><li><b>click Add</b> (don't forget to do this bit!)</li><li>finally, click Open</li><li>log in with your normal user credentials</li></ul><div>Check that the port is open</div></div><div><ul><li>Start -> Run</li><li>cmd</li><li>telnet localhost 4200 (should not get a message that talks about failed connection)</li></ul><div>Open Crashlpan - and you should get a remote connection over an SSH tunnel.</div></div><div><br /></div><div>Once you're finished, change back the config file and close the putty session which will close the tunnel.</div>Anonymoushttp://www.blogger.com/profile/13257376651929417526noreply@blogger.com0tag:blogger.com,1999:blog-407418094446094527.post-21076643655874351772011-02-22T09:46:00.001+00:002011-02-22T09:46:44.630+00:00Missing desktop notification link<div xmlns='http://www.w3.org/1999/xhtml'><p>When you visit <a href='http://mail.google.com'>mail.google.com</a>, you should get a helpful hint at the top of the page that relates to the new desktop notifications (which are very cool). <br/><br/>"Click here to enable desktop notifications in Google".<br/><br/>However, while there are links to "Learn more" and "Hide", there is no actual link to setup notification. There *should be* a link to the settings page where you can actually set up notifications.</p>in reference to: <a href='http://mail.google.com/support/bin/answer.py?hl=en-GB&ctx=mail&answer=1075549'>Desktop notifications in Chrome - Gmail Help</a> (<a href='http://www.google.com/sidewiki/entry/drjermy/id/q4xWeCB23RjjitoN45bcnQFjw5U'>view on Google Sidewiki</a>)</div>Anonymoushttp://www.blogger.com/profile/13257376651929417526noreply@blogger.com0tag:blogger.com,1999:blog-407418094446094527.post-69142883443078239092011-02-18T12:41:00.005+00:002011-03-12T11:59:40.898+00:00Crashplan headlessI've <a href="http://linuxhints.blogspot.com/2011/02/crashplan-remote-management.html">previously mentioned</a> my desire to get headless backups working with Crashplan. However, it wasn't quite right. So, I spent some more time this morning trying to get it working simply and well.<div><br /></div><div>Before I start, here are the references to the work completed:</div><div><ul><li><a href="http://www.unixmen.com/linux-tutorials/290-install-crashplan-backup-tool-in-linux-">Installing Crashplan remotely</a></li><li><a href="http://support.crashplan.com/doku.php/how_to/configure_a_headless_client">Using a headless server</a></li><li><a href="http://forrst.com/posts/Remote_Access_for_CrashPlan_headless_server_wi-0ot">Helpful remote access script for Crashplan</a></li></ul><div><b>Setup the remote server</b></div></div><div><br /></div><div>Install the Java virtual machine - don't use openJRE</div><div><div><blockquote>sudo apt-get install sun-java6-jre</blockquote></div><div>Accept the licence</div><div>Goto the <a href="http://www.crashplan.com/consumer/download.html?os=Linux">crashplan download site</a> and find out the URL of the latest version</div><div><br /></div><div>Get the crashplan archive, extract it and change directory</div><div></div><blockquote><div>wget http://download.crashplan.com/installs/linux/install/CrashPlan/CrashPlan_3.0.2_Linux.tgz</div><div>tar -zxvf CrashPlan_3.0.2_Linux.tgz</div><div>cd CrashPlan-install</div><div></div></blockquote><div>Install Crashplan as root (if you want access to all directories)</div><div></div><blockquote><div>sudo -s</div><div>./install.sh</div></blockquote><div></div><div>Complete the install process</div><div><ul><li>Read the EULA</li><li>Hit q to exit the EULA and then agree to it</li><li>Accept the default locations for the binaries, backups and scripts</li></ul>Finish off the remote install process<br /><ul><li>Remove the downloaded files</li><li>Firewall: open up port 4243 on the remote machine</li></ul><div><b><br /></b></div><div><b>Setup the local machine</b></div><div><br /></div><div>To administrate the remote machine, we will be port forwarding via ssh 4200 to 4243 and then using the desktop GUI.</div><div><br /></div><div>Copy and paste the following script into crashplan/bin/CrashPlanRemote (which is usually in /usr/local/ on Ubuntu).</div><div><div></div><blockquote><div>#!/bin/bash</div><div><br /></div><div># Do we have the appropriate input?</div><div>if [ -z "$1" ]; then</div><div> echo usage: $0 remote-server</div><div> exit</div><div>fi</div><div><br /></div><div># fill in your stuff here:</div><div>USER=jeremy</div><div>SERVER=$1</div><div><br /></div><div># dont change anything down here</div><div>ssh -fnNTL 4200:localhost:4243 ${USER}@${SERVER}</div><div>PID=$!</div><div><br /></div><div># get CrashPlan folder</div><div>SCRIPT=$(ls -l $0 | awk '{ print $NF }')</div><div>SCRIPTDIR=$(dirname $SCRIPT)</div><div>TARGETDIR="$SCRIPTDIR/.."</div><div>cd ${TARGETDIR}</div><div><br /></div><div>#change CrashPlan config to use the tunnel</div><div>sed 's/#servicePort=4200/servicePort=4200/g' ${TARGETDIR}/conf/ui.properties > /tmp/CrashPlan-ui.properties</div><div>cp /tmp/CrashPlan-ui.properties ${TARGETDIR}/conf/ui.properties</div><div>rm /tmp/CrashPlan-ui.properties</div><div><br /></div><div>#CrashPlan start script - begin</div><div>. ${TARGETDIR}/install.vars</div><div>. ${TARGETDIR}/bin/run.conf</div><div>${JAVACOMMON} ${GUI_JAVA_OPTS} -classpath "./lib/com.backup42.desktop.jar:./lang:./skin" com.backup42.desktop.CPDesktop > ${TARGETDIR}/log/ui_output.log 2 > ${TARGETDIR}/log/ui_error.log</div><div>#CrashPlan start script - end</div><div><br /></div><div>#change CrashPlan config back to default</div><div>sed 's/servicePort=4200/#servicePort=4200/g' ${TARGETDIR}/conf/ui.properties > /tmp/CrashPlan-ui.properties</div><div>cp /tmp/CrashPlan-ui.properties ${TARGETDIR}/conf/ui.properties</div><div>rm /tmp/CrashPlan-ui.properties</div><div><br /></div><div>#kill (every 4200) tunnel</div><div>CMD="ps -eo pid,args | grep 'ssh -fnNTL 4200:localhost:4243' | grep -v 'grep' | cut -c1-6"</div><div>PID=`eval $CMD`</div><div>kill -9 $PID</div></blockquote><div></div></div><div>Now create a link from somewhere in your path, so that you can run it with the command CrashPlanRemote</div><div><blockquote>chmod +x /usr/local/crashplan/bin/CrashPlanRemote</blockquote><blockquote>sudo ln -s /usr/local/crashplan/bin/CrashPlanRemote /usr/local/bin/CrashPlanRemote</blockquote></div><div>And that should be it!</div></div></div><div><ul><li>CrashPlanRemove server.name.here</li></ul><div>NB. it's best to have setup passwordless login to the remote server</div></div><div><ul><li>/etc/hosts: add a line with the IP address and full.domain.name</li><li>ssh-copy-id -i ~/.ssh/id_rsa.pub full.domain.name</li></ul></div>Anonymoushttp://www.blogger.com/profile/13257376651929417526noreply@blogger.com2tag:blogger.com,1999:blog-407418094446094527.post-40858976377725146232011-02-06T16:14:00.000+00:002011-02-06T16:15:19.121+00:00Crashplan remote managementA really helpful how to for managing a remote version of Crashplan on a headless server.<br /><br /><div><a href="http://innerfusion.tumblr.com/post/616874889/setup-crashplan-to-manage-remote-clients-in-7-steps">http://innerfusion.tumblr.com/post/616874889/setup-crashplan-to-manage-remote-clients-in-7-steps</a></div>Anonymoushttp://www.blogger.com/profile/13257376651929417526noreply@blogger.com0tag:blogger.com,1999:blog-407418094446094527.post-26659128658487027572010-09-17T19:52:00.004+01:002010-09-17T20:48:01.940+01:00Ripping DVDs and UbuntuI've been mucking around now for a while trying to work out the best way to rip and encode DVDs.<div><br /></div><div>I tried using Handbrake for a while to rip and encode, but what I really want is something that just does it in the background. On the mac, RipIt is a great tool for ripping the DVD to the HDD allowing you to go back at your leisure and encode it.</div><div><br /></div><div>What i really want is a solution that will autorip on DVD tray-close (like RipIt on the mac) and then a cron that will encode. This is a post about how I get on.</div><div><br /></div><div>First, we'll need to add <a href="https://help.ubuntu.com/community/RestrictedFormats/PlayingDVDs">restricted formats</a>:</div><div><ul><li>sudo apt-get install libdvdread4</li><li>sudo /usr/share/doc/libdvdread4/install-css.sh</li></ul><div>Now, install dvdbackup</div></div><div><ul><li>sudo apt-get install dvdbackup</li></ul><div>Create a directory to put the ripped DVDs into and enter it and execute the command to rip the DVD:</div></div><div><ul><li>mkdir Ripped</li><li>cd Ripped</li><li>dvdbackup -M</li></ul><div>You can also use the -F option rather than -M to just get the main feature, but I had bother with using handbrakeCLI to encode after doing that. Also use the -v flag to give a bit more output.</div><div><br /></div><div>And, to eject, just use the command</div><div><ul><li>eject</li></ul></div><div>So, now we need to work out how to do that automatically when a DVD is inserted into the machine. In the perfect world, we'd do that using the terminal only so that it could run flawlessly on a headless server.</div></div><div><div><br /></div></div><div><b>Handbrake</b></div><div><b><br /></b></div><div>We need to install handbrake from a PPA.</div><div><ul><li>sudo add-apt-repository ppa:handbrake-ubuntu/ppa</li><li>sudo apt-get update && sudo apt-get install handbrake-cli</li></ul><div>Then, it's a simple hop skip and a jump to a simple <a href="http://trac.handbrake.fr/wiki/CLIGuide">CLI command</a> to encode the ripped disc using a preset for "<a href="http://trac.handbrake.fr/wiki/BuiltInPresets#film">Film</a>"</div></div><div><ul><li>HandBrakeCLI -i 21/ --main-feature -o 21.mp4 --preset="Film"</li></ul></div><div>Amazingly, this encoded the film at, on average, 280fps (granted, I'm running a quad core AMD monster), but still! I'd tried this on the Mac, using the GUI version and was getting an encode with an average fps of about 9!</div><div><ul><li><br /></li></ul></div>Anonymoushttp://www.blogger.com/profile/13257376651929417526noreply@blogger.com3tag:blogger.com,1999:blog-407418094446094527.post-86266719144765191572010-09-05T16:19:00.006+01:002010-09-05T17:29:42.712+01:00Drweb and pleskI have been getting some really irritating emails for a couple of weeks from Plesk... actually, it's been a bit longer than that, but I just filtered them out via a gmail auto-delete - probably not the best way to deal with the situation!<div><br /></div><div>What's strange it that I didn't even have dr-web installed. A couple of searches on google revealed a <a href="http://serverfault.com/questions/80254/how-can-i-disable-drweb-update-notifications-and-why-cant-maildir-be-found">helpful page on serverfault.com</a> which suggested that diabling the update call in the drweb-update cron would be helpful.</div><div><br /></div><div>So:</div><div><ul><li>sudo touch var/log/drwebupdate.log</li><li>sudo joe /etc/cron.d/drweb-update</li><li>a<span><span>dd ">> /var/log/drwebupdate.log" to the l</span></span>ine that has update.pl</li><li>save the file...</li></ul><div><br /></div></div>Anonymoushttp://www.blogger.com/profile/13257376651929417526noreply@blogger.com0tag:blogger.com,1999:blog-407418094446094527.post-60521812072651172162010-07-13T09:15:00.002+01:002010-07-13T09:17:55.142+01:00tbackup and PleskI just installed tbackup from 4psa for Plesk. It installed fine and the licence was installed without a problem. However, every time I tried to set it up, it said that the directory that the backups were to be saved to didn't exist.<br /><br />Problem was that the debs are for 32-bit systems and the system is 64-bit. A helpful tech from 4psa kindly informed me that the ia32-libs package needed installing.<br /><blockquote>sudo apt-get install ia32-libs</blockquote><br />And everything works fine.Anonymoushttp://www.blogger.com/profile/13257376651929417526noreply@blogger.com0tag:blogger.com,1999:blog-407418094446094527.post-68988899821740367302010-06-14T10:12:00.010+01:002010-06-14T12:40:17.693+01:00Rhodes + Android + Eclipse + Ubuntu 10.4In an attempt to start using <a href="http://rhomobile.com/products/rhodes/">Rhodes</a> to build an Android app, I'm building my local dev environment, hence the title "Rhodes + Android + Eclipse + Ubuntu 10.4".<div><br /></div><div>Handy pages:</div><div><ul><li><a href="http://blogs.icspot.com/cto/?p=3">installing rhones on Ubuntu 8.04</a></li><li><a href="http://wiki.rhomobile.com/index.php/Building_Rhodes_Apps_on_Supported_Platforms#Prerequisites_-_All_Platforms">building rhodes apps</a></li><li><a href="http://wiki.rhomobile.com/index.php/Tutorial2">first rhodes tutorial</a></li></ul><div><b>Installing ruby and some essentials</b></div><div><br /></div><div>So.. let's start at the beginning, we'll need Ruby, rails and rubygems (which is now in the repros - change the X.X below for the latest version - use tab-complete to the the options).</div></div><div><blockquote>sudo apt-get install ruby-full build-essential rubygemsX.X </blockquote><div><b>Installing rhodes</b></div><div><br /></div>Once we have done that, let's get rhodes (version 2.0 is currently in beta)</div><div><blockquote>sudo gem install templater<br />sudo gem install rake<br />sudo gem install rails<br />sudo gem install rhodes --pre</blockquote></div><div>Irritatingly, the apt-get install of rubygems doesn't add the path of the gems that we later installed to the PATH... <a href="https://bugs.launchpad.net/ubuntu/+source/gems/+bug/145267">doh</a>! Have a look where rubgems has been installed to - should be something like "/usr/lib/gems/1.9.1/" although the last directory name will clearly depend on what version you installed above. Open up ~/.bashrc and add (thanks to <a href="http://adamtao.wordpress.com/2009/05/06/setting-up-ubuntu-for-ruby-on-rails-development/">adamtao</a>):</div><blockquote><div>PATH = "${PATH}":/var/lib/gems/1.9.1/bin</div><div>export PATH</div></blockquote><div>You also need to install eclipse and the Android <a href="http://developer.android.com/sdk/index.html">SDK</a> and <a href="http://developer.android.com/sdk/ndk/index.html">NDK</a>. I'm not going to list the routine for getting it done since it's explained well <a href="http://wiki.rhomobile.com/index.php/Building_Rhodes_Apps_on_Supported_Platforms#Android">elsewhere</a>. Setup for android development including getting all the files from the android development site. Setup an Android AVD (Android virtual device) and test the emulator with a simple hello world script.</div><div><br /></div><div><b>Setting up rhodes</b></div><div><br /></div><div>Now we need to link our rhodes installation to the SDK and eclipse.</div><div><blockquote>rhodes-setup</blockquote></div><div>You'll be prompted with questions - my answers are below:</div><div><ul><li>JDK path: /usr/lib/jvm/java-6-openjdk/</li><li>Android SDK path: /opt/androidSDK/</li><li>Android NDK path: /opt/androidNDK/</li><li>the remainder of the questions related to Windows and Blackberry: (left blank)</li></ul></div><div>Helpful way to find paths is to either look in your path (echo $PATH) or use "locate" (locate java > java_list) and then look in the java_list file that has just been created.</div><div><br /></div><div>Create a soft link to the rhodes directory:</div><div><blockquote>sudo ln -s /var/lib/gems/1.9.1/gems/rhodes-2.0.0.beta9/ /var/lib/rhodes</blockquote></div><div><b>First application</b></div><div><br /></div><div>So, for now, I'm going to work via the command line and with gedit to edit files; using <a href="http://wiki.rhomobile.com/index.php/Tutorial2">tutorial2</a> as a starting point:</div><div><ul><li>rhogen app testapp</li><li>cd testapp</li><li>joe build.yml<br />I wanted to remove the iphone refs and add in some android ones</li></ul><blockquote><div>sdk:"/var/lib/gems/1.9.1/gems/rhodes-2.0.0.beta9"</div><div>sdkversion: 2.0.0</div><div>name: testapp</div><div>version: 1.0</div><div>vendor: rhomobile</div><div>build: debug</div><div>bbver: 4.6</div><div>applog: rholog.txt</div><div>android:</div><div> version: 2.1</div><div>extensions: ["extension-name-here", "second-extension-name"]</div></blockquote><ul><li>rake run:android</li></ul><div>You'll be asked if you want to setup hardware - type yes and answer the questions.</div></div><div><br /></div><div>When you have finished, and want to uninstall the app:</div><div><ul><li>rake uninstall:android</li></ul></div><div><br /></div><div><br /></div><div><b>More to come as a work through the process</b></div>Anonymoushttp://www.blogger.com/profile/13257376651929417526noreply@blogger.com0tag:blogger.com,1999:blog-407418094446094527.post-11095554982687470832010-06-14T10:03:00.004+01:002010-06-14T10:12:09.812+01:00Smartphone app developmentAt <a href="http://radiopaedia.org">radiopaedia.org</a>, we have had iPhone apps for a while - and they are great. However, with a growing userbase that is using Android and other platforms, we'd really like to expand our apps and develop our teaching files for Android too.<div><br /></div><div>Given the usual mantra of "okay, I'll give it a go", I'd launched myself head first into Android app development. My coding background is traditional webdesign - HTML, PHP, CSS and a little bit of javascript (which has been increasing lately with the use of Jquery).</div><div><br /></div><div>So, the Java environment that is Android development is completely new to me. After a late night and a little bit of progress, I was pointed in the direction of <a href="http://rhomobile.com/products/rhodes/">Rhodes</a> - a Ruby-based development stack that allows traditional HTML, CSS and javascript for designing your app and a Ruby backend for the MVC part of the app.</div><div><br /></div><div>It sounds amazing - and what's better is that you can take your Rhodes app and build it as an iPhone app, Android app, windows mobile app... And it builds the Objective C++, Java etc. And, to give the apps a naitive feel, all you need to do is tweak the CSS - amazing.</div><div><br /></div><div>For development, I could use RhoHub, an online SDK which looks pretty cool. But, if you want to create private apps with more than 3 contributors, you need to pay. So, I'm going to attempt to build a Rhodes development environment locally using the Android SDK and eclipse on Ubuntu 10.4 - with me luck!</div>Anonymoushttp://www.blogger.com/profile/13257376651929417526noreply@blogger.com0tag:blogger.com,1999:blog-407418094446094527.post-53794386042026191392010-06-14T09:59:00.003+01:002010-06-14T10:00:47.841+01:00Blogger templaterI'd heard about the new blogger templater, but hadn't had a chance to play with it. But, given that I'm just about to post another item to the blog about smartphone app development, I thought I'd have a play. And... I was duly impressed... and after a couple of clicks have a much improved look to the blog.Anonymoushttp://www.blogger.com/profile/13257376651929417526noreply@blogger.com0tag:blogger.com,1999:blog-407418094446094527.post-89606108635436429802010-05-17T18:39:00.009+01:002010-05-28T16:45:55.536+01:00Local development with GIT and Plesk<span><span>I'm loving GIT. But, what I really wanted to do was to create a development environment locally that pushed changes to a server which was therefore always up to date.</span></span><div><span><span><br /></span></span></div><div><span><span>So, I've got an Ubuntu (lucid) machine locally and an Ubuntu server running Plesk 9.x remotely.</span></span></div><div><span><span><br /></span></span></div><div><span><span>Make sure that git is installed on both systems</span></span><div><div></div><div><blockquote>sudo apt-get install git-core</blockquote><div>Make sure that you setup Plesk to give the user shell access (bin/bash) in Web Hosting Settings.</div><div><br /></div><div>Follow this <a href="http://danielmiessler.com/blog/using-git-to-maintain-your-website">helpful todo</a>.</div><div><br /></div><div><div>Easy! When you are working remotely to setup the git repro, you will need to be root - so remember to change the httpdocs and httpdocs.git directory permissions back to "username:psaserv" and do it recursively:</div><div><blockquote>chown -R username:psaserv httpdocs<br />chown -R username:psaserv httpdocs.git</blockquote></div></div><div><b>Passwordless login and git clone</b></div><div><br /></div><div>It's worth while setting up passwordless login:</div><div><blockquote>ssh-copy-id -i .ssh/id_rsa.pub username@domainname.tld</blockquote></div><div>Then, the command to get the git repro locally becomes:</div><div><blockquote>git clone ssh://username@domainname.tld/var/www/vhosts/domainname.tld/httpdocs.git</blockquote></div><div><b>Setup apache</b></div><div><br /></div><div>You'll need to make sure the apache2, php5 are installed:</div><div><blockquote>sudo apt-get install apache2 php5</blockquote></div><div>You need to setup apache by editing the conf file: /etc/apache2/sites-available/default. If you are going to run multiple local sites, you'll have to declare them here. For each site, add the following:</div><div><div></div><blockquote><div><VirtualHost *:80></div><div> ServerName localservername</div><div> DocumentRoot /home/sites/location/httpdocs/</div><div> <Directory /></div><div> Options FollowSymLinks</div><div> AllowOverride None</div><div> </Directory></div><div> <Directory /home/sites/location/httpdocs/ ></div><div> Options Indexes FollowSymLinks MultiViews</div><div> AllowOverride All</div><div> Order allow,deny</div><div> allow from all</div><div> </Directory></div><div></VirtualHost></div></blockquote><div></div></div><div>You also need to edit /etc/hosts to provide a route to your local server. Add a line:</div><div>127.0.0.1 localserver</div><div><br /></div><div><b>Setup database forwarding</b></div><div><br /></div><div>We could just setup mysql or other database locally. However, then you need to try and keep local and remote databases synced. If you are just reading, it's much simpler to setup an ssh tunnel to your remote server.</div><div><br /></div><div>While the ssh for the git clone was as a plesk user of the particular website, this ssh should be performed as a user of the server i.e. it should log you in a you, not as a website. You need to make sure that mysql is NOT running locally:</div><div><blockquote>sudo stop mysql</blockquote></div><div>And then, type</div><div><div><blockquote>ssh -L3306:localhost:3306 remoteserver.tld</blockquote></div></div><div>For ease, if you save this command to a file and put it in /usr/local/bin and then "chmod +x" it, you can simply type the name of the file (e.g. connect) and the tunnel will be set up.</div><div><br /></div><div><b>Connecting to the tunnelled mysql db via PHP</b></div><div><br /></div><div>The other piece of glue is to realise that you can't connect to the database as localhost, you have to use 127.0.0.1, e.g.:</div><div><blockquote>mysql_connect('127.0.0.1', $username, $password);</blockquote></div><div>All in all, a pretty successful development environment.</div><div><br /></div><div><br /></div><blockquote><div></div></blockquote><div></div></div></div></div>Anonymoushttp://www.blogger.com/profile/13257376651929417526noreply@blogger.com0tag:blogger.com,1999:blog-407418094446094527.post-39392860504429510612009-12-26T21:08:00.005+00:002009-12-26T21:36:45.573+00:00VPS.net server install<span class="Apple-style-span" style="font-family: Verdana, Arial, sans-serif; font-size: 13px; color: rgb(51, 51, 51); line-height: 16px; ">Notes from a recent installation of Ubuntu server on a UK2 cloud server.<br /><br />signup<br />login as root@<br /><br />passwd<br />sudo apt-get install joe<br />joe /etc/apt/sources.list<br />apt-get update<br />apt-get upgrade<br />adduser username<br />usermod -G admin username<br /><br />joe /etc/ssh/sshd_config (permitrootlogin no)<br />/etc/init.d/ssh restart<br /><br />logout<br /><br />ssh-copy-id -i .ssh/id_rsa.pub username@host.domain.tld<br /><br />ssh username@host<br /><br />wget http://download1.parallels.com/Plesk/PPP9/Ubuntu8.04/parallels_installer_v3.4.1_build090204.18_os_Ubuntu_8.04_x86_64<br /><br /></span><div><span class="Apple-style-span" style="font-family: Verdana, Arial, sans-serif; font-size: 13px; color: rgb(51, 51, 51); line-height: 16px; ">mv parallels_installer.... /tmp/<br />chmod +x file<br />sudo ./file<br /><br />follow the instructions<br /><br />log into the Plesk frontend</span></div><div><span class="Apple-style-span" style="font-family: Verdana, Arial, sans-serif; font-size: 13px; color: rgb(51, 51, 51); line-height: 16px; ">admin:setup</span></div><div><span class="Apple-style-span" style="font-family: Verdana, Arial, sans-serif; font-size: 13px; color: rgb(51, 51, 51); line-height: 16px; "><br /></span></div><div><span class="Apple-style-span" style="font-family: Verdana, Arial, sans-serif; font-size: 13px; color: rgb(51, 51, 51); line-height: 16px; ">setup master user details</span></div><div><span class="Apple-style-span" style="font-family:Verdana, Arial, sans-serif;font-size:100%;color:#333333;"><span class="Apple-style-span" style="font-size: 13px; line-height: 16px;"><br /></span></span></div><div><span class="Apple-style-span" style="font-family:Verdana, Arial, sans-serif;font-size:100%;color:#333333;"><span class="Apple-style-span" style="font-size: 13px; line-height: 16px;">-> updates</span></span></div><div><span class="Apple-style-span" style="font-family:Verdana, Arial, sans-serif;font-size:100%;color:#333333;"><span class="Apple-style-span" style="font-size: 13px; line-height: 16px;">- -> prefs -> <span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: 'Segoe UI', Tahoma, Verdana, Arial, sans-serif; line-height: normal; font-size: 12px; border-collapse: collapse; ">Check for updates upon administrator's login to control panel [Y]</span></span></span></div><div><span class="Apple-style-span" style="font-family:Verdana, Arial, sans-serif;font-size:100%;color:#333333;"><span class="Apple-style-span" style="font-size: 13px; line-height: 16px;"><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: 'Segoe UI', Tahoma, Verdana, Arial, sans-serif; line-height: normal; font-size: 12px; border-collapse: collapse; "><br /></span></span></span></div><div><span class="Apple-style-span" style="font-family:Verdana, Arial, sans-serif;font-size:100%;color:#333333;"><span class="Apple-style-span" style="font-size: 13px; line-height: 16px;"><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: 'Segoe UI', Tahoma, Verdana, Arial, sans-serif; line-height: normal; font-size: 12px; border-collapse: collapse; ">-> Settings</span></span></span></div><div><span class="Apple-style-span" style="font-family:Verdana, Arial, sans-serif;font-size:100%;color:#333333;"><span class="Apple-style-span" style="font-size: 13px; line-height: 16px;"><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: 'Segoe UI', Tahoma, Verdana, Arial, sans-serif; line-height: normal; font-size: 12px; border-collapse: collapse; ">- -> <span class="Apple-style-span" style="border-collapse: separate; font-family: 'Segoe UI', tahoma, verdana, arial, sans-serif; ">Spam Filter Settings -> <span class="Apple-style-span" style="font-family: 'Segoe UI', Tahoma, Verdana, Arial, sans-serif; border-collapse: collapse; ">Switch on server-wide greylisting spam protection [Y]</span></span></span></span></span></div><div><span class="Apple-style-span" style="font-family:Verdana, Arial, sans-serif;font-size:100%;color:#333333;"><span class="Apple-style-span" style="font-size: 13px; line-height: 16px;"><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: 'Segoe UI', Tahoma, Verdana, Arial, sans-serif; line-height: normal; font-size: 12px; border-collapse: collapse; "><span class="Apple-style-span" style="border-collapse: separate; font-family: 'Segoe UI', tahoma, verdana, arial, sans-serif; "><span class="Apple-style-span" style="font-family: 'Segoe UI', Tahoma, Verdana, Arial, sans-serif; border-collapse: collapse; "><br /></span></span></span></span></span></div><div><span class="Apple-style-span" style="font-family:Verdana, Arial, sans-serif;font-size:100%;color:#333333;"><span class="Apple-style-span" style="font-size: 13px; line-height: 16px;"><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: 'Segoe UI', Tahoma, Verdana, Arial, sans-serif; line-height: normal; font-size: 12px; border-collapse: collapse; "><span class="Apple-style-span" style="border-collapse: separate; font-family: 'Segoe UI', tahoma, verdana, arial, sans-serif; "><span class="Apple-style-span" style="font-family: 'Segoe UI', Tahoma, Verdana, Arial, sans-serif; border-collapse: collapse; ">-> <span class="Apple-style-span" style="border-collapse: separate; white-space: nowrap; ">Control Panel Interface</span></span></span></span></span></span></div><div><span class="Apple-style-span" style="font-family:Verdana, Arial, sans-serif;font-size:100%;color:#333333;"><span class="Apple-style-span" style="font-size: 13px; line-height: 16px;"><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: 'Segoe UI', Tahoma, Verdana, Arial, sans-serif; line-height: normal; font-size: 12px; border-collapse: collapse; "><span class="Apple-style-span" style="border-collapse: separate; font-family: 'Segoe UI', tahoma, verdana, arial, sans-serif; "><span class="Apple-style-span" style="font-family: 'Segoe UI', Tahoma, Verdana, Arial, sans-serif; border-collapse: collapse; "><span class="Apple-style-span" style="border-collapse: separate; white-space: nowrap; ">- -> Interface Management</span></span></span></span></span></span></div><div><span class="Apple-style-span" style="font-family:Verdana, Arial, sans-serif;font-size:100%;color:#333333;"><span class="Apple-style-span" style="font-size: 13px; line-height: 16px;"><span class="Apple-style-span" style="font-family:'Segoe UI', Tahoma, Verdana, Arial, sans-serif;font-size:100%;color:#000000;"><span class="Apple-style-span" style="font-size: 12px; line-height: normal; white-space: nowrap;"><br /></span></span></span></span></div><div><span class="Apple-style-span" style="font-family: Verdana, Arial, sans-serif; font-size: 13px; color: rgb(51, 51, 51); line-height: 16px; ">apt-get install munin-node<br />joe /etc/munin/munin-node.conf<br /><br />#<br /># Example config-file for munin-node<br />#<br /><br />log_level 4<br />log_file /var/log/munin/munin-node.log<br />port 4949<br />pid_file /var/run/munin/munin-node.pid<br />background 1<br />setseid 1<br /><br /># Which port to bind to;<br />host *<br />user root<br />group root<br />setsid yes<br /><br /># Regexps for files to ignore<br /><br />ignore_file ~$<br />ignore_file \.bak$<br />ignore_file %$<br />ignore_file \.dpkg-(tmp|new|old|dist)$<br />ignore_file \.rpm(save|new)$<br /><br /># Set this if the client doesn't report the correct hostname when<br /># telnetting to localhost, port 4949<br />#<br />#host_name localhost.localdomain<br />host_name [luffness.konsulting.ltd.uk]<br /><br /># A list of addresses that are allowed to connect. This must be a<br /># regular expression, due to brain damage in Net::Server, which<br /># doesn't understand CIDR-style network notation. You may repeat<br /># the allow line as many times as you'd like<br /><br />allow ^127\.0\.0\.1$<br />allow ^80\.2\.73\.137$<br /><br /></span></div><div><span class="Apple-style-span" style="font-family: Verdana, Arial, sans-serif; font-size: 13px; color: rgb(51, 51, 51); line-height: 16px; ">****************************<br />[monitoring server]<br />joe /etc/munin/munin.conf<br /><br />[craigielaw.konsulting.ltd.uk]<br />address 83.170.83.182<br />use_node_name yes</span></div><div><span class="Apple-style-span" style="font-family: Verdana, Arial, sans-serif; font-size: 13px; color: rgb(51, 51, 51); line-height: 16px; "><br /></span></div><div><span class="Apple-style-span" style="font-family: Verdana, Arial, sans-serif; font-size: 13px; color: rgb(51, 51, 51); line-height: 16px; ">***************************<br /><br />** install mysqltuner<br />wget mysqltuner.pl<br />chmod +x mysqltuner.pl<br />sudo mv mysqltuner.pl /usr/local/bin/mysqltuner<br /><br />** alter crontab</span></div><div><span class="Apple-style-span" style="font-family: Verdana, Arial, sans-serif; font-size: 13px; color: rgb(51, 51, 51); line-height: 16px; ">** allows a weekly email to test for upgrade and mysql tuning options<br />sudo crontab -e<br />add:<br />MAILTO=server@klever.co.uk<br />17 3 * * 3 apt-get update; apt-get upgrade -sy<br />17 4 * * 5 /usr/local/bin/mysqltuner<br /></span></div>Anonymoushttp://www.blogger.com/profile/13257376651929417526noreply@blogger.com1tag:blogger.com,1999:blog-407418094446094527.post-63021922334694379492009-09-28T23:22:00.002+01:002009-09-29T00:05:13.870+01:00Ubuntu fontsGet a raft of fonts for Ubuntu with a simple apt-get<br /><blockquote>sudo apt-get install ttf-sil-gentium ttf-dustin ttf-georgewilliams ttf-sjfonts sun-java6-fonts ttf-larabie-deco ttf-larabie-straight ttf-larabie-uncommon<br /></blockquote>Any, if Microsoft fonts are required:<br /><blockquote>sudo apt-get install msttcorefonts</blockquote>Works a treat.. and you could do worse than <span style="font-weight: bold;">gnome-specimen</span> for a font previewer.Anonymoushttp://www.blogger.com/profile/13257376651929417526noreply@blogger.com1tag:blogger.com,1999:blog-407418094446094527.post-88455621255080450792009-09-14T19:10:00.002+01:002009-09-14T19:13:49.479+01:00Load alertI've been having an issue with a server whose load sporadically runs high. While trying to work out what the problem was, I needed a way to know when the load peaked.<br /><br />I modified a simple script to allow me to do just that and then ran it from cron. Only problem is that if it detects a high load, an email is sent each time the cron is run (maybe every 5 minutes!)<br /><blockquote>!/bin/bash<br />avg=`uptime | awk '{print $8" " $9 " "$10 $11 $12 }' | tr -s , " "`<br />cur=`uptime | awk '{print $10}' | tr -d , | cut -d. -f1`<br />str="============================="<br />info="Curent $avg"<br />if [ $cur -ge 1 ]; then<br />info1="Server load is high presently"<br />touch /tmp/tmp.00<br />echo -e "$str\n$info\n$info1\n$str\n" >> /tmp/tmp.00<br />ps aux | head -1 >> /tmp/tmp.00<br />ps aux | sort -rn +2 | head -10 >> /tmp/tmp.00;<br />mail -s "Alert: Load Average for `hostname` on `date` " jeremy@yourdomainnamehere.com < /tmp/tmp.00;<br />rm -f /tmp/tmp.00<br />else<br />#echo -e "$str\n$info\n$str"<br />fi<br /></blockquote>Cron might look something like this:<br /><blockquote>*/5 * * * * /usr/local/bin/loadaverage</blockquote>Anonymoushttp://www.blogger.com/profile/13257376651929417526noreply@blogger.com0tag:blogger.com,1999:blog-407418094446094527.post-57299102512458845702009-08-30T11:33:00.000+01:002009-08-30T11:34:24.061+01:00Cloud server Plesk Ubuntu installNotes from a recent installation of Ubuntu server on a UK2 cloud server.<br /><br />signup<br />login as root@<br /><br />passwd<br />sudo apt-get install joe<br />joe /etc/apt/sources.list<br />apt-get update<br />apt-get upgrade<br />adduser username<br />usermod -G admin username<br /><br />joe /etc/ssh/sshd_config (permitrootlogin no)<br />/etc/init.d/ssh restart<br /><br />logout<br /><br />ssh-copy-id -i .ssh/id_rsa.pub username@host.domain.tld<br /><br />ssh username@host<br /><br />wget http://download1.parallels.com/Plesk/PPP9/Ubuntu8.04/parallels_installer_v3.4.1_build090204.18_os_Ubuntu_8.04_x86_64<br /><br />chmod +x file<br />sudo ./file<br /><br />follow instructions<br /><br />make sure that postfix is installed as the MTA<br /><br />sudo apt-get install postgrey<br />netstat -lpn | grep 60000<br />joe /etc/postfix/main.cf (add check_policy_service inet:127.0.0.1:60000,) before reject_unauth_destination<br />/etc/init.d/postfix restart<br />tail -f /var/log/mail.info<br /><br />apt-get install munin-node<br />joe /etc/munin/munin-node.conf<br /><br />#<br /># Example config-file for munin-node<br />#<br /><br />log_level 4<br />log_file /var/log/munin/munin-node.log<br />port 4949<br />pid_file /var/run/munin/munin-node.pid<br />background 1<br />setseid 1<br /><br /># Which port to bind to;<br />host *<br />user root<br />group root<br />setsid yes<br /><br /># Regexps for files to ignore<br /><br />ignore_file ~$<br />ignore_file \.bak$<br />ignore_file %$<br />ignore_file \.dpkg-(tmp|new|old|dist)$<br />ignore_file \.rpm(save|new)$<br /><br /># Set this if the client doesn't report the correct hostname when<br /># telnetting to localhost, port 4949<br />#<br />#host_name localhost.localdomain<br />host_name [luffness.konsulting.ltd.uk]<br /><br /># A list of addresses that are allowed to connect. This must be a<br /># regular expression, due to brain damage in Net::Server, which<br /># doesn't understand CIDR-style network notation. You may repeat<br /># the allow line as many times as you'd like<br /><br />allow ^127\.0\.0\.1$<br />allow ^80\.2\.73\.137$<br /><br />[monitoring server]<br />joe /etc/munin/munin.conf<br /><br />[craigielaw.konsulting.ltd.uk]<br /> address 83.170.83.182<br /> use_node_name yes<br /><br />http://www.debuntu.org/postfix-and-postgrey-a-proactive-approach-to-spam-filtering<br />https://help.ubuntu.com/community/PostfixAmavisNew<br /><br />** spamassassin<br />sudo apt-get install spamassassin spamc<br /><br />** install backports<br />sudo apt-get update<br />sudo apt-get upgrade<br />sudo apt-get install -t hardy-backports spamassassin<br /><br />** install mysqltuner<br />wget http://mysqltuner.com/mysqltuner.pl.gz<br />gzip -d mysqltuner.pl.gz<br />chmod +x mysqltuner.pl<br />sudo mv mysqltuner.pl /usr/local/bin/mysqltuner<br /><br />** alter crontab<br />sudo crontab -e<br />add:<br />MAILTO=server@klever.co.uk<br />17 3 * * 3 apt-get update; apt-get upgrade -sy<br />17 4 * * 5 /usr/local/bin/mysqltuner<br /><br /><br />other helpful software<br />sudo apt-get install ifstat rcconf<br /><br />tbackup<br />ssh-keygen -rsa<br />ssh-copy-id -i......Anonymoushttp://www.blogger.com/profile/13257376651929417526noreply@blogger.com0tag:blogger.com,1999:blog-407418094446094527.post-28840397570275276002009-08-17T23:07:00.002+01:002009-08-17T23:09:41.995+01:00Fonts in UbuntuI had been reading some blog posts about free fonts in Ubuntu:<br /><ul><li>http://embraceubuntu.com/2007/05/21/300-easily-installed-free-fonts-for-ubuntu/</li><li>http://crunchbang.org/archives/2008/06/14/aenigma-fonts-for-ubuntu/</li></ul>In the latter, it talks about installing a PPA to get the package. However, it turns out that the package is already in the Karmic Universe repository and this is all you need:<br /><blockquote>sudo apt-get install ttf-aenigma<br /></blockquote>Anonymoushttp://www.blogger.com/profile/13257376651929417526noreply@blogger.com0tag:blogger.com,1999:blog-407418094446094527.post-11821690152761828602009-08-14T19:03:00.002+01:002009-08-14T22:15:45.500+01:00Upgrading iPhone firmware in a VirtualBoxAs I blogged previously, I've setup a Virtualbox inside Ubuntu Karmic and installed an old copy of WindowsXP and then iTunes.<br /><br />I needed to upgrade to the latest version of the firmware and after some scouting around, it appeared possible back in v2 of Virtualbox, so I was hoping that v3 would be fine.<br /><br />At first, it didn't work.<br /><br />I couldn't work out why, but not long after the upgrade had started, the "preparing" message just kept cycling until a "can't do it" error message popped up. Restart the VM and tried again... nothing.<br /><br />Then, as a matter of last resort, I noticed that just before the "preparing" message came up, the USB icon in the bottom left didn't flash. I right clicked and noticed that the iPhone had restarted and therefore wasn't <span style="font-style: italic;">checked</span> in the list of USB.<br /><br />So, if you recheck it each time the iPhone switches mode or restarts, everything works like a charmAnonymoushttp://www.blogger.com/profile/13257376651929417526noreply@blogger.com0tag:blogger.com,1999:blog-407418094446094527.post-17118482589168966052009-08-13T17:50:00.022+01:002009-08-14T15:27:58.297+01:00Running WindowsXP on VirtualBox on Ubuntu KarmicRecently installed the latest alpha of Karmic and thought I'd give it a shot with VirtualBox and Windows XP.<br /><br />The most important thing to do right now is realise the there are two version of VirtualBox:<br /><ul><li>virtualbox-ose (open source edition) - no USB support</li><li>virtualbox-puel - the one with USB support</li></ul>The <span style="font-weight: bold;">OSE edition</span> is in the repositaries:<br /><blockquote>sudo-s<br />apt-get install virtualbox-ose</blockquote><ul><li>Then run it: Applications -> Accessories -> VirtualBox OSE</li></ul>The <span style="font-weight: bold;">PUEL version</span> needs <a href="http://www.virtualbox.org/wiki/Linux_Downloads">downloading</a> and installing using the .deb package maintainer or:<br /><ul><li>add the following repro:<br /><pre class="wiki">deb http://download.virtualbox.org/virtualbox/debian jaunty non-free<span style="font-family:Georgia,serif;"></span></pre></li><li><span style="font-family:Georgia,serif;">then add the key and install it<br /></span></li></ul><blockquote>wget -q http://download.virtualbox.org/virtualbox/debian/sun_vbox.asc -O- | sudo apt-key add -<br />sudo apt-get install virtualbox-3<br /></blockquote><ul><li>You should find it under Applications -> System Tools<br /></li></ul><span style="font-weight: bold;">THE REST</span><br /><br />Create a new virtual machine and follow the wizard. I chose to use the following settings:<br /><ul><li>windows</li><li>XP</li><li>512 MB RAM</li><li>Dynamic HDD (max 50GB)</li></ul><span style="font-weight: bold;">BEWARE:</span> the dynamic HDD maximum cannot be increaed after this point. If you use dynamic, the file in /home/username/.VirtualBox/HardDrives will start out small and grow to the maximum file size stated here.<br /><br />Once this is done, double click on the newly created VM and follow the "First Run Wizard". Pop the XP installation CD in the drive and choose that as the media to use for installation.<br /><span style="font-weight: bold;"></span><br />The Windows installation proceeds: the only problem that I had was when trying to Eject the disc (the XP disc is an upgrade disc and I needed to put an old NT disc in). At first, the Eject just wouldn't happen - I joked that Windows clearly didn't want to leave the machine. After using the right click -> Eject option from the desktop a couple of times, it relented.<br /><br />In fact, the whole process was far less stressful than it used to be installing it on a fresh box - the network worked first time and I didn't have to wait for the "34 minutes" while watching a blue screen. Instead, I could fire up firefox and do some surfin'.<br /><br />When the VM needs keyboard or mouse action, life is very simple:<br /><ul><li>keyboard: simply bring the VM window to focus</li><li>mouse: click on the VM window or use the "capture key" which, by default is the Right Ctrl key</li></ul>And, that was it.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjABiwyNqdsOUWcSnfOH9IbklKxQPSNPk_PUC2B5PhYNRaIlZx3DkX_JWKO-Fj0A5Fl-TfAjgEL20fs1RGz2YPCBIK_vswX2Sb5z5Xdfw3K-fTFoWFuTH8P2nIqZODEJDmddI1kjcd-Qhw/s1600-h/Screenshot.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 250px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjABiwyNqdsOUWcSnfOH9IbklKxQPSNPk_PUC2B5PhYNRaIlZx3DkX_JWKO-Fj0A5Fl-TfAjgEL20fs1RGz2YPCBIK_vswX2Sb5z5Xdfw3K-fTFoWFuTH8P2nIqZODEJDmddI1kjcd-Qhw/s400/Screenshot.png" alt="" id="BLOGGER_PHOTO_ID_5369513181411731810" border="0" /></a><br />Just needed to install all the updates... trivial really, keep re-visiting the Updates page via the control panel, and install SP1, SP2, SP3 and a couple of other pieces of software and restarting the VM about 7 times!<br /><br /><span style="font-weight: bold;">NETWORK FOLDERS</span><br /><br />Getting networked folders sorted is pretty simple too.<br /><br /><ul><li>ensure that the VM is fired up<br /></li><li>install the "guest additions": from the VirtualBox menu: Devices -> Install Guest Additions</li><li>follow the prompts from within the VM</li></ul>Now, share the Host's folders:<br /><ul><li>from the live VM window, choose Devices -> Shared Folders</li><li>within the popup window, use the add button (top right) and choose the folder you want to share</li><li>I chose to make the sharing permanent too</li></ul>That's one side done... now for the Windows glue:<br /><ul><li>within Windows, choose "Start -> Run"</li><li>type "net use x: \\vboxsvr\NameOfYourFolderHere"</li></ul>Have a look in MyComputer, and you should see a shiny networked drive. And, changes either side of the glue persist in realtime.<br /><br /><span style="font-weight: bold;">USB and iPHONE</span><br /><br />Of course, this is only going to work if you've downloaded the PUEL version (see above).<br /><br /><ul><li>add yourself to the vboxusers group<br /></li><li>add this line to /etc/fstab, replacing XXX for the groupid of vboxusers: NB. most posts talk about /proc/bus/usb, but this didn't exist on my Karmic install, so I changed it to /dev/bus/usb<br /><pre>none /dev/bus/usb usbfs devgid=XXX,devmode=664 0 0</pre></li><li>restart your machine: some people say restart some services, some say logout...<br /></li></ul>Once the machine has restarted, double check that the USB controller is working on the VM: for some reason mine wasn't.<br /><ul><li>goto Control Panel -> System -> Hardware -> Device Manager</li><li>check that the USB controller is installed correctly and there aren't any other drivers missing</li><li>if there are problems, double click and choose to search for driver from the web</li></ul>Now, USB should be working:<br /><ul><li>check the iPhone is recognised by plugging it in and seeing if it is listed under the USB menu at the bottom or within the Devices menu</li><li>click the checkbox next to them to ensure that Windows connects to them</li><li>install iTunes</li><li>done!<br /></li></ul>Anonymoushttp://www.blogger.com/profile/13257376651929417526noreply@blogger.com7tag:blogger.com,1999:blog-407418094446094527.post-70567136145467828542009-06-01T19:11:00.000+01:002009-08-16T19:12:48.419+01:00Zotero style<p>I’ve just been writing a zotero style for <a bitly="BITLY_PROCESSED" href="http://radiopaedia.org/" target="_blank">radiopaedia.org</a> where I’m an editor. I didn’t have a seamless start to the process and found it pretty difficult to work out exactly what I should be writing, but after taking one of the other styles as a starting point and mashing it about, I finally got to our <a bitly="BITLY_PROCESSED" href="http://www.zotero.org/styles/radiopaedia" target="_blank">working copy</a>.</p> <p>The styles are writtin in CSL and have to validate against the RELAX_NG XML schema. Long story short, use this online tool:</p> <ul><li><a bitly="BITLY_PROCESSED" href="http://validator.nu/" target="_blank">validator.nu</a></li><li>encoding and parser can be left of auto</li><li>schemas: http://xbiblio.svn.sourceforge.net/viewvc/xbiblio/csl/schema/trunk/csl.rnc</li><li>check “Be lax about HTTP Content-Type”</li></ul> <p>And, after uploading and hitting validate you should be on your way.</p> <p>As for getting the new style into firefox, just File->Open File from within Firefox.</p> <p>And then, once happy, the task of getting it up to zotero rears it’s head. All the csl files are held in an SVN repository. So, we need to checkout the csl repro, We also need to have a <a bitly="BITLY_PROCESSED" href="https://www.zotero.org/dev/trac_access" target="_blank">zotero trac</a> account to be able to submit our style.</p> <p>Once the repro is checked out, we can add our style with an “svn add file.csl” and “svn commit”.</p> <p>A couple of helpful pages:</p> <ul><li><a bitly="BITLY_PROCESSED" href="http://www.zotero.org/support/dev/creating_citation_styles" target="_blank">http://www.zotero.org/support/dev/creating_citation_styles</a></li><li><a bitly="BITLY_PROCESSED" href="http://www.zotero.org/styles" target="_blank">http://www.zotero.org/styles</a></li><li><a bitly="BITLY_PROCESSED" href="http://xbiblio.sourceforge.net/csl/" target="_blank">http://xbiblio.sourceforge.net/csl/</a></li></ul>Anonymoushttp://www.blogger.com/profile/13257376651929417526noreply@blogger.com0tag:blogger.com,1999:blog-407418094446094527.post-62470192006259891952008-12-14T19:11:00.000+00:002009-08-16T19:11:40.773+01:00Amason S3 cloud backup<p>I’m looking at the S3 service from amazon as a solution for backing up all data from our Plesk servers. We already have backups saved to each server using totalbackup from 4psa, and to another server. However, they are all in the same datacentre, and it wouldbe nice to have another layer of redundancy.</p> <ol><li>sign up to S3</li><li>get the accesskey and secretkey</li><li>use a service like <a bitly="BITLY_PROCESSED" href="http://s3browse.com/">s3browse.com</a> to look at your space and create a “bucket”</li><li>use something like duplicity to backup the entire system<a bitly="BITLY_PROCESSED" href="http://www.brainonfire.net/2007/08/11/remote-encrypted-backup-duplicity-amazon-s3/"><br /></a></li></ol> <p>S3 uses the concept of buckets to refer to a collection of all the data that is backed up. Each bucket has a name: however, each name is unique across all users. So, the ‘testing’ bucket won’t be available for anybody else.</p> <p>Installing duplicity on <a bitly="BITLY_PROCESSED" href="http://ubuntu.com/">ubuntu</a> and setting up the backup</p> <blockquote><p>sudo apt-get install duplicity python-boto<strong><br /></strong></p></blockquote>Anonymoushttp://www.blogger.com/profile/13257376651929417526noreply@blogger.com0