Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

Installing LAMS v 2.4 on CentOS

These are manual instructions to install LAMS v2.4 into Unix. For this particular example we have chosen CentOS 5.8

Confirm CentOS version

[root@c5 ~]# lsb_release -a
LSB Version:	:core-4.0-amd64:core-4.0-ia32:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-ia32:printing-4.0-noarch
Distributor ID:	CentOS
Description:	CentOS release 5.8 (Final)
Release:	5.8
Codename:	Final

Install Java JDK

[root@c5 ~]# yum install java-1.6.0-openjdk java-1.6.0-openjdk-devel
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package java-1.6.0-openjdk.x86_64 1:1.6.0.0-1.27.1.10.8.el5_8 set to be updated
--> Processing Dependency: jpackage-utils >= 1.7.3-1jpp.2 for package: java-1.6.0-openjdk
--> Processing Dependency: libasound.so.2(ALSA_0.9)(64bit) for package: java-1.6.0-openjdk
--> Processing Dependency: libasound.so.2(ALSA_0.9.0rc4)(64bit) for package: java-1.6.0-openjdk
--> Processing Dependency: tzdata-java for package: java-1.6.0-openjdk
--> Processing Dependency: libXtst.so.6()(64bit) for package: java-1.6.0-openjdk
--> Processing Dependency: libasound.so.2()(64bit) for package: java-1.6.0-openjdk
--> Processing Dependency: libgif.so.4()(64bit) for package: java-1.6.0-openjdk
--> Running transaction check
---> Package alsa-lib.x86_64 0:1.0.17-1.el5 set to be updated
---> Package giflib.x86_64 0:4.1.3-7.3.3.el5 set to be updated
---> Package jpackage-utils.noarch 0:1.7.3-1jpp.2.el5 set to be updated
---> Package libXtst.x86_64 0:1.0.1-3.1 set to be updated
---> Package tzdata-java.x86_64 0:2012c-3.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================
 Package                        Arch               Version                                    Repository           Size
========================================================================================================================
Installing:
 java-1.6.0-openjdk             x86_64             1:1.6.0.0-1.27.1.10.8.el5_8                updates              36 M
Installing for dependencies:
 alsa-lib                       x86_64             1.0.17-1.el5                               base                414 k
 giflib                         x86_64             4.1.3-7.3.3.el5                            base                 39 k
 jpackage-utils                 noarch             1.7.3-1jpp.2.el5                           base                 61 k
 libXtst                        x86_64             1.0.1-3.1                                  base                 16 k
 tzdata-java                    x86_64             2012c-3.el5                                updates             181 k

Transaction Summary
========================================================================================================================
Install       6 Package(s)
Upgrade       0 Package(s)

Total download size: 37 M
Downloading Packages:
(1/6): libXtst-1.0.1-3.1.x86_64.rpm                                                              |  16 kB     00:00     
(2/6): giflib-4.1.3-7.3.3.el5.x86_64.rpm                                                         |  39 kB     00:00     
(3/6): jpackage-utils-1.7.3-1jpp.2.el5.noarch.rpm                                                |  61 kB     00:00     
(4/6): tzdata-java-2012c-3.el5.x86_64.rpm                                                        | 181 kB     00:00     
(5/6): alsa-lib-1.0.17-1.el5.x86_64.rpm                                                          | 414 kB     00:00     
(6/6): java-1.6.0-openjdk-1.6.0.0-1.27.1.10.8.el5_8.x86_64.rpm                                   |  36 MB     00:02     
------------------------------------------------------------------------------------------------------------------------
Total                                                                                    16 MB/s |  37 MB     00:02     
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : alsa-lib                                                                                         1/6 
  Installing     : giflib                                                                                           2/6 
  Installing     : libXtst                                                                                          3/6 
  Installing     : jpackage-utils                                                                                   4/6 
  Installing     : tzdata-java                                                                                      5/6 
  Installing     : java-1.6.0-openjdk                                                                               6/6 

Installed:
  java-1.6.0-openjdk.x86_64 1:1.6.0.0-1.27.1.10.8.el5_8                                                                 

