How do I find out if I am running 64bit or 32bit Centos?

Sometimes you can’t remember if you installed 64bit or 32bit centos, to find out which version you are using;

uname -a

And you will get a response like

[root@monitor zenoss]# uname -a
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx i686 i686 i386 GNU/Linux

Posted in Centos 5.2, Command Line, General Command Line | Tagged , , | 2 Comments

How Do I Find Which Version of Centos I Am Running?

Sometimes you install a centos machines ages ago and can’t remember what you installed. If you want to find out which version it is, easy

tail /etc/redhat-release

This will return something like;

[root@]# tail /etc/redhat-release
CentOS release 5.2 (Final)

Posted in Centos 5.2, Command Line, General Command Line | Tagged , , | Leave a comment

Upgrade from zenoss 2.5.2 stack installer to zenoss 3.0 on Centos

Instructions from http://nchc.dl.sourceforge.net/project/zenoss/Documentation/zenoss-3.0.x-docs/zendocs-3.0.0/Zenoss_Core_Installation_04-072010-3.0-v01.pdf

Get the ZenPacks.zenoss.PreUpgrade30-1.0-py2.4.egg

wget http://downloads.sourceforge.net/project/zenoss/zenpacks-3.0%20%28Latest%20Stable%29/zenpacks-3.0.0/ZenPacks.zenoss.PreUpgrade30-1.0-py2.4.egg?use_mirror=nchc&ts=1279596576

Change the permissions

chown zenoss.zenoss ZenPacks.zenoss.PreUpgrade30-1.0-py2.4.egg
chmod 777 ZenPacks.zenoss.PreUpgrade30-1.0-py2.4.egg

Become the zenoss user

su zenoss

Run the install

zenpack --install ZenPacks.zenoss.PreUpgrade30-1.0-py2.4.egg

Restart zopectl

zopectl stop
zopectl start

Start the zencatalog

zencatalog start

Check that is working.

tail -f $ZENHOME/log/zencatalog.log

You must wait for the catalog generation to complete before you can begin upgrade.

Backup your zenoss installation

zenoss$ zenbackup --save-mysql-access --file /tmp/zenoss-backup.tgz
zenoss$ tar czf complete-backup.tar.gz $ZENHOME

Download the upgrade

wget http://downloads.sourceforge.net/project/zenoss/zenoss-3.0%20%28Latest%20Stable%29/zenoss-3.0.0/zenoss-stack-3.0.0-linux.bin?use_mirror=nchc&ts=1279597641

Clean up cache files with the following commands run as root.

