Archive

Posts Tagged ‘gentoo’

openSuSE – system that works

April 28th, 2009 Comments off

Recently I got irritated with my Gentoo installation, long story of problems I meet …

So I have decided to go back to openSUSE, the way was not easy, first I have tried to install from openSUSE 11.1 Live KDE CD, but it was not working with my BIOS raid setup. I was a bit upset, SUSE always gave me best working environment in short time, so I have tried with new development build 66.

This was good choice, installation was working perfect, I was also surprised by the improvements, the best example is partitioning screen which gave me feeling that my system knows what I want to archive, just have a look on the screen Raid disk layout

Comparing to Gentoo SuSE is a bit slower, the best example is start time of OpenOffice writer, on Gentoo it was up and ready to work in less then 3 seconds, on openSUSE it takes 5 seconds to show document. But this is not a big issue compared to times spent in Gentoo to configure “make.conf” or just build OpenOffice.

But the most important for me now is set of configuration tools from YAST, I can configure whole system with easy to use GUIs but still have control over my system.

From interesting features I would point out Xen working with nice GUI, will try it out in few days as it should be good alternative to VMWare Server.

On the end small explanation what does build 66 stand fore it is: “openSUSE 11.2-Milestone1“, verion 11.2 is planned for November 2009, so holpfully there will come even more interesting features.

Categories: Linux Tags: , , , , , , ,

Preparing Ruby on Rails environment – firstapp

February 1st, 2009 2 comments

Now as we have all the environment prepared we can start with example application to check if everything is working.

For Begining we can check if postgres is working:

/etc/init.d/postgresql-8.3 status

If You did not added it to autostart it’s probably stopped, so You can start it with:

/etc/init.d/postgresql-8.3 start

And if it is not a big problem to have it running all the time add it to autostart:

rc-update add postgresql-8.3 default

Additional is needed as my previous instructions require additional step – adding postgresql support in ruby:

gem install postgres

Referring to my friend Andrzej instructions it should be ruby-pg, I’m not sure which one is better.

Following steps are very similar to instructions at netbeans docs so You can open it in separate window to have an overview of the GUI side.

Open netbeans from the console (in most distros netbeans will be in Yours applications menu and may be available on desktop):

/path_to_netbeans-6.5/bin/netbeans

Right click the empty area within Projects tab and choose “New Project”, there choose “Ruby” -> “Ruby on Rails Application” and click “Next >”. On the next screen You cna change nam of the application, You do not have to change all the params there, just click “Next >”. Following screen is “Database Configuration”, here You have to change the “Database Adapter” to “postgresql” enter Yours user name in the field “User Name” and press “Finish”.

That is Yours first application, now we will use famous functionality of rails – scaffold, right click the new project and select “Generate…”. From the “Generator:” list select scaffold, enter “Person” in “Model Name:”, enter “name:string” in “Attribute Pairs (field:type):” and press “OK”.

Worth explanation is feature of rails called pluralization, You can see in Models, that there is person.rb model, but in Controllers You have people_controller.rb controller, this is because rails calls “person”.pluralize before applying the name for controller or view. You can check this by navigating to the project “cd ~/NetBeansProjects/RailsApplication1” and entering “script/console”, here You can play with rails and Yours application.

Now after we have automaticly generated code of application we can continue with creating database for the application. Right click Your application, choose “Run/Debug Rake Task”, now choose “db:create” from the list and click the “Run” button. Ther will be no preaty message “Database created successfully”, but if You did not got any error message in few seconds it means everything went fine. Next step is to migrate database to current state – right click project, select “Migrate Database” -> “To Current Version”. In the output You should find somthing like this:

(in /home/mpapis/NetBeansProjects/RailsApplication1)
NOTICE:  CREATE TABLE will create implicit sequence “people_id_seq” for serial column “people.id”
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index “people_pkey” for table “people”
==  CreatePeople: migrating ===================================================
— create_table(:people)
-> 0.0209s
==  CreatePeople: migrated (0.0210s) ==========================================

The database is prepared for our application, now we have to change few default settings to make person the most important in our application. Please open Configuration / routes.rb file by double clicking it. Start search by CTRL+F in the Find box enter “map.root”, uncomment the found line and change “welcome” to “people”. Last step is to rename the auto generated index.html file in the public folder, right click the file, chose rename and add suffix “_old” to the displayed index in the edit box.

