Archive for category Ubuntu

Setting up a JobsWorth Server in Ubuntu

JobsWorth is a branch of the very awesome Rails application called Clocking IT.  So in order to do my part to help out, I would like to provide a how-to for setting up JobsWorth with Ubuntu Server Edition 10.04.

More information about Jobsworth found here: https://github.com/ari/jobsworth

and here: http://www.clockingit.com/

and here: http://groups.google.com/group/jobsworth

Ok, let’s get started!

My Setup:

  • Ubuntu Server Edition 10.04.3 – 32 bit
    • During Server Setup chose (as seen in screenshot):
      • LAMP Server
      • OpenSSH Server
      • SAMBA Server
      • JobsWorth Install - Server Settings

Prerequisites:

  1. Webmin

    • This is for easy setup of apache – to install, follow the instructions here: http://www.webmin.com/deb.html.  Go to section “Using the Webmin APT repository”.
  2. Ruby Version Manager (RVM)

Steps for the Install:

For the following steps, I adapted the instructions found here: https://github.com/ari/jobsworth.

  1. Install the follow packages, that will be needed to run JobsWorth

    • apt-get install mysql-server apache2 git-core imagemagick gcc libc6-dev g++ zip build-essential bison openssl libreadline6 libreadline6-dev curl zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev autoconf libcurl4-openssl-dev apache2-prefork-dev libcurl4-openssl-dev libaprutil1-dev libapr1-dev libxslt-dev libxml2-dev openjdk-6-jre
  2. Install Ruby version 1.9.2 ***Note: You need to have followed the instructions here, and have Ruby Version Manager setup and working

    • rvm install 1.9.2
    • rvm --default use 1.9.2
  3. Install Bundler Gem – for more info on Bundler go here: http://gembundler.com/

    • rvm 1.9.2 do gem install bundler
  4. Install Phusion Passenger

    • rvm 1.9.2 do gem install passenger
    • rvm 1.9.2 do passenger-install-apache2-module
      • This will setup Apache for you
    • Once passenger sets up Apache for you, at the end of a successful process you’ll see a message like:
      • The Apache 2 module was successfully installed.
        Please edit your Apache configuration file, and add these lines:
        LoadModule passenger_module /home/tron/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.11/ext/apache2/mod_passenger.so
        PassengerRoot /home/tron/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.11
        PassengerRuby /home/tron/.rvm/wrappers/ruby-1.9.2-p290/ruby
        After you restart Apache, you are ready to deploy any number of Ruby on Rails
        applications on Apache, without any further Ruby on Rails-specific
        configuration!
        Press ENTER to continue.
        • Note:  Use your Username in the paths above. (just in case you didn’t notice :))
    • Don’t worry about the lines for the Apache configuration file – we’ll deal with those in a later step.
  5. Modify your “hosts” file

    • If your like me, and you are installing your server on an Intranet, you’ll need to modify your “hosts” file so Apache knows where to go.  Additionally, the JobsWorth setup needs a domain.
    • gksudo gedit /etc/hosts
    • Add this line to your “hosts” file – remember the domain you use, you’ll need it later
      • 127.0.0.1    wiki.yourmadeupdomain.com
  6. Get the source

    • sudo git clone git://github.com/ari/jobsworth.git /var/www/jobsworth
  7. Change the permissions for the jobsworth directory

    • sudo chown -Rv $USER /var/www/jobsworth
  8. Setup a Virtual Host on Apache using Webmin

    1. Log into your local instance of Webmin – default = https://localhost:10000 (sceenshot)
      • JobsWorth Install - Log into Webmin
    2. Create a Virtual Host for the jobsworth application (screenshot)
      • Servers –> Apache Webserver –> Create Virtual Host
        • see screenshot for the proper settings
      • Click Create
      • JobsWorth Install - Webmin - Apache Virtual Host
    3. Select the Virtual Host you just created (screenshot)
      • JobsWorth Install - Webmin - Select Virtual Host
    4. Click on Edit Directives (screenshot)
      • JobsWorth Install - Webmin - Edit Directives
    5. Change your Directive file, ***ignore the text in the sceenshot, copy the text BELOW the screenshot***
      • JobsWorth Install - Webmin - Virtual Host Directive
      • DocumentRoot "/var/www/jobsworth/public"
        ServerName wiki.yourmadeupdomain.com
        RailsEnv production
        PassengerHighPerformance on
        LoadModule passenger_module "/home/tron/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.11/ext/apache2/mod_passenger.so"
        PassengerRoot "/home/tron/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.11"
        PassengerRuby "/home/tron/.rvm/wrappers/ruby-1.9.2-p290/ruby"
        <Directory "/var/www/jobsworth/public">
        AllowOverride All
        Options -MultiViews +Indexes
        Order allow,deny
        Allow from all
        </Directory>
        • Note:  Use your Username in the paths above. (just in case you didn’t notice :))
      • Click Save
    6. Now restart your Apache Server
      • sudo /etc/init.d/apache2 restart
  9. Install the Gems that JobsWorth needs to run

    • cd /var/www/jobsworth
    • rvm 1.9.2 do bundle install
  10. Setup the database

    1. As of the time of this writing there were some database setup issues.  The following steps are a work-around.  If you have the more “up-to-date” steps, please comment and I will update this tutorial 🙂
    2. You have to set up your database.yml file manually.
      • Make sure you are in the right directory:
        • cd /var/www/jobsworth
      • cp config/database.example.yml config/database.yml
      • Mine looks like this:
        • development:
            adapter: mysql2
            database: jobsworth
            username: jobsworthDBA
            password: keepitsecretkeepitsafe
            host: localhost
            encoding: utf8
          
          test: &TEST
            adapter: mysql2
            database: jobsworth_test
            username: jobsworthDBA
            password: keepitsecretkeepitsafe
            host: localhost
            encoding: utf8
          
          production:
            adapter: mysql2
            database: jobsworth
            username: jobsworthDBA
            password: keepitsecretkeepitsafe
            host: localhost
            encoding: utf8
          
          cucumber:
            <<: *TEST
          selenium:
            <<: *TEST
          
          staging:
            adapter: mysql2
            database: jobsworth_staging
            username: jobsworthDBA
            password: keepitsecretkeepitsafe
            host: localhost
            encoding: utf8
    3. Now create the database:
      1. echo "CREATE DATABASE jobsworth DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; GRANT ALL ON jobsworth.* TO 'jobsworthDBA'@'localhost' IDENTIFIED BY 'keepitsecretkeepitsafe'; FLUSH PRIVILEGES;" | mysql -u root -p
  11. Modify Ruby Setup File

    • As of the time of this writing (12/20/2011) the Dev made a change that broke the setup (at least for Ubuntu), so you’ll need to change it back.  Look for the following code, and make sure it looks like what I have below:
      1. Open the setup.rb file, located in /var/www/jobsworth/setup.rb
      2. Go to line 123, and make sure the code looks like this:
        • puts "Loading Rails to create account..."
          begin
            require File.expand_path('../config/environment.rb', __FILE__)
          rescue
            puts "*** Unable to load Rails, please ensure you have a working Rails environment. ***"
            exit
          end
        • Save changes
  12. Run the Ruby Setup File

    • cd /var/www/jobsworth
    • ruby setup.rb
    • Answer the first question “Enter hostname for the Jobsworth service (for example projects.mycompany.com):”
      • wiki.yourmadeupdomain.com
    • When you get to the question “Initialize database schema [n]:”, answer “y”.
  13. Email Setup

    • I have not yet gone through the email setup since my need is only for a local server.  The directions are located at “Step 8: Sending email” following this link: https://github.com/ari/jobsworth
  14. Finishing up

    • sh update.sh
    • ***Note: Could someone please comment and let me know if I am able to setup the Email after I run the “sh update.sh”????  I’m not going to need email for a while, so I have not set it up this tutorial, but I will and I don’t want to have to start all over to just setup Email.  PLEASE PLEASE let me know if you know
  15. Start using JobsWorth 🙂

