Tag Archives | CentOS

AutoSSH on CentOS

I have been interested in MySQL replication over ssh and I wanted a way to make sure that the tunnel is always up. Everyone says to use AutoSSH. AutoSSH is not in EPEL, but is in rpmforge (Is that that same as DAG? Didn’t they merge?). I installed rpmforge:

rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm

I don’t like to do the RepoDance, so I disabled rpmforge:

sed -i "s/enabled = 1/enabled = 0/" /etc/yum.repos.d/rpmforge.repo

Next I installed AutoSSH

yum install --enablerepo=rpmforge autossh</p>

And finally my Bash function to create an AutoSSH tunnel:
 

function StartAutoSSH {
	. /etc/rc.d/init.d/functions
	AUTOSSH_PIDFILE=/var/run/autossh.pid # we are assuming only one autossh tunnel
	if [ ! -e $AUTOSSH_PIDFILE ]; then
	AUTOSSH_PIDFILE=$AUTOSSH_PIDFILE;export AUTOSSH_PIDFILE
	autossh -M29001 -f -N -L7777:127.0.0.1:3306 [email protected]
	else
	status -p $AUTOSSH_PIDFILE autossh
	fi
}

If you call this function, it will created the specified tunnel or if it is up and runnng, then it will spit back the PID.

Xnest, xdmcp and X11 on CentOS

It has been a while since I have used XNest. It works. Slow, but it works. I can ssh into a box and bring back a full X session back to my Mac.

In CentOS 5.5 I had to edit /etc/gdm/custom.conf and add:

Enable=true under [xdmcp]. Restart X and now I can run:

Xnest :1 -geometry 1024×768 -kb -query localhost

which will bring a gnome session back to my X11 server.

Very easy with out having to open any ports!

GNU date vs BSD date

I usually develop and test my BASH scripts on my mac, mostly for use on RedHat systems. Occasionally I run into problems with this workflow. Recently I realized there was a differnce between the date command on RedHat and the date command in OS X. Turns out BDS date != GNU date. The workaround, install coreutils from Mac Ports, and add this alias to my .bashrc:

alias date=”/opt/local/bin/gdate”

 

Update: gdate is part of the GNU coreutils, and the MacPorts install command for gdate is: sudo port install coreutils

CentOS: HowTo install ruby, rubygems and passenger for a redmine install

I like to put my complied software in /opt vs /usr/local. Make sure rpm version is not installed.

install ruby:

wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p174.tar.gz
./configure --prefix=/opt/ruby-1.8.7-p174
sudo make &amp;&amp; sudo make install

user alternatvies to create sym links:

/usr/sbin/alternatives --install /usr/bin/ruby ruby /opt/ruby-1.8.7-p174/bin/ruby 1 \
--slave /usr/bin/rdoc rdoc /opt/ruby-1.8.7-p174/bin/rdoc \
--slave /usr/bin/ri ri /opt/ruby-1.8.7-p174/bin/ri \
--slave /usr/bin/irb irb /opt/ruby-1.8.7-p174/bin/irb \
--slave /usr/bin/erb erb /opt/ruby-1.8.7-p174/bin/erb \
--slave /usr/bin/testrb testrb /opt/ruby-1.8.7-p174/bin/testrb \
--slave /usr/bin/gem gem /opt/ruby-1.8.7-p174/bin/gem \
--slave /usr/bin/rake rake /opt/ruby-1.8.7-p174/bin/rake

make sure current ruby is set to 1.8.7: /usr/sbin/alternatives –config ruby

install rubygems:

wget http://rubyforge.org/frs/download.php/70696/rubygems-1.3.7.tgz
sudo ruby setup.rb

install gems (No docs):

gem install --no-rdoc --no-ri rails
gem install --no-rdoc --no-ri passenger
gem install --no-rdoc --no-ri mysql
gem install --no-rdoc --no-ri rack -v=1.0.1

Passenger said I needed to install curl-dev  (yum install curl-devel)

install passenger apache module:

	/opt/ruby-1.8.7-p174/lib/ruby/gems/1.8/gems/passenger-3.0.0/bin/passenger-install-apache2-module

modify your httpd conf file

   LoadModule passenger_module /opt/ruby-1.8.7-p174/lib/ruby/gems/1.8/gems/passenger-3.0.0/ext/apache2/mod_passenger.so
   PassengerRoot /opt/ruby-1.8.7-p174/lib/ruby/gems/1.8/gems/passenger-3.0.0
   PassengerRuby /opt/ruby-1.8.7-p174/bin/ruby

Install redmine according to Docs

Installing Flash on CentOS 5.4 x64

Here is what I tried:

wget http://download.macromedia.com/pub/labs/flashplayer10/libflashplayer-10.0.32.18.linux-x86_64.so.tar.gz

tar -xzf libflashplayer-10.0.32.18.linux-x86_64.so.tar.gz

mv libflashplayer.so ~/.mozilla/plugins/

Powered by WordPress. Designed by WooThemes