Archive

Archive for the ‘howto’ Category

Ruby on Rails on Ubuntu Edgy

September 30th, 2006 5 comments

I updated my laptop to Ubuntu 6.10 Beta (Edgy Eft) and it’s working great. So far I’ve had less problems than the beta of Dapper, but it has only been two day. My first experience off the tested path of synaptic packages is ruby on rails. Edgy comes with a rails package, but like Dapper, no gems. So here is the install of gems, and the rails from withing gems, on Ubuntu 6.10 Edgy Eft.

# sudo apt-get install ruby ruby1.8-dev irb rdoc
# wget http://rubyforge.org/frs/download.php/11289/rubygems-0.9.0.tgz
# tar xvfz rubygems-0.9.0.tgz
# cd rubygems-0.9.0
# sudo ruby setup.rb
# sudo gem install rails

I did get an rdoc error, but everything else installed fine, so I ignored it and continued on. This error is fixed by adding rdoc to the apt-get command above. It is here for historical purposes, and perhaps will help someone.

/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require’: no such file to load — rdoc/rdoc (LoadError)

Other Notes:

Categories: howto, rails

Subversion Primer

September 26th, 2006 1 comment

This is a guide for a single user to setup a barebones SVN repository quickly and without any extra confusing instructions.

The following steps will show how to 1.setup a repository for a project, 2. import files into the repo, 3. pull them out into a different folder, and 4. submit changes back to the repo. Before starting, make sure you have subversion installed (sudo apt-get install subversion) on all the computers you will be using. For this howto I’ll be using the server “closetbox” and the client “icebox”. Both are running Ubuntu Linux.

  1. Create an SVN repository for a project on the server.

nick@closetbox:# sudo mkdir /var/svn
nick@closetbox:# sudo svnadmin create /var/svn/frozenindustries
nick@closetbox:# sudo chmod 770 /var/svn/frozenindustries
nick@closetbox:# sudo chown nick:nick /var/svn/frozenindustries

  1. Import files into the repository. I’m going to send over a wordpress blog which is sitting in a folder called “htdocs” on my desktop. This is only done once, after this files are updated using “ci”.

nick@icebox:# svn import -m “look, i’m importing” htdocs/ svn+ssh://closetbox/var/svn/frozenindustries/trunk

  1. Get your data back out of SVN an put it in a folder on the client where you’ll work on it.

nick@icebox:# svn co svn+ssh://closetbox/var/svn/frozenindustries/trunk fi/

  1. After making changes to files in fi, send the changes back to the server. SVN knows which server you checked out from by saving data in a .svn folder. It’ll pop open your default text editor to show the changes. Since we’re trying to be as simple as possible, just assume everything is correct, quit the text editor, and say “c)ontinue”

nick@icebox:# svn ci fi/

That’s it. Repeat steps 3 and 4 to grab copies of you project and submit changes.

Categories: howto

Add a Drive to an LVM Volume

September 25th, 2006 1 comment

This guide shows how to add a drive to an existing LVM volume.

  1. Erase the partition table on drive /dev/hdd and create the Physical volume

# dd if=/dev/zero of=/dev/hdd bs=1024k count=1
# pvcreate /dev/hdd

  1. Look at the current volume group, for fun

# sudo vgdisplay -A

— Volume group —
VG Name disks
System ID
Format lvm2
Metadata Areas 7
Metadata Sequence No 2
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 7
Act PV 7
VG Size 859.70 GB
PE Size 4.00 MB
Total PE 220084
Alloc PE / Size 220084 / 859.70 GB
Free PE / Size 0 / 0

VG UUID N4TcI6-DIRS-3edy-FAa0-tdUL-MTSX-bs2lJE

  1. Add the Physical Volume to the existing Volume Group, which I creatively named “disks”

# sudo vgextend disks /dev/hdd

  1. Look at the current Volume Group again, my how it has grown

# sudo vgdisplay -A

— Volume group —
-snip-
VG Size 1.11 TB
PE Size 4.00 MB
Total PE 291625
Alloc PE / Size 220084 / 859.70 GB
Free PE / Size 71541 / 279.46 GB

  1. Extend the Logical Volume, this time named “backup”, use the free extents reported by vgdisplay

# sudo lvextend -l+71541 /dev/disks/backup

Extending logical volume backup to 1.11 TB
Logical volume backup successfully resized

  1. And then look at vgdisplay again, whee

# sudo vgdisplay -A

— Volume group —
-snip-
VG Size 1.11 TB
PE Size 4.00 MB
Total PE 291625
Alloc PE / Size 291625 / 1.11 TB
Free PE / Size 0 / 0

  1. Now the final and most exciting step, expanding the filesystem. You’re using XFS right? And here’s a surprise, it should be mounted when you resize it. xfs_growfs will automatically resize the XFS filesystem to use all the available free space, and do it in less than a second.

# sudo xfs_growfs /backup

Categories: file systems, howto, LVM

Control Multiple Terminals Simultaneously

September 21st, 2006 2 comments

A small part of my job requires keeping eight Ubuntu desktops updated. While it’s easy to add the commands to update them to cron, I’d rather watch the updates occur in front of me in case something goes wrong. That’s where Keyboardcast comes in. Keyboardcast will take over or open as many Gnome Terminals as you’d like, and lets you enter text into all of them at once. It will also take over other windows, which may be useful for something, perhaps as keeping a log of all the commands you’ve entered in a text editor.

The benefit of using Keyboardcast is that it is quick to connect to multiple machines. It’s included in the Ubuntu Universe repository, and after a “sudo apt-get install keyboardcast”, anyone can control a group of computers easily. Here are the steps:

  1. Start Keyboardcast

keyboardcast.png

  1. Click Spawn and enter the command and arguments to use. Normally just changing the arguments to the correct hostnames is all that is needed to get started. More arguments, such as different users at different computers can be added. Although if you’re using SSH with different users, you’ll want to use passwordless logins to skip entering different password.

options.png

  1. After clicking OK terminals will open. Click where it says “type here…” in the small Keyboardcast window and start typing. Typing will show up in each terminal letter by letter.

terms.png
Having multiple terminals visible all the the same time makes watching for errors easy. If there is an error, it will on be the term which looks different. By setting up a new profile in Gnome Terminal called “keyboardcast”, you can change the window and font size of the terminals which are automatically opened by Keyboardcast.

Other Options for Controlling Multiple Terminals

Cluster SSH (cssh)

Cluster SSH came out before Keyboardcast and works in a very similar manner. There is a small window to enter text, and it uses multiple xterms by default instead of Gnome Terminals. Multiple computers can be scripted to open at the command line.

Konsole

Konsole is the default terminal for KDE and allows sending text to multiple tabs at once. Once open, hit View, then “send input to all sessions”. To see results, you’ll need to switch between tabs.

multi-gnome-terminal

MGT allows connecting multiple tabs together with tabs similarly to Konsole. Hit File, then “All bonded”.

Tentakel

Tentakel is unique from the other options because it has the ability to display data from multiple hosts all in the same terminal window. It makes a good solution if X is not available.

More:

pconsole 

Categories: howto