Showing posts with label Setup. Show all posts
Showing posts with label Setup. Show all posts

Thursday, November 20, 2008

Ubuntu 7.10 + Git

I got curious and wanted to start playing with Git after hearing about it in the community for a while now. This is how I did it:

sudo apt-get install git

This will get the version 1.5.* from the Gutsy repos. This is old, so I decided to upgrade it.

git clone git://git.kernel.org/pub/scm/git/git.git

This will create a git folder. But first, we need to install some dependencies:

sudo apt-get install zlib1 zlib1-dev openssl libcurl3 libcurl3-dev libexpat1 libexpat1-dev asciidoc xmlto

Next, it's time to install Git. You can install Git either for the local user or for the global system. I decided to install it globally:

cd git
make configure
./configure
make all doc
sudo make install install-doc install-html

This should run for a while. You can sit back and pretend you understand all the output, or you can now go grab a coffee. After it completes, you can do a

git --version

to check if Git was updated. Now, time to play!


W

Friday, October 17, 2008

VMware Server: Adding a USB

Ever wondered how to add USB capability to your VMware server? Well, I had a little bit of a problem trying to get my USB connected.

I had gone to the settings for my VM and added the USB controller. Then, when I booted up my VM, I went to

VM > Removable Devices > USB Devices > ...

To my surpise, it was empty! I knew my device was plugged in because my Ubuntu detected it, but I couldn't see it. After searching around, I found a solution:

1. power off your VM
2. unplug your USB
3. >sudo gvim /etc/init.d/mountdevsubfs.sh
4. uncomment lines 42-45 (starts off with #mkdir -p /dev/bus/usb/.usbfs...)
5. >sudo /etc/init.d/mountdevsubfs.sh start
6. start your VM
7. plug in your USB
8. add your USB to the VM

Good luck!


W

Thursday, July 17, 2008

Gedit

As promised, here is a list of the plugins that I have been using for gedit:

- change case
- code comment
- document statistics
- embedded terminal
- file browser pane
- indent lines
- insert date/time
- join/split lines
- line tools
- modelines
- rails hot commands
- rails hotkeys
- regex search (files)
- reopen tabs
- session saver
- snap open
- snippets
- spell checker
- split view 2
- todo list
- word completion

Wow! That's a long list. I've also enhanced my snippets for my personal use. I suggest you do the same. They do wonders in saving time ;)

If you got any gedit setups, leave a comment. It would be nice to see the variety of setups!


W

Saturday, May 10, 2008

VMware Server: Adding a new HDD

I'm running WinXP through VMware Server (as it comes free and is in the Ubuntu repos!!!). It runs really, really well and am completely satisified with it. However, I wanted to add a new HDD to my VM.

Well, I did the obvious, which was to power down my VM and edit the settings. I went to go add a new vitual HDD and pre-allocated it (all the defaults).

I then powered on my VM and lo-and-behold, no new disk! What?!?!?! Well, I found a very nice little tutorial on YouTube that teaches you how to do it properly. Apparently, there's a few extra steps required inside of WinXP to detect and setup the newly added disk:

http://www.youtube.com/watch?v=z3GciNMYLlo

Hopefully, this'll help anyone that is stuck.


W

Wednesday, May 7, 2008

Ubuntu + Ekiga

Ubuntu comes bundled with Ekiga, which is a VoIP program. It is something like Skype. I wanted to test this out and see how well it worked. I had a little bit of a problem configuring it though and would like to share my solution.

When using the configuration assistant, I was stuck at step 5, which told me that I had a symmetric NAT. If you don't run into this problem, then the configuration should go smoothly and you should have no problems. Anyways, back to my problem. Ekiga cannot run with a symmetric NAT. If you find any scripts to run in order to get Ekiga working, DO NOT run it. I tried one that I found on a wiki, and I lost my internet connection. It basically changed my iptables. No worries though if you did... just reboot your machine and everything will be reset back to a working state.

The script was made for older versions of Ekiga (much older) and is now of no use. The easiest way to get Ekiga working is to use port triggering on your router:

