Thursday, February 24, 2011

How Install Tigase XMPP Server


Installation using GUI installer

If you don't want to install Tigase using manual method, you can use the GUI installer. 
Therefore it is the preferred way to install Tigase.

Prerequisites

Before you can start the GUI installer you will need to have working Java environment. Although installer only requires JRE (Java Runtime Environment), server needs the JDK (Java Development Kit).
After configuring JDK you can download the Tigase GUI installer and start the server installation process. It is also important to set the JAVA_HOMEenvironment correctly.

Download the installer // ( the latest )

Run the jar file

You will be able to check a whether your Java environment is working. To do it type the

java -version

you may start the installer i.e. for the file tigase-server-5.0.0-b2135.jar downloaded to the c:\download directory type the following command:

java -jar c:\download\tigase-server-5.0.0-b2135.jar

//You can add  -console to install it using console installer, usually I am using it, I don't have GUI :)

This command should start the installer or print an error message explaining what is the cause of problem.

Notes:
·        Tigase server base directory:
/usr/local/Tigase-5.0.0-b2135/

·        To start tigase go to tigase base directory then:
# ./scripts/tigase.sh       start   etc/tigase.conf

·        To stop tigase go to tigase base directory then:
# ./scripts/tigase.sh        stop   etc/tigase.conf

·        To check if the server is running , just try to connect to it by using one of many available clients.(like: psi ‘/usr/bin/psi  &’)
Note: To install psi,
·        Install rpmforge repo
·        #   yum install psi

·        An example content of the init.property file to run the tigase server in the cluster mode would be:
--virt-hosts=example.com
--cluster-mode=true
--cluster-nodes=cluster-node1,cluster-node2
--sm-cluster-strategy-class=cluster.StrategyImpl


Prepare the MySQL database for the Tigase server

Configuring from MySQL command line tool

