How to install Lucee 5.2 on CentOS 7 x64 with Apache/2.4.6

Lucee is a light-weight dynamic scripting language for the JVM that enables the rapid development of simple to highly sophisticated web applications. Lucee is made for the web; it simplifies common tasks for this environment.

Lucee Server is a CFML engine. It allows you to write powerful web-based systems and deploy them to a variety of platforms. Lucee Server is written in Java and runs in a Java Servlet Container. When you download and install Lucee Server, you get a Servlet Container plus the Lucee code. But you don’t need to worry about that: you access Lucee Server features using CFML, a fast, easy-to-use language that you’ll learn in no time at all. Just write CFML files – typically one per page on your site – and then request them through the browser. Lucee Server will compile your work the first time you request that page. Lucee Server comes bundled with a lot of services that you’ll find useful in building your apps – session management, database connectivity, ORM, search engine, mail, scheduling, fast caches, subsystems for accessing disks, remote servers, Amazon services, support for REST, XML, JSON and much more. At the core of Lucee Server is the Lucee Server Administrator – a web application that lets you configure and maintain your own Lucee applications.

OS Installation

  1. Download: CentOS-7-x86_64-DVD-1708.iso from CentOS website
  2. Install CentOS 7 x64 1708 with minimal selection

    Select ‘Minimal Install’ but enable Debugging Tools, Compatibility Libraries and Development Tools

Hint: Make sure you have a working internet connection before you proceed to the next step.

OS Preparation

Hint: We expect your server is protected by firewalls, proxies and is configured within a protected environment. In any case, read the ‘best practice guide‘ to protect your Lucee equipment.

Work remotely
  1. Disable firewalld
    # systemctl disable firewalld
    # systemctl stop firewalld
Install required software
  1. Remove Postfix and install Sendmail
    # yum -y remove postfix
    # yum -y install sendmail*
  2. Install Apache
    # yum -y install httpd*
  3. Install MariaDB
    # yum -y install mariadb*
  4. Install deltarpm
    # yum -y install deltarpm
  5. Install wget and dos2unix
    # yum -y install wget
    # yum -y install dos2unix
  6. Update your system
    # yum -y update
  7. Install Webmin
    # yum -y install perl-Net-SSLeay# yum -y install perl-Encode-Detect
    # rpm -ihv https://netix.dl.sourceforge.net/project/webadmin/webmin/1.880/webmin-1.880-1.noarch.rpm
Service configuration
  1. Disable SELinux by configuring SELINUX=disabled
    # cat /etc/selinux/config
    # This file controls the state of SELinux on the system.
    # SELINUX= can take one of these three values:
    # enforcing - SELinux security policy is enforced.
    # permissive - SELinux prints warnings instead of enforcing.
    # disabled - No SELinux policy is loaded.
    SELINUX=disabled
    # SELINUXTYPE= can take one of three two values:
    # targeted - Targeted processes are protected,
    # minimum - Modification of targeted policy. Only selected processes are protected.
    # mls - Multi Level Security protection.
    SELINUXTYPE=targeted
  2. Start and enable Webmin
    # systemctl start webmin
    # systemctl enable webmin
  3. Start and enable MariaDB
    # systemctl start mariadb
    # systemctl enable mariadb
  4. Start and enable Apache
    # systemctl start httpd
    # systemctl enable httpd
  5. Start and enable Sendmail
    # systemctl start sendmail
    # systemctl enable sendmail
  6. Reboot your server
    # shutdown -r now