Dependency Installed:
  alsa-lib.x86_64 0:1.0.17-1.el5     giflib.x86_64 0:4.1.3-7.3.3.el5      jpackage-utils.noarch 0:1.7.3-1jpp.2.el5    
  libXtst.x86_64 0:1.0.1-3.1         tzdata-java.x86_64 0:2012c-3.el5    

Complete!
[root@c5 ~]# java -version
java version "1.6.0_22"
OpenJDK Runtime Environment (IcedTea6 1.10.8) (rhel-1.27.1.10.8.el5_8-x86_64)
OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)
[root@c5 ~]# 

Installing MySQL Server


[root@c5 ~]# yum install mysql-server
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mysql-server.x86_64 0:5.0.95-1.el5_7.1 set to be updated
--> Processing Dependency: mysql = 5.0.95-1.el5_7.1 for package: mysql-server
--> Processing Dependency: libmysqlclient.so.15(libmysqlclient_15)(64bit) for package: mysql-server
--> Processing Dependency: perl-DBD-MySQL for package: mysql-server
--> Processing Dependency: perl(DBI) for package: mysql-server
--> Processing Dependency: perl-DBI for package: mysql-server
--> Processing Dependency: libmysqlclient_r.so.15(libmysqlclient_15)(64bit) for package: mysql-server
--> Processing Dependency: libmysqlclient_r.so.15()(64bit) for package: mysql-server
--> Processing Dependency: libmysqlclient.so.15()(64bit) for package: mysql-server
--> Running transaction check
---> Package mysql.x86_64 0:5.0.95-1.el5_7.1 set to be updated
---> Package perl-DBD-MySQL.x86_64 0:3.0007-2.el5 set to be updated
---> Package perl-DBI.x86_64 0:1.52-2.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================
 Package                        Arch                   Version                            Repository               Size
========================================================================================================================
Installing:
 mysql-server                   x86_64                 5.0.95-1.el5_7.1                   updates                 9.9 M
Installing for dependencies:
 mysql                          x86_64                 5.0.95-1.el5_7.1                   updates                 4.9 M
 perl-DBD-MySQL                 x86_64                 3.0007-2.el5                       base                    148 k
 perl-DBI                       x86_64                 1.52-2.el5                         base                    600 k

Transaction Summary
========================================================================================================================
Install       4 Package(s)
Upgrade       0 Package(s)

Total download size: 15 M
Downloading Packages:
(1/4): perl-DBD-MySQL-3.0007-2.el5.x86_64.rpm                                                    | 148 kB     00:00     
(2/4): perl-DBI-1.52-2.el5.x86_64.rpm                                                            | 600 kB     00:00     
(3/4): mysql-5.0.95-1.el5_7.1.x86_64.rpm                                                         | 4.9 MB     00:00     
(4/4): mysql-server-5.0.95-1.el5_7.1.x86_64.rpm                                                  | 9.9 MB     00:00     
------------------------------------------------------------------------------------------------------------------------
Total                                                                                    17 MB/s |  15 MB     00:00     
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : perl-DBI                                                                                         1/4 
  Installing     : mysql                                                                                            2/4 
  Installing     : perl-DBD-MySQL                                                                                   3/4 
  Installing     : mysql-server                                                                                     4/4 

Installed:
  mysql-server.x86_64 0:5.0.95-1.el5_7.1                                                                                

Dependency Installed:
  mysql.x86_64 0:5.0.95-1.el5_7.1        perl-DBD-MySQL.x86_64 0:3.0007-2.el5        perl-DBI.x86_64 0:1.52-2.el5       

Complete!
[root@c5 ~]# 

Start MySQL Server

[root@c5 tmp]# service mysqld start
Initializing MySQL database:  Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h c5.lamsinternational.com password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
                                                           [  OK  ]
Starting MySQL:                                            [  OK  ]
[root@c5 tmp]# 

Create a LAMS user within MySQL