That will do it.  Hope this helps some folks out! 🙂

And again, a big thanks to the JobsWorth Dev Team – thanks for this great tool! 🙂

End of Line.

15 Comments

Gnome Icons in the Unity Bar

Problem:

I installed Cryptkeeper on my Ubuntu 11.04, but when I run it, the only way to manage it is through the icon it places in the top desktop bar, or Panel.  You know that top desktop bar that used to hold my wonderful applet icons, yeah this one:

Unity Desktop

Setup:

Ubuntu 11.04 64 bit (Natty Narwhal)

Asus G73JW-A1 (RoG)

Solution:

So if you want to see your icons in the top bar again, run this command from the Terminal, and once you’re done log out and back in:

gsettings set com.canonical.Unity.Panel systray-whitelist "['all']"

End of Line.

, , ,

Leave a comment

Install Node.JS on your Ubuntu Machine

So I recently heard about this thing called Node.JS.  To be honest, I’m a little skeptical, but I like what I have seen so far on the Node.JS website, and on some webcasts.

I like hands-on learning, so while I was going through the how-to videos I wanted to use Node.JS to follow along.  So, here are the steps to get Node.JS and Node Package Manager on your Ubuntu machine.

Here is my setup:

Ubuntu 11.04 64 bit (Natty Narwhal)