Lucee Installation

  1. Check the latest version
    Goto http://download.lucee.org/?type=releases to check which file you need to download.
    We select Linux (64b) within this instructions because we are looking for the installer for x64 Linux.
  2. Download the installer
    # cd /root
    # wget http://cdn.lucee.org/lucee-5.2.6.059-pl0-linux-x64-installer.run
  3. Make the installer executable and execute the installer
    # chmod +x lucee-5.2.6.059-pl0-linux-x64-installer.run
    # ./lucee-5.2.6.059-pl0-linux-x64-installer.run
    ----------------------------------------------------------------------------
    Welcome to the Lucee Installer.
    ----------------------------------------------------------------------------
    Please read the following License Agreement. You must accept the terms of this
    agreement before continuing with the installation.
    Press [Enter] to continue:
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
    FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
    COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
    IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
    CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    Lucee Server is Copyright (c) 2018 by the Lucee Association Switzerland, and is
    distributed
    under the LGPL v2 License:
    http://www.opensource.org/licenses/lgpl-2.1.php
    The Apache Tomcat Server is Copyright (c) 1999-2018 by the Apache Software
    Foundation and is distributed under the Apache License version 2:
    http://www.apache.org/licenses/
    The Java JRE is Copyright (c) 1993-2018 by Oracle and/or its affiliates, and is
    released under the Oracle License:
    http://www.oracle.com/technetwork/java/javase/terms/license/index.html
    Press [Enter] to continue:
    Do you accept this license? [y/n]: y
    ----------------------------------------------------------------------------
    Please specify the directory where Lucee will be installed.
    Installation Directory [/opt/lucee]: /opt/lucee
    ----------------------------------------------------------------------------
    Lucee Password
    Please enter in the default passwords for the Lucee Server Administrator and the
    Lucee Web Administrators.
    Lucee Password : 123456
    Lucee Password (confirm) : 123456
    ----------------------------------------------------------------------------
    Tomcat Ports
    Tomcat needs to reserve "ports" on your computer in order to serve various types
    of requests. You can customize those ports using the fields below. If you are
    unsure, the default values provided below are perfectly safe to use.
    Tomcat Web Server Port: [8888]: 8888
    Tomcat Shutdown Port: [8005]: 8005
    Tomcat AJP Port: [8009]: 8009
    ----------------------------------------------------------------------------
    Tomcat System User
    Enter in the System User Account that Tomcat will run under. Running as "root"
    or "Administrator" on Windows will avoid system permission problems, while
    running as a non-root user will add an additional layer of security. If you
    choose to run as a non-root user, we recommend using a easily identifiable
    username like "lucee" or "cfml".
    [root]: root
    ----------------------------------------------------------------------------
    Start At Boot?
    Do you want Lucee to start up automatically whenever the system boots up?
    Yes, Start Lucee at Boot Time [Y/n]: y
    ----------------------------------------------------------------------------
    Install Apache Connector?
    This option will install mod_proxy_http so that you can utilize Apache as a web
    server in front of your Lucee installation. This option is recommended if you're
    using Apache.
    Yes, Install Apache Connector [Y/n]: y
    ----------------------------------------------------------------------------
    Install modcfml?

    creating new hosts in Tomcat whenever you add a new host to your web server.
    To learn more about mod_cfml, visit its website at modcfml.org. This option is
    recommended for most environments.
    Yes, Install mod_cfml [Y/n]: y
    ----------------------------------------------------------------------------
    Apache Control Script Location
    Please enter the location of your apache control script. The default location
    for this script is "/usr/sbin/apachectl".
    Apache Control Script Location [/usr/sbin/apachectl]: /usr/sbin/apachectl
    ----------------------------------------------------------------------------
    Apache Modules Directory
    Please enter the directory that apache stores it's modules in. By default, this
    directory is located at "/usr/lib/httpd/modules/" for RHEL/CentOS, and
    "/usr/lib/apache2/modules/" for Ubuntu. For 64-bit systems, try changing the
    "lib" directory to "lib64".
    Apache Modules Directory [/usr/lib64/httpd/modules]: /usr/lib64/httpd/modules
    ----------------------------------------------------------------------------
    Apache Configuration File
    The Apache configuration file controls how Apache processes incoming requests.
    The default location of the Apache configuration file is
    "/etc/httpd/conf/httpd.conf" on RHEL/CentOS and "/etc/apache2/apache2.conf" on
    Ubuntu.
    Apache Configuration File [/etc/httpd/conf/httpd.conf]: /etc/httpd/conf/httpd.conf
    ----------------------------------------------------------------------------
    Apache Logs Directory
    Please enter the directory that Apache stores it's log files in. By default,
    this directory is located at "/var/log/httpd/" for RHEL/CentOS, and
    "/var/log/apache2/" for Ubuntu.
    Apache Logs Directory [/var/log/httpd]: /var/log/httpd
    ----------------------------------------------------------------------------
    Setup is now ready to begin installing Lucee on your computer.
    Do you want to continue? [Y/n]: y
    ----------------------------------------------------------------------------
    Please wait while Setup installs Lucee on your computer.
    Installing
    0% ______________ 50% ______________ 100%
    ########################################
    ----------------------------------------------------------------------------
    Setup has finished installing Lucee on your computer.

  4. Download service wrapper and mark it executable# wget https://raw.githubusercontent.com/lucee/Lucee4/master/build/installer/os/linux/sys/service_config.sh
    # chmod +x service_config.sh
  5. Install service wrapper
    # ./service_config.sh --install --path /opt/lucee/lucee_ctl
    ## Installing Lucee Service ##
    * [INFO]: Detected RedHat-based build.
    * [INFO]: Checking for 'chkconfig' executable in the PATH...[FOUND]
    ## Installation Complete ##
  6. Restart Lucee and enable the service
    # /etc/init.d/lucee_ctl restart
    # chkconfig lucee_ctl on
  7. Check if you have WEB-INF directory within /var/www/html
    # ls -ltrah /var/www/html
    total 0
    drwxr-xr-x. 4 root root 33 Mar 9 18:51 ..
    drwxr-xr-x. 3 root root 21 Mar 9 20:16 .
    Normally the directory is empty at this point.
  8. Try to open a URL within a browser ending with .cfm, for example http:///test.cfm. You will see following errormessage:
    Make sure the Message displayed (Page /test.cfm [/var/www/html/test.cfm]) is referring to your Apache root-directory.
  9. Check that you have a WEB-INF directory within /var/www/html _now_.
    # ls -ltrah /var/www/html
    total 0
    drwxr-xr-x. 4 root root 33 Mar 9 18:51 ..
    drwxr-xr-x. 3 root root 21 Mar 9 20:16 .
    drwxr-xr-x 3 root root 36 Mar 9 20:16 WEB-INF
  10. Add proxy.conf to /etc/httpd/conf.d
    Create a new file /etc/httpd/conf.d/proxy.conf
    # touch /etc/httpd/conf.d/proxy.confand add following content to it (make sure the URL within this file is referring to your Tomcat AJP Port. the one you have specified during the installation):
    # cat /etc/httpd/conf.d/proxy.conf
    <Proxy *>
    Allow from 127.0.0.1
    </proxy>
    ProxyPreserveHost On
    ProxyPassMatch ^/(.+\.cf[cm])(/.*)?$ ajp://127.0.0.1:8009/$1$2
    ProxyPassMatch ^/(.+\.cfchart)(/.*)?$ ajp://127.0.0.1:8009/$1$2
    ProxyPassMatch ^/(.+\.cfml)(/.*)?$ ajp://127.0.0.1:8009/$1$2
    ProxyPassReverse / ajp://127.0.0.1:8009/
  11. Restart Apache and Lucee
    # systemctl restart httpd
    # service lucee_ctl restart

Test Lucee

  1. Make sure Apache is running fine by opening http://<youripaddress>
  2. Make sure Lucee is running fine by opening http://<youripaddress>:8888

    Hint: In case you receive an errormessage, please restart the Lucee service and try immediately again.
  3. Download the following testfiles.zip, unpack it and upload it to your server into /var/www/html
    –> Download ‘testfiles.zip’
  4. Open http://<youripaddress>/test.cfm to check if the files are rendered correctly.

Configure Lucee

  1. Point your browser to http://<youripaddress>:8888/lucee/admin/server.cfm and login with the password you have specified during the installation process.

Have fun 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.