[root@c5 tmp]# mysql -u root 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.0.95 Source distribution

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> CREATE DATABASE lams DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
Query OK, 1 row affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON lams.* TO lams@localhost IDENTIFIED BY 'lamsdemo'; 
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye
[root@c5 tmp]# 

Download LAMS v2.4 for Linux/Unix

[root@c5 tmp]# wget http://downloads.lamsinternational.com/2.4/stable/unix/lams-unix-installer-2.4.0.tar.gz

Prepare LAMS 2.4 installation

Copy JBoss and LAMS Binaries to app directory

Within the lams installer, copy the jboss-5.1 folder to /usr/local

[root@c5 lams-installer]# cp -rp jboss-5.1 /usr/local
[root@c5 lams-installer]#

Create a nonlogin user for LAMS

useradd -d /usr/local/jboss-5.1/bin -M lams

and set permissions

[root@c5 lams-installer]# chown -R lams:lams /usr/local/jboss-5.1/
[root@c5 lams-installer]# 

Import LAMS Db into MySQL

[root@c5 lams-installer]# mysql -u lams -p lams < lams.sql 
Enter password: lamsdemo
[root@c5 lams-installer]#

Customizing LAMS settings

The default settings for LAMS are:

LAMS ear folder

/usr/local/jboss-5.1/server/default/deploy/lams.ear

Repository directory

/var/opt/lams/repository

Temp directory

/var/opt/lams/tmp

Server URL

http://localhost:8080/lams/

If you want to change any of these settings, you can copy paste the text below, do the modifications necessary, save it as a file and then import it into mysql.
:q

Example: /tmp/config-lams.sql

update lams_configuration set config_value = 'http://<your-desired-url>:8080/lams/' where config_key = 'ServerURL';
update lams_configuration set config_value = '/usr/local/jboss-5.1/server/default/deploy/lams.ear' where config_key = 'EARDir';
update lams_configuration set config_value = '/var/opt/lams/repository' where config_key = 'ContentRepositoryPath';
update lams_configuration set config_value = '/var/opt/lams/Temp' where config_key = 'TempDir';

Then you can run this into the db as we did before:

[root@c5 lams-installer]# mysql -u lams -p lams < /tmp/config-lams.sql
Enter password: lamsdemo
[root@c5 lams-installer]#

Set permissions to repository and tmp folders

[root@c5 lams-installer]# mkdir -p /var/opt/lams
[root@c5 lams-installer]# chown -R lams:lams /var/opt/lams
[root@c5 lams-installer]# 

Start LAMS

su -l  lams -c "/usr/local/jboss-5.1/bin/run.sh -b 50.97.148.3"

[root@c5 local]# su -l  lams -c "/usr/local/jboss-5.1/bin/run.sh -b 50.97.148.3"
=========================================================================

  JBoss Bootstrap Environment

  JBOSS_HOME: /usr/local/jboss-5.1

  JAVA: java

  JAVA_OPTS: -Dprogram.name=run.sh -Xms128m -Xmx512m -XX:MaxPermSize=256m -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djava.net.preferIPv4Stack=true

  CLASSPATH: /usr/local/jboss-5.1/bin/run.jar

=========================================================================

