在 CentOS 7 上设置 AEM 6.x.

先决条件

  1. AEM 安装在你的服务器上。复制安装路径(例如:/ mnt / crx)
  2. 启动 AEM(例如 java -jar cq-quickstart-author-p4502.jar)一次。这将生成所有必需的文件夹,特别是脚本所需的 / mnt / crx / crx-quickstart / bin
  3. 创建将有权访问该服务的用户。 (例如:aem)

分步指南

  1. 你将需要 root 访问权限
  2. 创建这两个文件
    • AEM
        #!/bin/bash
        #
        # /etc/rc.d/init.d/aem6
        #
        #
        # # of the file to the end of the tags section must begin with a #
        # character. After the tags section, there should be a blank line.
        # This keeps normal comments in the rest of the file from being
        # mistaken for tags, should they happen to fit the pattern.>
        #
        # chkconfig: 35 85 15
        # description: This service manages the Adobe Experience Manager java process.
        # processname: aem6
        # pidfile: /crx-quickstart/conf/cq.pid
         
        # Source function library.
        . /etc/rc.d/init.d/functions
         
        SCRIPT_NAME=`basename $0`
        AEM_ROOT=/opt/aem6
        AEM_USER=aem
         
        ########
        BIN=${AEM_ROOT}/crx-quickstart/bin
        START=${BIN}/start
        STOP=${BIN}/stop
        STATUS="${BIN}/status"
         
        case "$1" in
        start)
        echo -n "Starting AEM services: "
        su - ${AEM_USER} ${START}
        touch /var/lock/subsys/$SCRIPT_NAME
        ;;
        stop)
        echo -n "Shutting down AEM services: "
        su - ${AEM_USER} ${STOP}
        rm -f /var/lock/subsys/$SCRIPT_NAME
        ;;
        status)
        su - ${AEM_USER} ${STATUS}
        ;;
        restart)
        su - ${AEM_USER} ${STOP}
        su - ${AEM_USER} ${START}
        ;;
        reload)
        ;;
        *)
        echo "Usage: $SCRIPT_NAME {start|stop|status|reload}"
        exit 1
        ;;
        esac
  • aem.service
    [Unit]
    Description=Adobe Experience Manager
    
    [Service]
    Type=simple
    ExecStart=/usr/bin/aem start
    ExecStop=/usr/bin/aem stop
    ExecReload=/usr/bin/aem restart
    RemainAfterExit=yes
    
    [Install]
    WantedBy=multi-user.target
  1. 打开 aem 脚本文件并更新如下
    • AEM_ROOT(例如:/mnt/crx 是根,其中/mnt/crx/crx-quickstart 是完整路径)
    • AEM_USER(例如:aem
  2. SCP 将这些文件发送到服务器
    • aem 复制到/usr/bin/aem
      • 示例:从桌面上的终端 $ scp <filename> user@1.1.1.1:/usr/bin/aem
    • aem.service 复制到/etc/system.d/system/aem.system
      • 示例:从桌面上的终端 $ scp <filename> user@1.1.1.1:/etc/system.d/system/aem.system
  3. SSH 到你的服务器
    • ssh user@1.1.1.1
  4. 授予文件权限
    • sudo chmod u+rwx /usr/bin/aem
    • sudo chmod u+rwx /etc/system.d/system/aem.system
  5. 更新
    • cd /etc/system.d/system
    • systemctl enable aem.system
  6. 你可以重新启动服务器或运行以下命令来启动 AEM。在运行此命令之前,请确保运行先决条件步骤 2

命令 START,RESTART 和 STOP AEM

  1. 启动 AEM - sudo service aem start
  2. 重启 AEM - sudo service aem restart
  3. 停止 AEM - sudo service aem stop

笔记

  1. 以上示例在 CentOS 7 上进行了测试
  2. 使用 AEM 6.3 版本。虽然上述过程适用于 AEM 6.x.