Service Name: STUN (or anything you like)
Triggering Port: 3478 (UDP)
Inbound Ports: 5000-5100 (UDP)

This should do it. Rerun step 5, and it should not report a Cone NAT. This is now acceptable and you can continue with the configuration.

Enjoy!


W

Monday, April 28, 2008

Deployment: Part 2

As I mentioned in the last post, we got past SVN.

We finally came to Mongrel Cluster. This was a major headache. Apparently, Capistrano is broken when it comes to handling Mongrel Cluster. Simply following the Capistrano's site tutorial will not work.

The first step around this was to get the Palm Tree gem on the local machine:

>sudo gem install palmtree

This will include some recipes that we can use with our deploy.rb that you need to run Capistrano.

Next, add this to the top:

require 'palmtree/recipes/mongrel_cluster'

This will include the recipe needed to fix the deployment scripts. Basically, it rewrites the deploy script that comes with Capistrano. All you really need to know is that it works ;)

Next, generate a mongrel_cluster.yml by following the "Mongrel Cluster Setup" in this wiki. Check this into your repository as we'll need it.

Add this line to your deploy.rb:

set :mongrel_conf, "root_of_the_app/config/mongrel_cluster.yml"

Last thing we need to add is to tell Capistrano not to use sudo:

set :use_sudo, false

When all this is finally done, make sure that everything is in your repository. We can now attemtp a deploy:

cap deploy:cold

Make sure you use cold, as this should be the first time you're deploying. A deploy:cold is different than a simple deploy because it assumes that your servers are not running yet. Hopefully everything went right here. This should get you past Mongrel Cluster.

The next would be take a look at how to customize your deploy, such as starting other servers that you would potentially need.

We found the "after_stop", "after_start", and "after_restart" helpful for handling our other servers. Make sure that you put them in the deploy namespace ;)

Good luck!


W

Saturday, April 26, 2008

Deployment: Part 1

So we're nearing the stage of our deployment and decided to perform a dry run on J's spare computer. We installed the Ubuntu server on his machine, along with all the stuff we needed (SSH, Ruby, Rails, gems, etc.)

We then decided to go with Ubuntu server + Apache + Mongrel Cluster + Capistrano for an action-packed deployment. We decided on Ubuntu since we have had such a good impression with them and have had experience with troubleshooting on an Ubuntu machine. Apache + Mongrel Cluster seems to be a fast-growing standard, although there are many configurations to choose from. We had been doing research and found that this configuration would be the most painless. As well, this configuration is supposed to handle very well. We used Capistrano to help with our deployment and to make maintenance much easier when deploying on a remote server.

Basically, the whole setup revolved around Capistrano. So... off we went to figure out how to use it. This took us a very long time as we had to troubleshoot some problems.

The first problem that was not even mentioned on the Capistrano site was logging into the remote server with a particular username. In the examples, they simply say to just use:

role :app, my.server.com

However, this will log you into the remote server with the username you have with the local machine. This is not what we wanted, so we ended up having to attach the username in front:

role :app, username@my.server.com

Next, when the server was trying to checkout our repository from SVN, it crapped out. We added this to our deploy.rb to get around this:

default_run_options[:pty] => true

Now, our deploy ran fine, until we got to Mongrel Cluster T.T

Hopefully this will get you out of the rough, unless you're using Mongrel Cluster, which I'll cover in the next post.


W

Saturday, February 16, 2008

Ubuntu + No-Ip

If you're running no-ip to update your IP address, you can get it on Ubuntu as well. Use this very helpful tutorial:

http://ubuntulinuxhowto.blogspot.com/2006/06/dynamic-dns-no-ip.html


W

Friday, February 15, 2008

Ubuntu Java Applets

When surfing websites, there are often times when you come across Java Applets. In Firefox, it will ask you to download a plugin. This downloads something called IcedTea.

Well, apparently, it doesn't quite work with a 64-bit machine. I'm not sure about 32-bit machines, but at least on my machine (a 64-bit), it doesn't work. I finally came across a bug that was reported on Ubuntu... and luckily, a fix!