11:49:02,275 INFO  [ServerImpl] Starting JBoss (Microcontainer)...
11:49:02,276 INFO  [ServerImpl] Release ID: JBoss [The Oracle] 5.1.0.GA (build: SVNTag=JBoss_5_1_0_GA date=200905221634)
11:49:02,276 INFO  [ServerImpl] Bootstrap URL: null
11:49:02,276 INFO  [ServerImpl] Home Dir: /usr/local/jboss-5.1
11:49:02,276 INFO  [ServerImpl] Home URL: file:/usr/local/jboss-5.1/
11:49:02,276 INFO  [ServerImpl] Library URL: file:/usr/local/jboss-5.1/lib/
11:49:02,277 INFO  [ServerImpl] Patch URL: null
11:49:02,277 INFO  [ServerImpl] Common Base URL: file:/usr/local/jboss-5.1/common/
11:49:02,277 INFO  [ServerImpl] Common Library URL: file:/usr/local/jboss-5.1/common/lib/
11:49:02,277 INFO  [ServerImpl] Server Name: default
11:49:02,277 INFO  [ServerImpl] Server Base Dir: /usr/local/jboss-5.1/server
11:49:02,277 INFO  [ServerImpl] Server Base URL: file:/usr/local/jboss-5.1/server/
11:49:02,277 INFO  [ServerImpl] Server Config URL: file:/usr/local/jboss-5.1/server/default/conf/
11:49:02,277 INFO  [ServerImpl] Server Home Dir: /usr/local/jboss-5.1/server/default
11:49:02,277 INFO  [ServerImpl] Server Home URL: file:/usr/local/jboss-5.1/server/default/
11:49:02,278 INFO  [ServerImpl] Server Data Dir: /usr/local/jboss-5.1/server/default/data
11:49:02,278 INFO  [ServerImpl] Server Library URL: file:/usr/local/jboss-5.1/server/default/lib/
11:49:02,278 INFO  [ServerImpl] Server Log Dir: /usr/local/jboss-5.1/server/default/log
11:49:02,278 INFO  [ServerImpl] Server Native Dir: /usr/local/jboss-5.1/server/default/tmp/native
11:49:02,278 INFO  [ServerImpl] Server Temp Dir: /usr/local/jboss-5.1/server/default/tmp
11:49:02,278 INFO  [ServerImpl] Server Temp Deploy Dir: /usr/local/jboss-5.1/server/default/tmp/deploy
11:49:02,736 INFO  [ServerImpl] Starting Microcontainer, bootstrapURL=file:/usr/local/jboss-5.1/server/default/conf/bootstrap.xml
...
...

11:49:52,180 INFO  [AutoPatchService] Applied 0 patches.
11:49:52,181 INFO  [ContextLoader] Root WebApplicationContext: initialization completed in 73 ms
11:49:52,192 INFO  [TilesPlugin] Tiles definition factory loaded for module ''.
11:49:52,192 INFO  [Dispatcher] Connector initialized to net.fckeditor.connector.impl.ContextConnector
11:49:52,198 INFO  [TomcatDeployment] deploy, ctxPath=/lams/www
11:49:52,349 INFO  [Http11Protocol] Starting Coyote HTTP/1.1 on http-50.97.148.3-8080
11:49:52,429 INFO  [AjpProtocol] Starting Coyote AJP/1.3 on ajp-50.97.148.3-8009
11:49:52,523 INFO  [ServerImpl] JBoss (Microcontainer) [5.1.0.GA (build: SVNTag=JBoss_5_1_0_GA date=200905221634)] Started in 50s:244ms


If you seen something like this, you now have LAMS running.

Login as sysadmin (u: sysadmin p: sysadmin) and you are ready to go.

Start on boot

If you need LAMS to start on boot (as service) then get start-stop-daemon to help you with this.

# cd /tmp
# yum install gcc
# wget "http://developer.axis.com/download/distribution/apps-sys-utils-start-stop-daemon-IR1_9_18-2.tar.gz"
# tar xvzf apps-sys-utils-start-stop-daemon-IR1_9_18-2.tar.gz 
# cd apps/sys-utils/start-stop-daemon-IR1_9_18-2/
# gcc start-stop-daemon.c -o start-stop-daemon
# cp start-stop-daemon /usr/sbin/

Now create a file called lams2 in /etc/init.d folder (as root) and modify the script below according to your setup (specifically the IP):

#!/bin/sh
# lams2        This shell script takes care of starting and stopping
#
# chkconfig: 2345 90 20 
# description:  LAMS 2
# processname: java
#
#               Written by Miquel van Smoorenburg <miquels@cistron.nl>.
#               Modified for Debian
#               by Ian Murdock <imurdock@gnu.ai.mit.edu>.
#               Modified for LAMS
#               by Ernie Ghiglione <ernieg@lamsfoundation.org>.
#
# Version:      @(#)skeleton  1.9  26-Feb-2001  miquels@cistron.nl
#