Thats all, click the green triangle in the toolbox on the top of netbeans. This should open Your browser with the new app, You can check it by navigating through it.

Small hint for Firefox users, there might be needed change in netbeans to open correctly – please anvigate to Menu “Tools” -> “Options” choose “Firefox” in the “Web Browser” list and click “Edit” button. Here replace “Arguments” edit box content with:

“{URL}”

In the next article we will start our application through apache passanger instead of using rails built in WEBrick.

Categories: Development, Linux Tags: , , ,

Preparing Ruby on Rails environment – apache, ruby

January 24th, 2009 Comments off

In previous article I have described how to setup postgress for development, now is time to continue with the environment. At the beginning we need:

  • ruby as it is base for rails,
  • apache For serving pages,
  • java + netbeans for development.

So installation of required system packages:

emerge -qDNu ruby rubygems apache jdk

/etc/init.d/apache2 start

Install ruby gems that will be needed shortly:

UPDATE: 2009.01.26 added postgres

gem install rails capistrano capistrano-ext passenger postgres

Now we need to integrate passenger into apache – please run:

passenger-install-apache2-module

UPDATED 2009-02-06:

The installation should go without nay problems (If You followed all instructions), at the end You will be asked to modify apache configuration file – few Lines of the output – starting with LoadModule, PassengerRoot and PassengerRuby – should be copied to new apache configuration file, easiest way is to use this commands:

echo “LoadModule passenger_module /usr/lib64/ruby/gems/1.8/gems/passenger-2.0.6/ext/apache2/mod_passenger.so” > /etc/apache2/vhosts.d/01_passenger.conf

echo “PassengerRoot /usr/lib64/ruby/gems/1.8/gems/passenger-2.0.6” >> /etc/apache2/vhosts.d/01_passenger.conf

echo “PassengerRuby /usr/bin/ruby18” >> /etc/apache2/vhosts.d/01_passenger.conf

Some of the lines may differ from the output form yours passenger so please use Yours as it is better for you.

In next part we will continue with development environment.

Preparing Ruby on Rails environment – postgresql

January 20th, 2009 Comments off

Time to start some development, for next project I have decided to use (and learn) Ruby on Rails (RoR).

Many persons use mysql to develop rails apps, as it is easy to setup and use.

But postgresql has more futures then mysql, one of them is known to be used by current RoR, It is transactional DDL update, in Rails world it is called transactionall migrations.

So this is what I had to do to get it working on my gentoo box:

emerge postgresql-server

emerge postgresql-server –config

/etc/init.d/postgresql-8.3 start

su – postgres -c createuser mpapis

# or you could use: sudo -u postgres createuser mpapis

In the listing i have used settings from my computer, /etc/init.d/postgresql-8.3 can be any other name starting with postgres, replace mpapis with your user name.

After running those commands You are able to run psql from yours account, from now on You can run following commands to menage Yours postgresql database:

  1. createdb DATABASE_NAME
  2. dropdb DATABASE_NAME
  3. createuser USER_NAME
  4. dropuser USER_NAME
  5. pg_dump DATABASE_NAME > dump.sql
  6. pg_dumpall > dump.sql
  7. psql -d DATABASE_NAME

This knowledge should be enough to continue with rails, but this comes in next days.

Categories: Development, Linux Tags: , ,

compiling and running sax2 on gentoo

January 11th, 2009 2 comments

While using gentoo I get lot of knowleadge of linux internals, i’m very happy of that. But one aspect of this makes me unhappy : X server configuration. While I was using OpenSuSE I get to know SaX2 tool which just configured my X server. Thats how I have thought about getting it run at my gentoo box.

Instruction on how it can be build can be found there: instructions, unfortunatelly folowing them i found few problems so I write my own instruction bellow:

sudo -s 
emerge -1q hwinfo Xinerama
mkdir /root/sax2 && cd /root/sax2
rm -f "./sysp/lib/pci/lib/config.h"
touch svnbuild
make
make install
sax2

And thats all folks, now I was able to configure my video card with no special knowledge of modelines or whatever is needed to write xorg.conf files

Categories: Linux Tags: , , ,