>sudo apt-get build-dep icedtea-java7-plugin
> sudo apt-get -b source icedtea-java7-plugin icedtea-java7-bin icedtea-java7-jre icedtea-java7-jdk
> sudo dpkg -i icedtea-java7-*deb

Word of warning though, this takes a very long time. And by very, I really do mean VERY. After you execute the second line, go for lunch or take a nap. Hopefully it'll be done by the time you get back ;)

After executing the last line, I got a software update message from Ubuntu for the IcedTea plugin. I hit install, and it updated everything for me, and everything works.

To test if it worked, try this:

www.java.com/en/download/help/testvm.xml


W

Wednesday, February 13, 2008

Ubuntu + Eclipse: Round 2

Ok... so apparently, I was having all sorts of problems with my first installation of Eclipse 3.3. I was getting a whole crap load of exceptions in the logs. Also, every so often, my Eclipse would freeze, then shut down on me without notice, sometimes bringing down Ubuntu as well. Not to mention it didn't save any unsaved data (ARGH!!!).

So... I scrapped it! I removed Eclipse from my system... which took FOREVER. I did:

>sudo apt-get remove --purge eclipse
>sudo apt-get autoremove
>sudo apt-get autoclean

Then I went into /usr/lib and /usr/share to make sure the eclipse folder was gone. I then removed my workspace .eclipse folder. After this, I went into Synaptic package manager and completely removed all Eclipse packages and Sun Java 6 packages. And by all, I mean EVERYTHING!

I then reinstalled Eclipse and Sun Java 6 about 5 or 6 times using Synaptic, with no luck. Eclipse 3.2 wouldn't even start up. It kept complaining about a BundleException. No idea what that was. I finally gave up with Synaptic and went back to apt-get.

>sudo apt-get update
>sudo apt-get dist-upgrade
>sudo apt-get eclipse
>sudo apt-get sun-java6-jdk

Then I added /usr/lib/jvm/java-6-sun to the beginning of the lists in:

>sudo -b gedit /etc/jvm
>sudo -b gedit /etc/eclipse/java_home

I then ran eclipse using the following:

>eclipse -clean

which gave me an error:

searching for compatible vm...
testing /usr/lib/jvm/java-6-sun...found
Could not create /usr/local/lib/eclipse/.eclipseextension. Please run as root:
touch /usr/local/lib/eclipse/.eclipseextension
chmod 2775 /usr/local/lib/eclipse/.eclipseextension
chown root:staff /usr/local/lib/eclipse/.eclipseextension

So I did:

>sudo touch /usr/local/lib/eclipse/.eclipseextension
>sudo chmod 2775 /usr/local/lib/eclipse/.eclipseextension
>sudo chown root:staff /usr/local/lib/eclipse/.eclipseextension

Then ran again:

>eclipse -clean

This time, Eclipse 3.2 started up with no exceptions in the logs! YAY!

Not done yet... will try to install Aptana + RadRails + SubClipse now... wish me luck!

UPDATE:
After installing Aptana, everything seems to be running fine. Eclipse did not shut down on me... so I continued to install RadRails.

After installing RadRails, I checked the logs, and I got several exceptions. As I continued to use Eclipse, I continued to get a whole load of errors. However, Everything continued to work fine. I'm not sure what the error messages are, but they weren't bothering me, so I decided not to bother them!

Next came SubClipse. This installed without problems as well! And now I'm happily coding away again! Yay! Nightmare over! ...for now...


W

Ubuntu Firefox Fonts

After moving to Ubuntu, our website was completely out of alignment when using Firefox. We had set our default the usual:

font-family: Arial, Helvetica, sans-serif;

Of course, Arial is a MS font. We decided that as a linux user, you would be expected to know how to tweak your computer, and hence it is reasonable to expect a linux user to know how to change their fonts.

To use Arial in your Firefox, do the following:

>sudo apt-get install msttcorefonts

and wait for a while. Maybe go have a coffee ;)

Afterwards, log out and log back in so that the new fonts can be loaded.

Next, you have to let Firefox know you want to use Arial. Go to:

Edit > Preferences > Content > Fonts & Colors > Advanced

