Showing posts with label centos. Show all posts
Showing posts with label centos. Show all posts

Friday, May 2, 2014

Speeding up file open/close in Eclipse 4.3(Kepler) on CentOS 6.5

I recently started a new job, and have been using CentOS 6.5 for my laptop while working as a QA Automation engineer.  One of the issues I have run into is that eclipse (main IDE that I use) was taking a long time to both open and close files.

Come to find out that a bug that was initially reported in 2008 is still wreaking havok, namely that gtk+ hangs when looking for network printers using CUPS.  This is significant because it doesn't just affect eclipse, but has also been reported to affect firefox, openoffice/LibreOffice, and other applications where you would want to print.

If you want to confirm that this affects you, start eclipse with the following arguements:

eclipse -vmargs -Dorg.eclipse.swt.internal.gtk.disablePrinting

then, open and close files in eclipse and observe performance.  For me, files were taking approx 10-30 seconds to open, and up to 30 seconds to close, for *every file*.  Running with this option dropped the open/close time to <= 5 sec per file.

Since this impacts more than just eclipse, I wanted to make sure this was resolved on my system.  The best workaround I have found is the following, mentioned at the debian bug report listed below.  Steps are as follows:

  1. sudo vi /etc/cups/cupsd.conf
    1. comment out "Listen /var/run/cups/cups.sock"
  2. sudo vi /etc/cups/client.conf
    1. add "ServerName 127.0.0.1"
  3. sudo service cups restart

after this, I was able to open eclipse as normal, without the -vmargs argument and without the delay in opening/closing files.  Less time waiting on the computer, more time being productive. :-)

see the links below if you are interested in the nitty gritty.

debian bug report that lists work around:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=594997

eclipse bug report of the issue with the eclipse vmargs workaround
https://bugs.eclipse.org/bugs/show_bug.cgi?id=275072

linked eclipse bug with more info:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=215234

eclipse faq entry with short discussion of issue:
http://www.eclipse.org/swt/faq.php#printOnGTKHangs


Sunday, March 3, 2013

Linux printing to a Windows Shared Printer - update

This is an update to my previous post about getting my printer working.

Basic set-up was a network print server that was already set up and working with Windows (XP and 7).  Goal was to add the printer to a Linux system without affecting any existing set-up.  I tried CUPS, but ultimately used LPD/LPR to get it working.

My previous post was for RHEL/CEntOS 5.  This update relates to RHEL/CEntOS 6, and can be done from the Gnome Desktop.  These instructions assume that you already know the host IP you're using as your print server

