no such file to load — readline (LoadError) when running script/console

Ruby on Rails, Ubuntu/Linux 5 Comments »

If you get

Loading development environment (Rails 2.3.2)
/usr/local/lib/ruby/1.8/irb/completion.rb:10:in `require’: no such file to load — readline (LoadError)
        from /usr/local/lib/ruby/1.8/irb/completion.rb:10
        from /usr/local/lib/ruby/1.8/irb/init.rb:252:in `require’
        from /usr/local/lib/ruby/1.8/irb/init.rb:252:in `load_modules’
        from /usr/local/lib/ruby/1.8/irb/init.rb:250:in `each’
        from /usr/local/lib/ruby/1.8/irb/init.rb:250:in `load_modules’
        from /usr/local/lib/ruby/1.8/irb/init.rb:21:in `setup’
        from /usr/local/lib/ruby/1.8/irb.rb:54:in `start’
        from /usr/local/bin/irb:13

when running script/console, you might be missing some libraries after you’ve installed Ruby from source. So you might try (Ubuntu, Debian):

sudo apt-get install libncurses5-dev

sudo apt-get install libreadline5-dev

Then cd to the folder with your unpacked Ruby sources, subfolder ext/readline:

cd /usr/src/ruby-1.8.7-p72/ext/readline

ruby extconf.rb

make

sudo make install

There is no need to recompile Ruby. If you get any of these:

checking for tgetnum() in -lncurses… no
checking for tgetnum() in -ltermcap… no
checking for tgetnum() in -lcurses… no
checking for readline/readline.h… no
checking for editline/readline.h… no

you’re still missing libraries so re-check if the apt-get commands above completed without errors. Hope it helps.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Erratic Screen Brightness with Ubuntu/Linux Mint

Ubuntu/Linux No Comments »

If your screen brightness erratically resets itself every few minutes, try the following (found here):

1. Press ALT + F2 to open the run dialog.

2. Type gconf-editor and press ENTER, to open the gnome “registry”.

3. Navigate to APPS -> GNOME-POWER-MANAGER -> BACKLIGHT

4. Uncheck the item named enable

5. Close the window.

 
[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Installing PostgreSQL 8.3 on Linux Mint/Ubuntu, Some Tips

PostgreSQL, Ubuntu/Linux 6 Comments »
del.icio.us Tags: , ,

Update: The below instructions are outdated as it’s now much easier and safer to install a now stable backport package for PostgreSQL-8.3. To learn more about backports, visit this page and enable the backport repository for your Linux distribution. You can then install via the package manager or apt-get. Or just try

sudo apt-get -t sarge-backports install postgresql-8.3

The latest version of PostgreSQL can’t yet be installed on Ubuntu (Linux Mint) via apt-get install of a mature Debian package, so the process is a little more involved and somewhat challenging for a Linux newbie such as I. Here are some hints:
The article 10 Steps to Installing PostgreSQL is very helpful and mandatory if you’re not that familiar with installing packages manually on Linux. Then this forum post has some additional hints and is geared towards 8.3.
So here are my ten steps:

  1. Do a
    sudo apt-get install build-essential

    which really is essential for installing source packages.
  2. Download libxml sources which you have to install as the installation on Gutsy Gibbon is faulty (see the “forum post” quoted above for details), so from your download dir
    sudo mv libxml2-sources-2.6.31.tar.gz /usr/local/src
    cd /usr/local/src
    sudo tar -xzvf libxml2-sources-2.6.31.tar.gz
    cd libxml2-2.6.31
    ./configure
    make
    sudo make install
  3. Download a postgresql-8.3.0.tar.gz from a mirror listed here.
  4. Then from your download directory
    sudo mv postgresql-8.3.0.tar.gz /usr/local/src
    cd /usr/local/src
    sudo tar -xzvf postgresql-8.3.0.tar.gz
    For an explanation see the “10 Steps” article.
  5. Configure and install PostgreSQL:
    cd /usr/local/src/postgres-8.3.0
    ./configure –with-libxml –without-readline –without-zlib –with-libraries=/usr/local/lib
    make
    sudo make install
    Hopefully you’ll get a “PostgreSQL installation complete.”
  6. Do user related stuff:
    #create the postgres user
    sudo adduser postgres
    sudo mkdir /usr/local/pgsql/data
    sudo chown postgres /usr/local/pgsql/data
  7. Change to the postgres user and continue
    #change to the postgres user
    sudo su - postgres
  8. The rest is verbatim from the forum post:
    #initialize the data directory
    /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
    cd /usr/local/pgsql/data#create the log dir
    mkdir log

    #sample to start the server
    /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data >/usr/local/pgsql/data/log/logfile 2>&1 &

    #create a sample database
    /usr/local/pgsql/bin/createdb mysampledb

    #now test it
    /usr/local/pgsql/bin/psql mysampledb


    You’re all set and the database server should be running.

  9. You might wanna create a new password for the postgres user:
    sudo passwd postgres
  10. Then you can connect with pgAdmin III
    File > Add Server
    address: localhost
    Description: my beautiful server or whatever
    Password: do you remember?
    Click OK
  11. OK, these go to 11:To start the server automatically at every boot, simply add:
    su -c ‘/usr/local/pgsql/bin/pg_ctl start -l /usr/local/pgsql/data/log/logfile -D /usr/local/pgsql/data’ postgres
    to your /etc/rc.local file. More info is here.

    Hope it helps.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Ubuntu in an Active Directory Windows Domain

Ruby on Rails, Ubuntu/Linux No Comments »

Ok, the title’s a bit contrived. It’s for the keywords, mainly.

Anyway, to have an Ubuntu machine in your network environment has a number of benefits:

  • Learning Linux and trying out Linux software which for the most part is high-quality (and free).
  • Have a staging server for your Ruby on Rails applications.
  • Having an SSH access point into your network for (limited) remote administration, much easier to set up (less secure though) than VPN.

You can either have a full installation of Ubuntu on one of your network machines or you can use virtualization. I’m using the latter as it can leverage the more performant server hardware.ne

As you can now get a free license key for VMWare server, you can take the following steps to host Ubuntu in your network:

  • Download and install VMWare server.
  • Download an Ubuntu .iso image, desktop, server, whatever, any version can be easily extended later.
  • Create a Virtual Machine in VMWare server using this .iso image. Be sure to use enough RAM (256 MB is minimum to run Ubuntu) and disk space (minimum 5 GB to have some space left after installation, the days of Linux fitting on a few hundred MB are definitely over). I initially could not get a bridged network connection working and had to use the NAT option in VMWare to get Ubuntu connect to the host server and the Internet. After installing the desktop I can now use the bridged network option without problems. Network and Internet connection are vital for Ubuntu so get those straightened out before you proceed.
    If you downloaded the server version you might want to install a desktop with the command:
    sudo apt-get install ubuntu-desktop
    This makes many things easier down the road.
  • Join your Ubuntu machine to the domain. Follow the instructions here and here in PARALLEL as one will make the other easier to understand. You should then be able to see the the Ubuntu machine on your Windows Active Directory Domain and ping it.

You will soon experience first-hand that Windows comes in a shiny package but (quite a few) things DON’T WORK as expected, so often it’s off to the Knowledge Base again. In Linux (most) things JUST WORK. And because much of the work is done on the command line you get much better and friendlier error messages that the Windows Message Boxes all over the screen.

You can now connect to your Ubuntu installation with a VNC client (Ubuntu has an VNC server built in via the Remote Desktop app) and also get an SSH (Secure Shell) windows client such as the excellent PuTTY which gives you shell access to your Ubuntu box. You can also set VMWare server to start the Ubuntu VM automatically when your Windows host OS starts via VM>Settings>Options>Startup/Shutdown and setting Run this virtual machine as: to anything but “User that powers on this virtual machine”.

image

In my next post I will outline how to get Ruby on Rails running on the Ubuntu box and using Capistrano to deploy from a Windows workstation.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]
WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in