Asus G73JW-A1 (RoG)

I am installing on a VMWare Natty Narwhal 32 bit image.

1. Install some needed packages

You’ll need some packages from synaptic to start:

  1. curl
  2. libcurl4-openssl-dev

So open up Synaptic Package Manager, and install those 2 packages (and of course the dependencies too).  If you don’t know how to install the packages, you probably should not be trying to use NodeJS, stick with ASP.NET MVC 😉

2.  Install and Build NodeJS

So according to the webcasts I have seen, since NodeJS in “bleeding edge”, it is best to download and compile from the source.

Soooooo…..

  1. Go to http://nodejs.org/#download
  2. Copy link location
    • Nodejs Download Link Location
  3. Open up Terminal
  4. Enter your Downloads directory
    • cd Downloads/
  5. Enter the command in Terminal: curl -O, then paste the link you copied (should look like below)
    • Note: The version number in the link will most likely change as of the time of this writing
    • curl -O http://nodejs.org/dist/node-v0.4.7.tar.gz
  6. Once NodeJS is downloaded, unzip the file
    • tar -xvf node-v0.4.7.tar.gz
  7. Change Directory to Node Directory you just unzipped
    • cd node-v0.4.7/
  8. Configure and Make, the making could take a while, so go grab yourself a coffee after you run the make command
    • ./configure
      • if configure succeeds it should say: ‘configure’ finished successfully
      • Configure Succeeded
    • sudo make && sudo make install
    • Node Build Succeeded
  9. Verify NodeJS got installed
    • node --version
    • Node Version
  10. You now have Node.JS installed, you can delete the stuff you downloaded and unzipped

3.  Install Node Package Manger

  1. For starters we do NOT want to do Node Package Management with sudo, so according to this article, this is our first command
    • Open Terminal
    • sudo chown -R $USER /usr/local
  2. Install Node Package Manager
    • curl http://npmjs.org/install.sh | sh
  3. Verify Node Package Manager (npm) got installed
    • npm --version
    • Node Package Manager Install

Congratulations!  You now have NodeJS and Node Package Manger installed on you Ubuntu machine!  Time to start coding with NodeJS!  I don’t know how to yet, but you need to start somewhere 🙂

Please add comments or questions below.

End of Line.

1 Comment

Ubuntu One – “Maximum Upload Speed”

This applies to my installation:  Ubuntu 10.04 (Lucid Lynx):

If you’re an Ubuntu One user like me you probably had the urge to complain about the fact that Ubuntu One, when uploading, sucks the life out of your internet bandwidth.  To the best of my knowledge they are aware, and have been aware for a while, but no patch as of yet.  The screen I am talking about, of course, is this one:

Ubuntu One Preferences

Luckily there is a work-around!  A simple one even 🙂

In a nutshell here are the steps:

  1. Remove Ubuntu One from the “Startup Applications Preferences”
  2. Install “trickle” from Synaptic Package Manager
  3. Add this command as a Startup Program in the “Startup Applications Preferences”(Note: The number below is KB/s)
    • trickle -u 40 /usr/lib/ubuntuone-client/ubuntuone-syncdaemon
  4. Logout & Login or Reboot

Detailed Steps:

  1. System –> Preferences –> Startup Applications:  Uncheck Ubuntu One
    • Startup Programs
  2. System –> Administration –> Synaptic Package Manager:  Type in trickle in the search, right-click package, and Mark for Installation
    • trickle
  3. System –> Preferences –> Startup Applications:  Click Add
    • Startup Programs
    • Add the following text to the Command:
      trickle -u 40 /usr/lib/ubuntuone-client/ubuntuone-syncdaemon
      • Add Trickle To Startup
      • Click Add, and Trickle will be added to the Startup Applications
  4. Logout & Login or Reboot

Comments, questions, or corrections – always welcome 🙂

End of Line.

, ,

3 Comments

Copy Files from an Encrypted /home Directory

Ok it looks like I need to do a fresh install of Ubuntu 10.04.2 because of this issue.

But still I need to get some files off of my encrypted /home directory!

So after a bunch of searching, I found a solution!  So not a total loss.  I mean yeah I have to format (lame), but at least I learn how to recover my encrypted /home directory in case of catastrophe, like a Kernel panic  (-50 points Ubuntu).

All the credit goes to this guy’s (or gal’s) post on the Ubuntu Forums.  And he or she gives credit to someone else, and life goes on.

So I will be pretty much copying the post, but I wanted to add value on the parts where I was confused in hopes that it makes it easier for someone else 🙂