Then change what you want to Arial. I set my serif and sans-serif to Arial. This seemed to do the trick, at least for our website.


W

Tuesday, February 12, 2008

Ubuntu and MP3s

Using the prepacakged Rhythmbox Music Player, I attempted to import my MP3s. However, I got a GStreamer plugin error that it couldn't handle MP3s.

For MP3 support, do the following:

>sudo apt-get install gstreamer*

Now start your Rhythmbox again. ;)

Rhytmbox also supposedly supports syncing with your iPod. I have yet to try, and will report on this issue once I have tried it out.


W

Ubuntu Input Languages

For those that want to be able to type in Chinese, Japanese, or Korean, Ubuntu comes with a prepackaged application called SCIM. There is, however, a trick needed to get it working properly.

Go to System > Administration > Language Support. Then select the languages you want. Check the Enable support to enter complex characters. If it s already checked, you must uncheck it, click Apply, then recheck it. Hit Apply now. Log out and log back in.

Now you should see a little icon in the top right that looks like a keyboard. That's good. Supposedly, you can now hit Control + Space, and it should toggle through your input options. However, in Ubuntu 7.10, it doesn't.

Do the following:

>sudo gedit /etc/X11/xinit/xinput.d/scim

Change:

GTK_IM_MODULE=xim
QT_IM_MODULE=xim

To:

GTK_IM_MODULE="scim"
QT_IM_MODULE="scim"

Save and exit. Log out and log back in.

Now, when you're at an input, you can simply hit Control + Space, and it will toggle through your input options.

Enjoy!


W

Ubuntu + Eclipse 3.3 (Europa)

When using

> sudo apt-get install eclipse

there are several problems. Firstly, eclipse doesn't inherently use Sun's Java. This results in a "slow Eclipse". Secondly, using this command gives you Eclipse 3.2, not 3.3.

So, this is what I did:

Download Eclipse 3.3 straight from the Eclipse website (I got the classic version). Extract the tarball, and you have a working, standalone Eclipse 3.3.

However, it is not integrated into Ubuntu and it's still not using Sun's Java. Follow the instructions from the first post of this thread.

Eclipse should now be integrated into Ubuntu, but this is still version 3.2.

We will now overwrite 3.2 with our downloaded 3.3:

