Friday, June 27, 2014

Jboss 6

1. install java in Linux
# yum install java
verify it by using this command
# java -version

2. download Jboss
you can get the latest or older version at http://jbossas.jboss.org/downloads/
for here, i use the latest package
# wget http://download.jboss.org/jbossas/7.1/jboss-as-7.1.1.Final/jboss-as-7.1.1.Final.zip
then extract it to /opt folder
# unzip jboss-as-7.1.1.Final.zip -d /opt

3. add user jboss and update the folder permission
# useradd jboss
# chown -R jboss:jboss /opt/jboss

4. create jboss admin
# cd /opt/jboss/bin
# ./add-user.sh

What type of user do you wish to add?
 a) Management User (mgmt-users.properties)
 b) Application User (application-users.properties)
(a): a

Enter the details of the new user to add.
Realm (ManagementRealm) :
Username : admin
Password :
Re-enter Password :
The username 'admin' is easy to guess
Are you sure you want to add user 'admin' yes/no? yes
About to add user 'admin' for realm 'ManagementRealm'
Is this correct yes/no? yes
Added user 'admin' to file '/opt/jboss-eap-6.0/standalone/configuration/mgmt-users.properties'
Added user 'admin' to file '/opt/jboss-eap-6.0/domain/configuration/mgmt-users.properties'
Is this new user going to be used for one AS process to connect to another AS process?
e.g. for a slave host controller connecting to the master or for a Remoting connection for server to server EJB calls.
yes/no? yes
To represent the user add the following to the server-identities definition <secret value="amJvc3M=" />


NOTE: please keep the secret value as we will need it later on configuration file
-----------------------------------------------------------------------------------------------------------

For Master domain controller

1. go to  domain/configuration folder
# cd /opt/jboss/domain/configuration

2. update the interface IP to your server IP
# vim host-master.xml

from:
    <interfaces>
        <interface name="management">
            <inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
        </interface>
    </interfaces>
to
    <interfaces>
        <interface name="management">
            <inet-address value="${jboss.bind.address.management:172.30.10.100}"/>
        </interface>
    </interfaces>

3. start up the services
# cd /opt/jboss/bin
# ./domain.sh --host-config=host-master.xml&

this is to tell the system which config to use and by adding "&" at the end will make it run at background but still showing out the output
you should be see some output like this at the end to indicate the services was started

       Started 11 of 11 services (0 services are passive or on-demand)

Then you can try to access it using your browser by entering this
<your-server-ip>:9990
for mine, it will be 172.30.10.100:9990
enter the username and password you just setup for the system and you will see the interface


---------------------------------------------------------------------------------------------------------

For Slave domain controller

1. go to  domain/configuration folder
# cd /opt/jboss/domain/configuration

2. update the interface IP to your server IP
# vim host-slave.xml

From
<host xmlns="urn:jboss:domain:1.3">

To
<host name="host1" xmlns="urn:jboss:domain:1.3">

---------------

From
                <server-identities>
                     <!-- Replace this with either a base64 password of your own, or use a vault with a vault expression -->
                     <secret value="c2xhdmVfdXNlcl9wYXNzd29yZA=="/>
                </server-identities>

To
                <server-identities>
                     <!-- Replace this with either a base64 password of your own, or use a vault with a vault expression -->
                     <secret value="amJvc3M="/>
                </server-identities>

NOTE: the secret value is obtain when you add user to your jboss system

---------------

From
    <domain-controller>
       <remote host="${jboss.domain.master.address}" port="${jboss.domain.master.port:9999}" security-realm="ManagementRealm"/>
    </domain-controller>

To
    <domain-controller>
       <remote host="${jboss.domain.master.address}" port="${jboss.domain.master.port:9999}" username="admin" security-realm="ManagementRealm"/>
    </domain-controller>

NOTE: this is to tell which user to connect to at master domain controller

---------------

From
    <interfaces>
        <interface name="management">
            <inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
        </interface>
        <interface name="public">
           <inet-address value="${jboss.bind.address:127.0.0.1}"/>
        </interface>
        <interface name="unsecure">
            <!-- Used for IIOP sockets in the standard configuration.
                 To secure JacORB you need to setup SSL -->
            <inet-address value="${jboss.bind.address.unsecure:127.0.0.1}"/>
        </interface>
    </interfaces>

To
    <interfaces>
        <interface name="management">
            <inet-address value="${jboss.bind.address.management:<your-server-ip>}"/>
        </interface>
        <interface name="public">
           <inet-address value="${jboss.bind.address:<your-server-ip>}"/>
        </interface>
        <interface name="unsecure">
            <!-- Used for IIOP sockets in the standard configuration.
                 To secure JacORB you need to setup SSL -->
            <inet-address value="${jboss.bind.address.unsecure:<your-server-ip>}"/>
        </interface>
    </interfaces>

NOTE: you can check your server ip using ifconfig command

--------------

3. Now all config done, is time to start up the services
# cd /opt/jboss/bin
# ./domain.sh --host-config=host-slave.xml -Djboss.domain.master.address=172.20.10.100

NOTE: 172.20.10.100 is my master domain controller IP.
-Djboss.domain.master.address is just to point it to master domain IP

At the end of line, you should be see this log if success

[Host Controller] 20:53:25,835 INFO  [org.jboss.as.host.controller] (proxy-threads - 2) JBAS010919: Registering server server-one
[Host Controller] 20:53:25,835 INFO  [org.jboss.as.host.controller] (proxy-threads - 1) JBAS010919: Registering server server-two

Now at your browser, refresh it
you should be see your master and host 1 under the Host: option


Just repeat the same step if you want to add host2

Friday, June 20, 2014

Install Magento in Centos 6

This will be simple guide for installing Magento in Centos 6

1. Install needed service
before that, add Epel repo first as we needed some package from there
# rpm -ivh http://www.mirrorservice.org/sites/dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
then now proceed with the installation 
# yum install httpd mysql mysql-server php php-xml php-mcrypt mcrypt gd php-gd php-mysql

then setup your mysql server accordingly 
you need to create a database and user

for reference on how to setup mysql, please refer to 

2. get the latest Magento and extract it at your web folder

try get the latest version from Magento

# wget http://www.magentocommerce.com/downloads/assets/1.9.0.1/magento-1.9.0.1.tar.gz
# tar-zxvf magento-1.9.0.1.tar.gz

3. start up your httpd and mysql services. Then at your browser go to <your ip>/magento and follow the wizard guide

during the wizard installation, you will reach a pages where it told you unable to write file into a list of dir.
just change those Dir to use 777 and file use 666 permission



Common error message and solution
PHP extension "dom" must be loaded. -> install php-xml
PHP extension "mcrypt" must be loaded. -> install php-mcrypt + mcrypt
PHP extension "gd" must be loaded. -> install php-gd
php extensions pdo_mysql must be loaded -> install php-mysql