Let’s Begin!

I performed these steps on this machine:

Steps:

1.  Boot from Live CD

2.  Mount the hard drive or partition on which the encrypted home folder is stored. You can do this by browsing the Places menu; it will likely just be something like “100 GB Filesystem”, and it will be mounted to a directory similar to this “/media/04b67fb1-aafd-4082-aebc-493c509bdbe1”.  (just an example)

3.  Open a terminal window (Applications > Accessories > Terminal).

4.  Enter this:

sudo ecryptfs-add-passphrase –fnek

Note: At this point, you will be asked for your Passphrase. The Passphase is NOT the password you used to log into your computer.  The passphrase is that long-ass string of numbers and letters Ubuntu generates for you when you first log into your encrypted /home directory.  I hope you wrote it down. (example: 32by422a4b8e9x0x455uea97774x9e04)

5.  Now you will see output that looks like this:

Inserted auth tok with sig [9986ad986f986af7] into the user session keyring
Inserted auth tok with sig [76a9f69af69a86fa] into the user session keyring

Note: Copy the second string of characters in the brackets (yours will of course be different from the example I’ve provided) and make a note of it. You’ll need it to decrypt the names of your files. (Note: In a terminal window, Ctrl+Shift+C is copy and Ctrl+Shift+V is paste.)

6.  Create a folder on your Desktop to use as a mount point

mkdir Desktop/Mount

7.  Now your terminal should resemble this (remember Passphrase is to long-ass string I talked about above):

ubuntu@ubuntu:~$ sudo mount -t ecryptfs /media/04b67fb1-aafd-4082-aebc-493c509bdbe1/home/.ecryptfs/enter your username here/.Private Desktop/Mount
Passphrase:
Select cipher:
 1) aes:
 2) blowfish:
 3) des3_ede:
 4) twofish:
 5) cast6:
 6) cast5:
Selection [aes]:
Select key byes:
 1) 16
 2) 32
 3) 24
Selection [16]:
Enable plaintext passthrough (y/n) [n]:
Enable filename encryption (y/n) [n]: y
Filename Encryption Key (FNEK) Signature [9986ad986f986af7]: 76a9f69af69a86fa   (this was what you should have copied from above, paste it here)
Attempting to mount with the following options:
 ecryptfs_unlink_sigs
 ecryptfs_fnek_sig=76a9f69af69a86fa
 ecryptfs_key_bytes=16
 ecryptfs_cipher=aes
 ecryptfs_sig=9986ad986f986af7
Mounted eCryptfs
ubuntu@ubuntu:~$

Note: The very last thing you might be asked is if you are sure you want to mount.  If you think you entered the Passphrase wrong, or you think you messed up, type “no”.  Otherwise type “yes”.

8.  Ok, try to copy your files

  • Press Alt + F2 on the keyboard
  • Enter:  
    gksudo nautilus
  • Navigate to  “/home/ubuntu/Desktop/Mount”  and try and copy your files. If you cannot copy due to permissions, go to step 9

9.  Now that is mounted you’ll need to change permissions so you can copy the files

  • Press Alt + F2 on the keyboard
  • Enter:  
    gksudo gnome-terminal
  • In the terminal type:
sudo chown root -R /home/ubuntu/Desktop/Mount
sudo chmod 755 -R /home/ubuntu/Desktop/Mount
  • Try step 8, and you should be able to copy files if you were not able to earlier.

So that should do it! 🙂  If you have a better way, please comment 🙂

Good luck!

End of Line.

Leave a comment

Kernel panic – not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

Let’s be honest, am I totally screwed?

I rebooted my Ubuntu PC, because VirtualBox was locking up on me, and I get this wonderful message on a lovely black screen:

Kernel panic – not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

Now I have completely migrated to Ubuntu; I’m not dual-booting.  I am no Linux expert, nor am I high adept with Linux, but I’m not a moron either.  So like a good neighbour Google and the Open Source Community is there 🙂

If anyone can point me in the right direction, please comment.

Either way I will be posting updates, as I figure out what to do.

End of Line.

———————————-

Update:

From what I gather this issue may have to do with GRUB2.  So I followed the instructions at this link:

https://help.ubuntu.com/community/Grub2#Reinstalling%20from%20LiveCD

I tried all three methods mentioned for reinstalling GRUB2, unfortunately none of them solved the issue 😦

Since I need my PC up and running sooner than later, I am going to reinstall Ubuntu 10.04.2 – good thing I keep it all backed up on the cloud (thanks Deja Dup & Ubuntu One) 🙂

End of Line.

, ,

Leave a comment