Run the MySQL command line client in either Linux or MS Windows environment and enter following instructions:
  • Create the database for the Tigase server:
    1
    mysql> create database tigasedb;

    • Add the tigase_user user (create user ‘tigase_user’ identified by ‘tigase_passwd’;) and grant him access to the tigasedb database. Depending on how you plan to connect to the database (locally or over the network) use one of following commands or all if you are not sure:
    • Grant access to tigase_user connecting from any network address.
      1
      mysql> GRANT ALL ON tigasedb.* TO tigase_user@'%'
      2
      IDENTIFIED BY 'tigase_passwd';

      • Grant access to tigase_user connecting from localhost.
        1
        mysql> GRANT ALL ON tigasedb.* TO tigase_user@'localhost'
        2
        IDENTIFIED BY 'tigase_passwd';

        • Grant access to tigase_user connecting from local machine only.
          1
          mysql> GRANT ALL ON tigasedb.* TO tigase_user
          2
           IDENTIFIED BY 'tigase_passwd';

          • And now you can update user permission changes in the database:
            1
            mysql> FLUSH PRIVILEGES;

            • Load database schema to initialize the Tigase server database space. First, switch to the database you have just created:
              1
              mysql> use tigasedb;

              For the Tigase server version 4.x and later you have to use proper schema version:
              1
              mysql> source database/mysql-schema-4.sql;

              N.B. There is an error in this schema; this is fixed by changing the last_logout default value to:
              last_logout timestamp DEFAULT ‘1970-01-02 01:01:01’

              Configuring MySQL for UTF-8 support

              In the my.conf put following lines:
              [mysql]
              default-character-SET=utf8
              [client]
              default-character-SET=utf8
              [mysqld]
              init_connect='SET collation_connection = utf8_general_ci; SET NAMES utf8;'
              character-set-server=utf8
              default-character-SET=utf8
              collation-server=utf8_general_ci
              skip-character-set-client-handshake

              Then connect to the database and from the command line shell check settings:
              1
              SHOW VARIABLES LIKE 'character_set_database';
              2
              SHOW VARIABLES LIKE 'character_set_client';
              If any of these shows something else then 'utf8' then you have to correct it:
              1
              ALTER DATABASE tigasedb DEFAULT CHARACTER SET utf8;
                
              Notes:

              ·        You have to update your tigase server; Binary updates are located in the Tigase's maven repository
              Replace jars/tigase-server.jar by  jars/tigase-server-x.x.jar Nothing more.

              ·        If you are using clustered mysql database with your tigase server you have to alter all tables in tigase schema to use ndb engine which needs to drop all foreign keys.
              mysql >  alter table <table-name> drop foreign key <foreign-key-name>;
              mysql>  alter table t1 engine=ndb;
              ·        Java Home: /usr/java/jdk1.6.0-23
              •         To enable cluster mode in tigase:

              Add the following lines in init.properties:
              --cluster-mode=true
              --cluster-nodes=tigase1, tigase2
              •         To print all received and sent character data, add:

              --debug=xmpp.XMPPIOService

               Done 
              Inas

              Wednesday, February 23, 2011

              How Install Tomcat

              For stand alone installation:

              •  Stop apache if it is running:

              #  service   httpd  status
              #  service   httpd  stop
              #  chkconfig  --list  httpd
              #  chkconfig  httpd  off

              •  Install JDK

              Check java version using:
              #  java   -version
              #  echo JAVA_HOME    //if none, set JAVA_HOME
              #  export   JAVA_HOME=/usr/java/jdk1.6-23   //add it to your profile.

                    # yum   list   gcc     //  if it is not installed then,  yum   install   gcc

                          #  cd   Softwares
              #  tar  xzf  apache-tomcat-7.0.6.tar.gz
              #  mv apache-tomcat-7.0.6    /opt/tomcat

              •  Test it
              #  /opt/tomcat/bin/startup.sh

                          Add CATALINE_HOME to your profile
              #  cd
              #  vi  .bash_profile
              export   CATALINA_HOME=/opt/tomcat

              # export   CATALINA_HOME=/opt/tomcat
              # groupadd   tomcat
              #  useradd  -g  tomcat  -d  /opt/tomcat   tomcat
              #  passwd  tomcat                 
              #  chown  -R  tomcat:tomcat   /opt/tomcat
              #  cd   /opt/tomcat/bin
              #  tar   xzf   common-daemon-native.tar.gz
              #  cd   common-daemon-1.0.5-native-src/unix
              #  ./configure
              #  make
              #  cp  jsvc   ../..
              #  cd   ../../..
              #  cp   /opt/tomcat/bin/common-daemon-1.0.5-native-src/unix/samples/Tomcat7.sh   /etc/init.d/tomcat

              • To start tomcat:

                    #  /etc/init.d/tomcat start

              • To stop tomcat:

                    #  /etc/init.d/tomcat stop

              • Change Apache Tomcat port 8080 to 80 or another port number

              #  vi    /opt/tomcat/conf/server.xml
              <Connector port="80" … />
              # /etc/init.d/tomcat  restart

              Done 
              Inas

              How Install PHPMyAdmin

              I want to be clear, all these posts are my way to install these softwares, may be there are other ways better than mine, but as I said it is my way :)
              • Install rpmforge repo
              # rpm   -Uvh   epel-release-5-4.noarch.rpm
              # rpm   -Uvh   remi-release-5.rpm
              • I will install here some pre requests, may be I installed more than the required softwares. 
              # yum --enablerepo=remi install php
              # yum --enablerepo=remi install mysql-server
              # yum --enablerepo=remi install php-mysql
              # yum --enablerepo=remi install php-pear php-pgsql php-pecl-memcache php-gd php-mbstring php-mcrypt php-xml
              # yum --enablerepo=remi install phpmyadmin
              # vi /etc/httpd/conf.d/phpMyAdmin.conf
              allow from all
              # service mysqld start
              # /usr/bin/mysqladmin -u root password 'mypassword'
              # service httpd restart



              phpmyadmin URL:
              then use a valid mysql user.

              Done 
              Inas

              Tuesday, February 22, 2011

              How Install Apache and PHP


              This guide shows howto install Apache HTTP Server (httpd) with PHP 5.3.3 and following modules:
              ·         PEAR
              ·         PDO
              ·         MySQL
              ·         PostgreSQL
              ·         Memcache
              ·         GD
              ·         XML
              ·         MBString
              ·         MCrypt
              on Fedora 14/13/12/11/10/9/8/7/6, CentOS 5.4/5.5 and Red Hat (RHEL) 5.4/5.5/6systems.

              Install Apache HTTP Server (httpd) and PHP 5.3.3

              1. Change root user

              su -
              ## OR ##
              sudo -i

              2. Install Remi repository

              CentOS and Red Hat (RHEL)

              ## Remi Dependency on CentOS and Red Hat (RHEL)
              !! Down Load epel-release-5-4.noarch.rpm, remi-release-5.rpm
              
              
              rpm -Uvh epel-release-5-4.noarch.rpm
               
              rpm -Uvh remi-release-5.rpm

              3. Install Apache (httpd) Web server and PHP 5.3.3

              Fedora 13 (12, 11, 10, 9, 8, 7), CentOS 5.5 and Red Hat (RHEL) 5.5

              yum --enablerepo=remi install httpd php php-common

              4. Install PHP 5.3.3 modules

              Select what you need: PEAR, PDO, MySQL, PostgreSQL, Memcache, GD, MBString, MCrypt, XML

              Fedora 13 (12, 11, 10, 9, 8, 7), CentOS 5.5 and Red Hat (RHEL) 5.5

              yum --enablerepo=remi install php-pear php-pdo php-mysql php-pgsql php-pecl-memcache php-gd php-mbstring php-mcrypt php-xml

              5. Start Apache HTTP server (httpd) and autostart Apache HTTP server (httpd) on boot

              /etc/init.d/httpd start ## use restart after update
              ## OR ##
              service httpd start ## use restart after update
               
              chkconfig --levels 235 httpd on

              6. Create test PHP page to check that Apache, PHP and PHP modules are working

              Add following content to /var/www/html/test.php file.
              <?php
               
                  phpinfo();
               
              ?>

              7. Check created page with browser

              Access following address, with your browser. http://localhost/test.php

              Enable Remote Connection to Apache HTTP Server (httpd) –> Open Web server Port (80) on Iptables Firewall (as root user again)

              1. Edit /etc/sysconfig/iptables file:

              nano -w /etc/sysconfig/iptables

              2. Add following line before COMMIT:

              -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

              3. Restart Iptables Firewall:

              service iptables restart
              ## OR ##
              /etc/init.d/iptables restart

              4. Test remote connection

              Access following address, with your browser. http://your.domain/test.php


              ·         To remove a previous PHP version:
              # yum  list       php
              # yum remove                        php

              ·         Apache root directory is: /var/www/html

               

              Permanently redirect users to access the site WITH or WITHOUT the 'www.' prefix

              1.   Create/Open a .htaccess file in the document root folder and add the following text replacing variables with appropriate values where necessary
              # mod_rewrite
              <IfModule mod_rewrite.c>
                # Enable mod_rewrite engine
                RewriteEngine on

                # WITH 'www.'
                RewriteCond %{HTTP_HOST} ^$uri\.$tld$ [NC]
                RewriteRule ^(.*)$ http://www.$domain$1 [L,R=301]

                # WITOUT 'www.'
                RewriteCond %{HTTP_HOST} ^www\.$uri\.$tld$ [NC]
                RewriteRule ^(.*)$ http://$domain/$1 [L,R=301]
              </IfModule>



              Done 
              Inas