su root
rm /opt/zenoss/var/*.zec
find /opt/zenoss/perf -name \*.pickle -delete

Set the permission of the downloaded zenoss installer

chmod +x zenoss*.bin

Run the zenoss stack installer as root

./zenoss*.bin

Posted in Centos 5.2, Command Line, General Command Line, Open Source, Zenoss | Tagged , , , , | Leave a comment

How To Install IonCube Loader on Centos

Go to http://www.ioncube.com/loaders.php

Download

wget http://downloads2.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz

tar xvfz ioncube_loaders_lin_x86.tar.gz

tar xvfz ioncube_loaders_lin_x86.tar.gz

cd ioncube

Copy loader-wizard.php to location you can access on a web browser.

I then get told that there is an updated script so I down load the latest and update it.

wget http://www.ioncube.com/loader-wizard/loader-wizard.tgz

tar xvfz loader-wizard.tgz

cp this file to a folder you can access from a browser.

Then follow the instructions;

mkdir /usr/local/ioncube

Copy the downloaded files to /usr/local/ioncube

cp * /usr/local/ioncube

cd /etc/php.d

Download ioncube.ini from from the link on loader-wizard.php page.

But the ioncube.ini in /etc/php.d

Restart you httpd server

service httpd restart

Click on the test link and make sure everything works

Then remove the loader-wizard.php from the folder that is browserable.

Posted in Centos 5.2 | Tagged , , , , | Leave a comment

Web Page Loading Issues – Use firebug and fiddler

Firebug is awesome!

You can edit CSS live, review your HTML, pretty much any functionality you may need is included.

Install it at http://getfirebug.com/, you will need to install firefox if you have not already used it.

I use it extensively to check page load speeds and check issues.

Another cool tool if you need info about what is loaded and how long it takes is fiddler – great for debugging web calls – http://www.fiddlertool.com/fiddler/help/hookup.asp

Posted in Uncategorized | Tagged , , | Leave a comment

How To Import a Mysql Database on the Command Line

Every so often its useful to import a .sql (exported sql file) into mysql.

Make sure the database already exists.

mysql -u root -p
create database NAMEOFDB;
exit

then import you db..

mysql -uUSERNAME -pPASSWORD NAMOFDB < MYDATABASE.sql

Posted in Command Line, Mysql | Leave a comment

How To update PHP 5.1 to 5.2 on Centos

Found this great link on how to update php to 5.2

http://wiki.centos.org/HowTos/PHP_5.1_To_5.2

Posted in Centos 5.2 | Leave a comment

Think Pad x100e Wireless Card

This is from – http://justinsomnia.org/2010/02/ubuntu-on-a-lenovo-thinkpad-x100e/

sudo apt-get install build-essential
wget http://launchpadlibrarian.net/34090404/rtl8192se_linux_2.6.0010.1012.2009_64bit.tar.gz
sudo tar -xvzf rtl8192se_linux_2.6.0010.1012.2009_64bit.tar.gz
cd rtl8192se_linux_2.6.0010.1020.2009_64bit
sudo su
make
make install

The thing that got me was that the sudo su, I originally tried sudo make, this did not work and i am not quite sure why but sudo su works…

Posted in ubuntu | Tagged , , | Leave a comment

How to Install Redmine 0.9.3 on Centos Update, Including Apache and SVN Configuration

This is on a fresh version of centos and includes;

  • Ruby on Rail setup
  • Redmine Installation
  • Apache configuration
  • SVN autocreate
  • SVN authentication using redmine

Thanks to the redmine team for an awesome tool.

Install Ruby on Rails

Install ruby 1.8.7

wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7.tar.gz

tar xvfz ruby-1.8.7.tar.gz

cd ruby-1.8.7

./configure

I got the error

configure: error: no acceptable C compiler found in $PATH

so install gcc

yum install gcc

Then

./configure
make
make install

Then install gems

wget http://rubyforge.org/frs/download.php/69365/rubygems-1.3.6.tgz

tar xvfz rubygems-1.3.6.tgz

cd rubygems 1.3.6

I got this error

 no such file to load -- zlib (LoadError)

Fixed it by

yum install zlib zlib-devel

And then go to your ruby src file (where you installed it from).

ruby extconf.rb --with-zlib-include=/usr/include --with-zlib-lib=/usr/lib
make
make install

Install Ruby on Rails, the correct version.

gem install rails -v=2.3.5

Install the mysql gem

Make sure you install mysql-devel (yum install mysql-devel) before you install the mysql gem.

 gem install mysql

Install Redmine 0.9.3

Install subversion (svn)

yum install subversion

Install rmagick

 yum install ImageMagick ImageMagick-devel

gem install rmagick –v 1.15.13 ––no–rdoc ––no–ri 

Go to where you want to install redmine and check it out of subversion

svn checkout http://redmine.rubyforge.org/svn/trunk redmine

Change permissions

chown -R apache.apache redmien

Create the mysql database

mysql -u root -p
create database redmine character set utf8;
create user 'redmine'@'localhost' identified by 'my_password';
grant all privileges on redmine.* to 'redmine'@'localhost';

Copy the database config file

cp config/database.yml.example config/database.yml
vi database.yml

Enter the following text

production:
  adapter: mysql
  database: redmine
  host: localhost
  username: redmine
  password: my_password
  

Generate a session store secret.

RAILS_ENV=production rake config/initializers/session_store.rb

Create the database structure

RAILS_ENV=production rake db:migrate

I got the error.

no such file to load -- openssl
yum install openssl-devel

Then go to your ruby source folder

cd ~/ruby-1.8.7

And then

cd ext/openssl
ruby extconf.rb
make
make install

Then I got the error

no such file to load -- mysql

So to fix

yum install mysql-devel

Then

gem install mysql

Insert default configuration data in database

RAILS_ENV=production rake redmine:load_default_data

Setting up permissions

sudo chown -R apache.apache files log tmp public/plugin_assets

Test your setup

ruby script/server webrick -e production

Goto http://localhost:3000/

Login is admin/admin

Don’t forget iptables if you cannot connect?

Setup Redmine on Apache

cp public/dispatch.cgi.example public/dispatch.cgi
vi public/dispatch.cgi

Change /usr/bin/env: ruby

To

/usr/local/bin/ruby

Change /usr/lib/ruby/gems/1.8/gems/rails-2.1.2/lib/dispatcher.rb

To

/usr/local/lib/ruby/gems/1.8/gems/rails-2.1.2/lib/dispatcher.rb

Change permissions

chmod 755 public/dispatch.cgi
 

Update the config/environment.rb file to force the rails environment to production

vi config/environment.rb

Uncomment ENV['RAILS_ENV'] ||= ‘production’ (remove #)

Add this to your conf.d directory

cd /etc/httpd/conf.d/redmine.conf

 <VirtualHost *:80>
        ServerName redmine.<YOUR-DOMAIN>.com
        ServerAdmin webmaster@<YOUR-DOMAIN>.com
        DocumentRoot /live/redmine/public/
        ErrorLog logs/redmine_error_log

        <Directory "/live/redmine/public/">
                Options Indexes ExecCGI FollowSymLinks
                Order allow,deny
                Allow from all
                AllowOverride all
        </Directory>
    </VirtualHost>
	

Restart httpd

service httpd restart

I got an application error when trying to open redmine, so in /var/log/httpd/httpd-error-log

undefined method `env_table’ for nil:NilClass

Seems to be a problem with mod_cgi and the solution seems to be usig passenger…

gem install passenger
passenger-install-apache2-module
Follow the instructions

I had to add the following to http.conf so,

vi /etc/httpd/conf.d/passenger.conf

Add

LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.11/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.11
PassengerRuby /usr/local/bin/ruby

And the changed my virtualhost config

vi /etc/httpd/conf.d/redmine.conf

<VirtualHost *:80>
      ServerName www.yourhost.com
      DocumentRoot /live/redmine/public
      <Directory /live/redmine/public>
         AllowOverride all
         Options -MultiViews
      </Directory>
</VirtualHost>

Setup Subversion Autocreate (SVN) repository for Redmine 0.9.3

Projects are retrieved from Redmine using a SOAP web service. This web service is disabled by default in Redmine. To enable it, go to « Administration -> Settings -> Repository » and check Enable WS for repository management.

mkdir svn
chown root.apache /svn
chmod 0750 /svn

Then test to see if it works, goto your redmine root

extra/svn/reposman.rb --redmine my.redmine.host --svn-dir /svn -k APIKEY --owner apache --url http://svn.server/svn-private/ --verbose

Then add it to crontab

crontab -e
cat /etc/cron.d/redmine
10 * * * * root ruby /location/redmine/extra/svn/reposman.rb --redmine my.redmine.host --svn-dir /svn -k APIKEY --owner apache --url http://svn.server/svn-private/ --verbose

Deny web service from anywhere but your local server

   <Location /sys>
      Order deny,allow
      Allow from ip.of.my.svn.server
      Deny from all
   </Location>
   

Setup Authentication for SVN using Remine 0.9.3

Install the necessary packages.

yum install mod_dav_svn mod_perl perl-Apache-DBI perl-Digest-SHA1 perl-DBD-mysql

copy /locationof/redmine/extra/svn/Redmine.pm to /usr/lib/perl5/vendor_perl/5.8.8/Apache/

cp /locationof/redmine/extra/svn/Redmine.pm /usr/lib/perl5/vendor_perl/5.8.8/Apache/

Then add this to your httpd redmine.conf

 # /svn location for users
   PerlLoadModule Apache::Redmine
   <Location /svn>
     DAV svn
     SVNParentPath "/var/svn"
     Order deny,allow
     Deny from all
     Satisfy any

     PerlAccessHandler Apache::Authn::Redmine::access_handler
     PerlAuthenHandler Apache::Authn::Redmine::authen_handler
     AuthType Basic
     AuthName "Redmine SVN Repository"

     #read-only access
     <Limit GET PROPFIND OPTIONS REPORT>
        Require valid-user
        Allow from redmine.server.ip
        # Allow from another-ip
         Satisfy any
     </Limit>
     # write access
     <LimitExcept GET PROPFIND OPTIONS REPORT>
       Require valid-user
     </LimitExcept>

     ## for mysql
     RedmineDSN "DBI:mysql:database=databasename;host=my.db.server"
     ## for postgres
     # RedmineDSN "DBI:Pg:dbname=databasename;host=my.db.server"
     ## for SQLite3
     # RedmineDSN "DBI:SQLite:dbname=database.db"

     RedmineDbUser "redmine"
     RedmineDbPass "password"
  </Location>

restart httpd

service httpd restart
  
Posted in Centos 5.2, Redmine, Ruby on Rails | Tagged , , , | Leave a comment

How To Add /usr/local/bin to your PATH on Centos

To find the directories in your PATH, run the following command:

echo $PATH

Adding to your PATH

Add /usr/local/bin to yor PATH:

export PATH=$PATH:/usr/local/bin

/etc/profile file defines path for all users. Edit file

vi /etc/profile

My profile file looks like


# /etc/profile

# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc

pathmunge () {
if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
fi
}

# ksh workaround
if [ -z "$EUID" -a -x /usr/bin/id ]; then
EUID=`id -u`
UID=`id -ru`
fi

# Path manipulation
if [ "$EUID" = "0" ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
fi

# No core files by default
ulimit -S -c 0 > /dev/null 2>&1

if [ -x /usr/bin/id ]; then
USER="`id -un`"
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"
fi

HOSTNAME=`/bin/hostname`
HISTSIZE=1000

if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
INPUTRC=/etc/inputrc
fi

JAVA=""
export JAVA="sun"
export JPATH="/usr/java/jdk1.6.0_18"
export JAVA_HOME="$JPATH"
export CLASSPATH="$JPATH/bin"
pathmunge $JPATH/bin before

export PATH=$PATH:/usr/local/bin

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC

for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
. $i
fi
done

unset i
unset pathmunge

Posted in Centos 5.2, Command Line | Leave a comment