In the following instructions, enter the root password if you are prompted for authentication:

  1. Click System > Administration > Printing
  2. Click the "New" button
  3. Enter password if prompted
  4. Click the "Do it later" button to change your firewall settings (you shouldn't need to change them)
  5. Enter Root password if prompted
  6. Expand "Network Printer" in the left tree
  7. Select "LPD/LPR Host or Printer" in the left tree
  8. In the right side, enter your information
    • (in my case, Host: 192.168.x.x, Queue: Samsung_2010)
  9. Click "Forward"
  10. Select your printer make from the database and click "Forward"
  11. Select your printer model from the left tree, and the driver from the right tree
  12. Click "Forward"
  13. Enter a unique name for the computer (line #1), a human-readable name (line #2) and a location (line #3)
  14. Click "Apply"
  15. When prompted, click "Yes" to print a test page

You should be set at this point!

Saturday, February 2, 2013

Setting up Ruby on Rails dev environment

We are working on a ruby app for one of my CS classes,  and found that it was easier to set up a virutal linux system than it was to try to get ruby working on windows (mainly because we don't have any stick time on that, and spinning the VM was cheaper).

The principle behind our decision to do this was that it's easier to get help from the community when you stick with the main focus of the community.  See an app out there that is primarily linux, but you're a windows admin?  It's easier for you to get help by installing and learning linux than it is to try to make it work under windows, even if this is a possibility.  I've had to learn this the hard way at work, and it was much easier to move forward with the software when I finally bit the bullet and went all in on linux.

The argument against this goes something like: "we have experience in the company with 'blah' and this can be made to run on 'blah', so we'd like to leverage our existing expertise..." etc.  Unless you're looking to become the pioneers in making it work, you're better off just sticking with the primary environment the software was built in.

The place this really matters is smaller companies.  Most of you out there probably use windows for your day-to-day work, because it's familiar, but the software you'd like to use runs on linux, which you don't really know.  If you're trying to avoid the cost of having it hosted (read "managed") by another company, learn linux.

I'm interested to know what others think of this, if they have experiences that are similar to mine, or if you think I'm nuts.  (OK, you're right on that last part :-D ).

Here's what we did to get our ruby environment set up.  If anyone has feedback on these instructions, I'm all ears.  Have fun.

(it should be noted that the instructions below were used in conjunction with http://ruby.railstutorial.org/book.  The part on bitbucket and heroku were based on having already published an app per that tutorial).

installing CentOS 6.3 on virtual box
===========

install virtual box
    for windows:     http://download.virtualbox.org/virtualbox/4.2.6/VirtualBox-4.2.6-82870-Win.exe
    for mac:         http://download.virtualbox.org/virtualbox/4.2.6/VirtualBox-4.2.6-82870-OSX.dmg

setup VM virtual box config
    Create Virtual Machine
        click new

        name virtual system (ie: Centos6 x64)
        if not already selected, select "Linux" and "Red Hat 64 bit"
        click next

        set for 1024 MB RAM
        create a virtual hard drive now, click create
        VDI, click next
        Dynamically allocated, click next
        set for 16GB, click create
  
    click settings
  
    Configure Network Connections
        select "Network" in left tree
        set as follows:
            Adatper 1:
                Enabled
                Attached to: Bridged Adapter
                Name: (your wired ethernet connection)
            Adapter 2:
                Enabled
                Attached to: Bridged Adapter
                Name: (you wireless ethernet connection)

    Configure iso for install at boot
        click settings
        select "Storage" in left tree
        select CD drive ("Empty") under Storage Tree on right
        click CD icon at right of "IDE Secondary Master" drop down
        select "Choose a virtual CD/DVD disk file"
        find the CentOS6 DVD iso
      
    click ok to confirm VM settings

config/install CentOS OS
    start vm
    click in vm screen to capture input
    click enter to start install
  
    once CentOS 6 logo loads, you can set one of the following:
        right-CTRL+F = full screen
        right-CTRL+C = scaled
        (I find scaled set to full screen works the best)
      
    proceed with install:
        click next (3x)
        basic storage device, click next
        click "yes, discard any data" (this is for the virtual disk)
        click configure network (lower left)
            for each adapter:
                double-click on name
                select "connect automaticaly"
                click "Apply"
            click "close"
        change hostname if desired (ie: centos6-dev)
      
        time zone = America/Denver
        uncheck "System clock uses UTC"
        click next
      
        set root password, click next
  
        select "use all space", click next
        click "write changes to disk"
      
        select "Software Development Workstation"
        click next (this starts installing packages)
      
        let install run
  
        reboot
      
        click forward
        "yes, I agree", click forward
        create your user, click forward
        check "Synchronize date and time over the network", click forward (allow ntp to start)
        click ok when prompted by kdump
        click finish
      
To open firefox:
    click icon
  
To open Terminal:
    Applications > System Tools > Terminal

  
set up sudo access and harden ssh login
    $ su - root (enter root password when prompted)
    allow wheel access to root via sudo
        # visudo
        arrow down to the "wheel" group
        press [i]
        for the line with %wheel  ALL=(ALL)  ALL, delete the # sign at the beginning
        press [ESC][:][X][ENTER]
    give yourself wheel group membership
        # usermod -G wheel <username>
        confirm
        # id <username> wheel(10) should show up in the list of groups
    change #PermitRootLogin yes to PermitRootLogin without-password
        # vi /etc/ssh/sshd_config
        arrow down and over
        press [i]
        use arrows, backspace and keys to change line
        press [ESC][:][X][ENTER]
        # service sshd restart

    what this will do is allow you to log in and switch users as needed, and prevents someone from logging in as root unless they are using ssh keys
  
update the system
    as root:
        # yum -y update
    as your user
        $ sudo yum -y update
    reboot

      
Install Eclipse Juno:
    http://www.if-not-true-then-false.com/2010/linux-install-eclipse-on-fedora-centos-red-hat-rhel/
  
Install Eclipse plugins:
    eclipse marketplace
    aptana studio
    dynamic languages toolkit - Ruby Development tools
    dynamic languages toolkit - core framework
    eclipse EGit
    Eclipse JGit
    eclipse web developer tools
  
Import the project:
    download the repo from bitbucket
    (this can be done from the terminal view in the eclipse web perspective)
    $ cd ~/workspace
    $ git clone https://$user_name@bitbucket.org/$user_name/$app_name.git
    $ cd $app_name
    $ git checkout master

Import the project to eclipse with this project:
    choose ruby perspective
    window > show view > project explorer
    method 1 (may not work):
        expand local filesystem, browse /path/to/git/advising_app
        right-click on advising app, choose "Promote to project"
        open App Explorer, and you should see the project
    method 2 (known to work:
        right click in project explorer, select import
        select General > Existing Project into workspace
        browse to advising_app folder
        click check box by folder on left side
        click finish
      
To open a CLI terminal in Eclipse:
    From Web perspective, it will be in the bottom portion of your screen
    From Ruby (or any other perspective):
        Window menu > Show View > click Other > Studio > Terminal
  
    If you would like a terminal editor (same place as files), click the bigger icon in the view
  
Some of the next steps might need to be run from a system terminal rather than an eclipse terminal, I can't remember which

Install Ruby on Rails environment
    Install RVM:
        $ \curl -L https://get.rvm.io | bash -s stable
    Install Ruby, RubyGems, Rails, etc.
        see section 1.2.2 of http://ruby.railstutorial.org/book
      
Install Heroku toolbelt:
    $ wget -qO- https://toolbelt.heroku.com/install.sh | sh
    $ cd ~/workspace/advising_app
    $ heroku login
    enter your heroku account credentials when prompted

Friday, May 20, 2011

Making X work on RHEL/CEntOS 5 after VMWare P2V Import

Used the VMWare Standalone Converter running on my local machine to import a RHEL/CEntOS 5 Linux system, and afterward, was greeted with the following (this is cli, the gui had it's own errors):

-----snip-----
[root@qa01 ~]# startx
xauth:  creating new authority file /root/.serverauth.9175
xauth:  creating new authority file /root/.Xauthority
xauth:  creating new authority file /root/.Xauthority


X Window System Version 7.1.1
Release Date: 12 May 2006
X Protocol Version 11, Revision 0, Release 7.1.1
Build Operating System: Linux 2.6.18-164.6.1.el5 x86_64 Red Hat, Inc.
Current Operating System: Linux qa01.localdomain 2.6.18-164.11.1.el5 #1 SMP Wed Jan 6 13:26:04 EST 2010 x86_64
Build Date: 16 November 2009
Build ID: xorg-x11-server 1.1.1-48.67.el5_4.1
        Before reporting problems, check http://wiki.x.org
        to make sure that you have the latest version.
Module Loader present
Markers: (--) probed, (**) from config file, (==) default setting,
        (++) from command line, (!!) notice, (II) informational,
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Fri May 20 12:28:27 2011
(==) Using config file: "/etc/X11/xorg.conf"
(EE) No devices detected.

Fatal server error:
no screens found
XIO:  fatal IO error 104 (Connection reset by peer) on X server ":0.0"
      after 0 requests (0 known processed) with 0 events remaining.
[root@qa01 ~]#
-----snip-----


Some digging online led me to http://www.vmware.com/pdf/osp_install_guide.pdf

I realize it probably makes more sense to add the yum repo, but since I was in a hurry, I just pulled the files manually and did a local install.  The files I needed are listed below:

Files are located at: http://packages.vmware.com/tools/esx/4.1/rhel5/x86_64/

IMPORTANT!!! BUILD NUMBERS ARE CRITICAL!!!
      Make sure you get the build number for your version of VMWare and Guest OS

   vmware-tools-nox-8.3.2-257589.el5.x86_64.rpm

   vmware-tools-8.3.2-257589.el5.x86_64.rpm
   vmware-tools-common-8.3.2-257589.el5.x86_64.rpm

   vmware-open-vm-tools-8.3.2-257589.el5.x86_64.rpm
   vmware-open-vm-tools-common-8.3.2-257589.el5.x86_64.rpm
   vmware-open-vm-tools-nox-8.3.2-257589.el5.x86_64.rpm
   vmware-open-vm-tools-xorg-utilities-8.3.2-257589.el5.x86_64.rpm
   vmware-open-vm-tools-kmod-8.3.2-257589.el5.x86_64.rpm
   vmware-open-vm-tools-xorg-drv-mouse-12.6.4.0-0.257589.el5.x86_64.rpm
   vmware-open-vm-tools-xorg-drv-display-10.16.7.0-0.257589.el5.x86_64.rpm

Commands as follows:

wget http://packages.vmware.com/tools/esx/4.1/rhel5/x86_64/<package_name>
    (yes, this has to be done for each rpm)

wget http://packages.vmware.com/tools/keys/VMWARE-PACKAGING-GPG-RSA-KEY.pub

rpm --import VMWARE-PACKAGING-GPG-RSA-KEY.pub (this saves you from the --no-gpg-check)

yum localinstall <big_list_of_all_rpms_use_tab_complete>


So, now that you're done with all that, it's time to reboot.  Yes, this is needed (remember that kmod rpm you just installed?).  After the reboot, everything works with X just fine.

And now things work virtually like they did before.  (=

Wednesday, March 9, 2011

Setting up OTRS on CEntOS 5.5

OTRS (Open Ticket Request System) is a great open source ticketing system with a pretty clean interface, written entirely in Perl.  Below are some notes from setting this up on Centos 5.5, see the website above for full install instructions.

some things to remember:

run /opt/otrs/bin/otrs.checkModules to verify that everything is installed correctly, RPMForge yum repo can help with Perl packages

use generic agent to automagically move tickets/delete tickets.  This works great for deleting stuff in the junk folder.

set up 2.4.9, not 3.0 (the interface was significantly changed in 3.0, not used to it yet.  I think there was another reason for this as well, but I can't remember this right now).

remember to set up mysqld and httpd with chkconfig --levels 2345 <daemon> on

Monday, December 27, 2010

Fast user switching in Centos Gnome desktop

Several people have posted wonderful blog entries on how to get the user switching option turned on for Gnome desktop so that when you lock the screen, someone else who would use the computer can log in without logging you out.

The blog I followed can be found here. (complete with screen-shots (= )

However, because of the way that the gnome desktop configuration is set up, this only sets this option for the user you were logged in as when you went through this exercise.

Ok, so I was going to give the file to edit, but as I went looking through gconf-editor some more, I noticed the following:

if you run gconf-editor as root, you will be able to set Default and Mandatory Keys that effect all users.  Default = users can edit/change these; Mandatory = locked down to sys admin setting.  Once you have chosen keys that should be mandatory/default, you then have to open another window to edit them (one for default, one for mandatory), where you can set the values you want.  You can find more information about these settings here.

So, to have user_switch_enabled set to true for all users (aka, someone else can log in when you have locked the screen), here's what I did (screen-shots to follow):

1. as root, run: gconf-editor &
2. Expand Apps, click on gnome-screensaver
3. find user_switch_enabled, right-click, choose "Set as mandatory"
4. Ctrl+M
5. expand tree on left, set "user_switch_enabled"
6. close editors

(note: "yum install gconf-editor" if your system complains in step 1 above)

You may have to log out of the user you were on for the changes to take effect.  At this point, if the screen is locked by one user, another user is still able to log in and use the system.  If the account you're switching to is not currently logged in, you'll get the standard prompt screen.  Otherwise, you'll get the prompt from the locked screen.  Everything each user was doing will be saved just as they left it.

(After this, I'll be posting more as I dig into GNOME and other desktops.  If there is something you'd like to find out about, leave a comment and I'll see what I can do.  I hope to expand this to include most major linux releases and desktops, but we'll see.)

Sunday, December 26, 2010

Setting up Mach build environment

So, clearly taking me a bit longer to get this going than I thought it would.  So here's the first tidbit I can give pretty quickly: I'm working on setting up a build environment using mach (stands for Make A CHroot).  This is a nifty tool to work in a clean build environment, and can be found here.  Basically, it will pull the packages you need to be able to get a clean build for whatever software you're working with.  If you are missing a dependancy, it will pull it automagically, if it can be found in the repos.  It also allows you to be able to build software for any version that is supported (ls /etc/mach/dists.d/ to get an idea).

Anyway, I'm just going through setting this up again, on a Centos 5 system that I'm planning on using for builds, and wanted to make a few notes, since the documentation still makes you dig a bit:

Steps followed so far:

1. set up yum for epel repo
2. run: yum install mach
3. add build user(s) to the mach group (ie: usermod -G mach <username>)
4. run: mach -r <root> setup build
5. go check irc or something (approx 5 mins)

remember that the root name needs to have an extension after the architechture, since that is what it is looking for in the /etc/mach/dists.d/ config files (separate file for each major os version).  For instance, the base centos 5 root that I just created wouldn't work as "centos-5-i386", it had to be "centos-5-i386-os".

Also, something else that should be mentioned is that it doesn't look like this package currently is able to perform builds for ubuntu/debian packages, but it does support apt-get, so maybe a config file could be created?