>sudo cp -R ~/Desktop/eclipse/* /usr/lib/eclipse/

Now that we have 3.3 installed and integrated into Ubuntu, there is one more step to do. When doing software updates, Eclipse needs to create and install new files. This can be troublesome with the wrong permissions. I went through a number of hacks, none of which worked, so I finally settled for opening up all permissions in the Eclipse install directory:

>sudo chmod 777 -R /usr/lib/eclipse

Voila! After this is complete, you may start to use Eclipse and install other plugins.


W

Monday, February 11, 2008

Ubuntu Ruby Gems

From a previous post on moving to Ubuntu by J, there was a mention of installing Ruby Gems.

Well, I came across an error when executing:

> sudo gem update --system

It complained of a Gem::GemNotFoundException. I found a quick fix for this which was to do the following:

> sudo gem update
> sudo gem update --system

This seemed to do the trick.

After the update though, there was another error when executing:

>gem -v

to check the version. The error was "uninitialized constant Gem::GemRunner (NameError)". Another quick fix for this one was to add an extra line to /usr/bin/gem

require 'rubygems/gem_runner'

after

require 'rubygems'

Probably more problems and solutions to come later ^^


W

Ubuntu sources.list

Just an extension to a previous post by J about installing applications in Ubuntu. If the sources in sources.list are giving you troubles, take a look at this Gutsy Gibbon help guide.

Scroll down to the Manual Method for Adding Repositories. After following this, everything installed correctly.

Also, to be noted is that my previous source list all had Canadian mirrors. These mirrors are sometimes not up to date, slow, or down.


W

Ubuntu Dual Display

When I first installed Ubuntu, I checked out the visual effects. I was anticipating many cool features. I set it to the highest setting, and everything worked fine. I then did

> sudo apt-get install compizconfig-settings-manager

to get the configuration settings manager. This allows you to customize your desktop effects. All was going well, until I decided to get my dual screen setup running... Big mistake!

Turns out, my xorg.conf wasn't set properly. I tried using the Screen and Graphics configuration window provided by Ubuntu, but could not get it to work. What was happening was that I couldn't turn on ANY desktop effects at all. I did, however, see my dual screens displayed, but I wanted the cool effects!

After mucking around for a bit, I finally found a configuration that worked for my setup.

I added a few options to my graphics card device to support Twinview (instead of using Xinerama). TwinView allows you to extend your desktop to the 2nd monitor while treating it as the same window. After hooking everything up, logged out, then in, and everything worked like a charm.

Here's what I have in my xorg.conf:

Section "Device"
Identifier "card0"
Driver "nvidia"
VendorName "nVidia Corporation"
Boardname "geForce 7600 GT"
Busid "PCI:1:0:0"
Option "NoLogo" "0"
Option "RenderAccel" "true"
Option "HWcursor"
Option "CursorShadow"
Option "CursorShadowAlpha" "32"
Option "CursorShadowXOffset" "3"
Option "CursorShadowYOffset" "3"
Option "AllowGLXWithComposite" "true"
Option "TwinView"
Option "MetaModes" "1600x1200,1024x768; 1600x1200,1600x1200; 1600x1200; 1280x1024,1280x1024; 1280x1024; 1024x768,1024x768; 1024x768; 800x600,800x600; 800x600"
Option "TwinViewOrientation" "RightOf"
Option "SecondMonitorHorizSync" "UseEdidFreqs"
Option "SecondMonitorVertRefresh" "UseEdidFreqs"
EndSection

Section "Screen"
Identifier "screen0"
Device "card0"
Defaultdepth 24
Monitor "LCD MAG"
SubSection "Display"
Depth 24
Modes "1600x1200@60" "1400x1050@60" "1280x960@75" "1280x1024@60" "1280x960@60" "1280x1024@75" "1152x864@75" "1024x768@60" "1024x768@70" "1024x768@75" "832x624@75" "800x600@60" "800x600@75" "800x600@72" "800x600@56" "640x480@75" "640x480@72" "640x480@60"
EndSubSection
EndSection

Section "ServerLayout"
Identifier "twinview"
Screen 0 "screen0" 0 0
Inputdevice "Generic Keyboard"
Inputdevice "Configured Mouse"
Option "Xinerama" "0"
EndSection

The "LCD MAG" is my primary monitor.

For more information, take a look at Dual Monitors and Twinview Example.

Just to let you know, I have a nVidia GeForce 7600 GT. Twinview is used with nVidia. If you have another graphics card, you're on your own :P


W

Friday, February 8, 2008

Moving to Ubuntu, ditching windows

We are trying to install juggernaut, a ruby push server which allows real time conversation with users (something like google chat). However, the gem doesn't seem to work in windows environment, so to hell with it, we are moving our stuff to ubuntu.

why ubuntu? I don't know, it was a random choice :)

if you install ubuntu without internet connection,
the entire source list will be commented out

if that's the case, we need to edit it by doing
~$ sudo vi /etc/apt/sources.list

uncomment all the links inside, save and exit

now we will update the list

Before we start installing rails and all its gems
we need to update our current libs and software to the latest version first

~$ sudo apt-get update
~$ sudo apt-get dist-upgrade (this will take awhile)

now we will install openssh so you can access your box from else where

~$ sudo apt-get install openssh-server openssh-client

we also need subversion to check in our work and install plugins

~$ sudo apt-get install subversion

to install postgres

~$ sudo apt-get install postgresql
~$ sudo apt-get install pgadmin3

~$ sudo su postgres -c psql template1
template1 =# ALTER USER postgres WITH PASSWORD 'something'
template1 =# \q

this will alter the password within the database, now we do the same for ubuntu

~$ sudo passwd -d postgres
~$ sudo su postgres -c passwd

now we setup the postgres admin pack for loggin and monitoring within pgAdmin

~$ sudo su postgres -c psql < /usr/share/postgresq/8.2/contrib/adminpack.sql

now we edit the configuration file

~$ sudo vi /etc/postgresql/8.2/main/postgresql.conf

uncomment password_encryption = on

save with :wq

tired yet? if not, we are now ready to install ruby and rails

to install ruby we do

~$ sudo apt-get install ruby rdoc irb libyaml-ruby libzlib-ruby ri libopenssl-ruby

then we will install rubygems, apt-get will give you version 0.8.x or something outdated, don't panic, we'll get the gem to update itself

~$ sudo apt-get install rubygems
~$ sudo gem update --system

now we'll install rails and it's dependencies

~$ sudo gem install rails --include-dependencies

and that's it, you can pretty much stop here and relax, but for those who wants to install some of the essential gems, please keep reading

everyone know webrick sucks, so we'll install mongrel

~$ sudo apt-get install build-essential
~$ sudo apt-get install ruby1.8-dev
~$ sudo gem install mongrel

in order to connect to the db, we need to install the postgres driver

~$ sudo gem install postgres-pr

for fast debugger, we'll also need ruby-debug-ide

~$ sudo gem install ruby-debug-ide

TzInfo

~$ sudo gem install tzinfo

ImageMagick and RMagick

~$ sudo apt-get install imagemagick
~$ dpkg -l | grep magick (if you don't do this, rmagick won't know it's installed)

~$ sudo apt-get install libmagick9-dev
~$ sudo gem install rmagick -v=1.15.12

and finally for the stuff we want :)
JUGGERNAUT!!!

~$ sudo gem install json
~$ sudo gem install eventmachine
~$ sudo gem install juggernaut

J

Wednesday, December 19, 2007

Introducing Rails 2 - Part 1.5

For those who have tried to install rails 2.0 and find it acting all weird afterward. It's probably because you updated rails with an out of date rubygem

if you are having trouble with rails 2.0, you can do a quick check on your rubygem by typing

gem --version

If it's version 0.9.4 or below, then you should update your gem and reinstall rails. You can update rubygem with the following command

gem update --system

This might take awhile, so be patience. After it's done, check the version again by doing

gem --version

and make sure it's at version 1.0.0. Now you can reinstall rails 2.0 by typing

gem install rails --include-dependencies

There's a problem with the old gem, it will only install the rails core for you but skipping ActiveRecord, ActiveResource, and Rake

For those who have an existing project, go into environment.rb and make the following change

RAILS_GEM_VERSION = '2.0.2'

give this a try, it works for me


J

Monday, December 17, 2007

Introducing Rails 2 - Part 1

W and I have decided to upgrade to rails 2.
All you need to do is to type in this command in your command prompt

gem install rails -y --source http://gems.rubyonrails.org

and ruby gem will handle the rest.
After the upgrade is completed, type

rails -- version
to check if it's 2.0.1
and that's it, you are done :)

So before we look at all the new features in rails 2, let's first find out
what has been removed.

1. @params should be replaced with params
eg: params[:data] instead of @params[:data]

the same goes for @flash, @session, @env, and @request

2. find_all & find_first should be replaced with find(:all) & find(:first)
eg: User.find(:all) instead of User.find_all
User.find(:first) instead of User.find_first
note: User.find_by_xxx is still valid

3. acts_as is gone
they are plugins now

4. render_partial should be replaced with render :partial
eg: render :partial => "user" instead of render_partial "user"

5. start_form_tag and end_form_tag should be replaced with form_for or form_tag

you can check out the api description here
http://api.rubyonrails.com/classes/ActionView/Helpers/FormHelper.html#M000920

6. Pagination is gone
mainly cause it sucks (slow)

on the bright side, there are faster and cleaner pagination plugins available
the one I'm currently using is called will_paginate and it can be found at
http://rock.errtheblog.com/will_paginate


7. components are gone

8. Database adapters are gone
you can download the one you need at
http://svn.rubyonrails.org/rails/adapters/

if you are planning to upgrade, go through your codes
to make sure it's rails 2 compatible.

if you are not sure, you might want to upgrade to rails 1.2.6 first,
where they marked everything that will be removed as a deprecated function.


J