# Attempt to locate JAVA_HOME, code borrowed from jabref package

if [ -z $JAVA_HOME ]
then
        t=/usr/lib/jvm/java-1.6.0 && test -d $t && export JAVA_HOME=$t  
fi
JBOSS_USER=lams
JAVA_HOME=/usr/lib/jvm/java-1.6.0
PATH=/sbin:/bin:/usr/sbin:/usr/bin:${JAVA_HOME}/bin
JAVA=${JAVA_HOME}/bin/java
JBOSS_HOME=/usr/local/jboss-5.1
NAME=default
DESC="LAMS 2 Server $NAME"
IP=50.97.254.234

test -x $JAVA || exit 0

# Read an optional running configuration file
if [ "x$RUN_CONF" = "x" ]; then
    RUN_CONF="${JBOSS_HOME}/bin/run.conf"
fi
if [ -r "$RUN_CONF" ]; then
    . "$RUN_CONF"
fi

# Setup the java endorsed dirs
JBOSS_ENDORSED_DIRS="$JBOSS_HOME/lib/endorsed"

# Setup the classpath
runjar="$JBOSS_HOME/bin/run.jar"
if [ ! -f "$runjar" ]; then
    die "Missing required file: $runjar"
fi
JBOSS_BOOT_CLASSPATH="$runjar"

# Include the JDK javac compiler for JSP pages. The default is for a Sun JDK
# compatible distribution which JAVA_HOME points to
if [ "x$JAVAC_JAR" = "x" ]; then
    JAVAC_JAR="$JAVA_HOME/lib/tools.jar"
fi

if [ "x$JBOSS_CLASSPATH" = "x" ]; then
    JBOSS_CLASSPATH="$JBOSS_BOOT_CLASSPATH:$JAVAC_JAR"
else
    JBOSS_CLASSPATH="$JBOSS_CLASSPATH:$JBOSS_BOOT_CLASSPATH:$JAVAC_JAR"
fi

DAEMON_OPTS="$JAVA_OPTS -Djava.endorsed.dirs=$JBOSS_ENDORSED_DIRS -classpath $JBOSS_CLASSPATH -Dprogram.name org.jboss.Main -b $IP -c $NAME" 

#set -e
start() {
        start-stop-daemon --start --chuid $JBOSS_USER --quiet --background --make-pidfile --pidfile $JBOSS_HOME/$NAME.pid --exec $JAVA -- $DAEMON_OPTS

}

stop() {
        start-stop-daemon --stop --quiet --pidfile $JBOSS_HOME/$NAME.pid
}
case "$1" in
  start)
        echo "$DESC is starting up."
        start
        ;;
  stop)
        echo -n "Stopping $DESC... "
        stop
        rm -f /var/run/$NAME.pid
        echo "stopped."
        ;;
  status)
        if [ -e /var/run/$NAME.pid ]; then
            if [ -r /var/run/$NAME.pid ]; then
                pid=`cat /var/run/"$NAME".pid`
                if [ "X$pid" = "X" ]; then
                    echo "$DESC is not running."
                    exit 1
                else
                    echo "$DESC is running ($pid)."
                    exit 0
                fi
            fi
        fi
        echo "$DESC is not running."
        ;;
  restart|force-reload)
        #
        #       If the "reload" option is implemented, move the "force-reload"
        #       option to the "reload" entry above. If not, "force-reload" is
        #       just the same as "restart".
        #
        echo -n "Restarting $DESC: "
        #set +e
        stop
        #set -e
        sleep 10
        start
        ;;
  *)
        N=/etc/init.d/$NAME
        echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
        exit 1
        ;;
esac

exit 0

Now, make this file executable:

# chmod +x /etc/init.d/lams2

Set this and mysql up for startup on boot:

# cd /etc/init.d
# chkconfig --levels 235 lams2 on
# chkconfig --levels 235 mysqld on

And you are done!

For further details, please check out the Sysadmin Guide

Need help?

Check out the technical forums in the LAMS Community

  • No labels