Atlassian jira install

系统初始化

  1. 服务器信息

    1
    10.10.10.11 jira
  2. 查看系统版本

    1
    2
    [root@localhost ~]# cat /etc/redhat-release
    CentOS Linux release 7.3.1611 (Core)
  3. 设置主机名

    1
    2
    3
    4
    //jira
    [root@localhost ~]# hostname jira && echo jira | tee /etc/hostname
    [root@localhost ~]# echo '10.10.10.11 jira' |tee -a /etc/hosts
    [root@localhost ~]# $SHELL
  4. 硬盘格式化挂载

    1
    2
    3
    [root@[x] ~]# mkfs.xfs /dev/vdb
    [root@[x] ~]# echo '/dev/vdb /mnt xfs defaults 0 0' | tee -a /etc/fstab
    [root@[x] ~]# mount -a
  5. 设置打开最大文件数

    1
    2
    3
    [root@[x] ~]# echo '* - nproc  65535' | tee -a /etc/security/limits.conf
    [root@[x] ~]# echo '* - nofile 65535' | tee -a /etc/security/limits.conf
    [root@[x] ~]# ls /etc/security/limits.d/*|xargs rm -f
  6. 设置yum源

    1
    2
    3
    4
    5
    6
    [root@[x] ~]# mkdir /etc/yum.repos.d/backup && mv /etc/yum.repos.d/{*,backup}
    [root@[x] ~]# rpm --import http://yum.ops.cn/epel/RPM-GPG-KEY-EPEL-7
    [root@[x] ~]# curl -o /etc/yum.repos.d/epel.repo http://yum.ops.cn/epel-7.repo
    [root@[x] ~]# rpm --import http://yum.ops.cn/centos/RPM-GPG-KEY-CentOS-7
    [root@[x] ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo http://yum.ops.cn/centos-7.repo
    [root@[x] ~]# yum clean all && yum makecache
  7. 安装基础依赖库和常用工具包

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    [root@[x] ~]# yum -y groupinstall "Development Tools"
    [root@[x] ~]# yum -y install \
    make cmake \
    bison-devel \
    bzip2-devel \
    zlib zlib-devel \
    openssl openssl-devel openssl-libs openssl-static \
    pcre pcre-devel pcre-static \
    ncurses ncurses-devel ncurses-libs \
    curl-devel \
    expat-devel \
    gettext-devel \
    openldap openldap-devel \
    readline readline-devel readline-static \
    libssh2 libssh2-devel \
    unixODBC unixODBC-devel \
    sqlite sqlite-devel \
    tcl tcl-devel \
    perl-Digest-SHA1 \
    python-libs python-devel python2-pip python-crypto \
    perl-libs \
    perl-ExtUtils-MakeMaker \
    GeoIP GeoIP-devel \
    gperftools gperftools-devel gperftools-libs \
    libatomic_ops-devel \
    gtest gtest-devel \
    gdk-pixbuf2 gdk-pixbuf2-deve \
    libffi libffi-devel \
    libcurl libcurl-devel \
    http-parser http-parser-devel \
    libxml2* \
    libmcrypt* \
    libtool-ltdl-devel*
    [root@[x] ~]# yum -y install bash-completion fop lftp ntp ntpdate vim wget telnet dstat tree lrzsz net-tools nmap-ncat nmap sysstat dmidecode bc
  8. 关闭selinux

    1
    2
    [root@[x] ~]# setenforce 0
    [root@[x] ~]# sed -i s/'SELINUX=enforcing'/'SELINUX=disabled'/g /etc/selinux/config
  9. 关闭防火墙

    1
    [root@[x] ~]# systemctl stop firewalld && systemctl disable firewalld
  10. 设置系统时区

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    [root@[x] ~]# ntpdate cn.pool.ntp.org

    [root@[x] ~]# [ -f /etc/localtime ] && cp -f /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
    [root@[x] ~]# [ -f /etc/sysconfig/clock ] && echo 'ZONE="Asia/Shanghai"' | tee /etc/sysconfig/clock
    [root@[x] ~]# [ -f /etc/timezone ] && echo 'Asia/Shanghai' | tee /etc/timezone
    [root@[x] ~]# [ -f /etc/sysconfig/ntpd ] && echo 'SYNC_HWCLOCK=yes' | tee -a /etc/sysconfig/ntpd

    [root@[x] ~]# cp -f /etc/{ntp.conf,ntp.conf.bak}
    [root@[x] ~]# cat > /etc/ntp.conf <<EOF
    driftfile /var/lib/ntp/drift
    restrict default nomodify notrap nopeer noquery
    restrict 127.0.0.1
    restrict ::1
    server cn.pool.ntp.org prefer
    server 0.centos.pool.ntp.org iburst
    server 1.centos.pool.ntp.org iburst
    server 2.centos.pool.ntp.org iburst
    server 3.centos.pool.ntp.org iburst
    includefile /etc/ntp/crypto/pw
    keys /etc/ntp/keys
    disable monitor
    EOF

    [root@[x] ~]# cp -f /etc/ntp/{step-tickers,step-tickers.bak}
    [root@[x] ~]# cat > /etc/ntp/step-tickers <<EOF
    cn.pool.ntp.org
    0.centos.pool.ntp.org
    1.centos.pool.ntp.org
    2.centos.pool.ntp.org
    3.centos.pool.ntp.org
    EOF

    [root@[x] ~]# systemctl start ntpd && systemctl enable ntpd
  11. 安装python,并设置python源

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    [root@[x] ~]# git clone https://github.com/yyuu/pyenv.git /usr/local/pyenv

    [root@[x] ~]# echo 'export PYENV_ROOT="/usr/local/pyenv"' | tee /etc/profile.d/pyenv.sh
    [root@[x] ~]# echo 'export PATH="$PYENV_ROOT/bin:$PATH"' | tee -a /etc/profile.d/pyenv.sh
    [root@[x] ~]# echo 'eval "$(pyenv init -)"' | tee -a /etc/profile.d/pyenv.sh
    [root@[x] ~]# source /etc/profile

    [root@[x] ~]# mkdir -p ${PYENV_ROOT}/cache
    [root@[x] ~]# ls ${PYENV_ROOT}/cache/Python-2.7.13.tar.xz 将源码包放到这里
    [root@[x] ~]# pyenv install 2.7.13
    [root@[x] ~]# pyenv local 2.7.13

    [root@[x] ~]# mkdir ~/.pip
    [root@[x] ~]# cat > ~/.pip/pip.conf <<EOF
    [global]
    trusted-host=mirrors.aliyun.com
    index-url=http://mirrors.aliyun.com/pypi/simple/
    [list]
    format=columns
    EOF
  12. 设置开机启动文件权限

    1
    [root@[x] ~]# chmod +x /etc/rc.d/rc.local
  13. 创建常见目录

    1
    [root@[x] ~]# mkdir -p /mnt/{app,data,log,web,ops/{app,data,cron}}
  14. 部署mysql
    jira mysql install

  15. 部署java

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    //jira/confluence:
    [root@[x] ~]# tar xzf jdk-8u131-linux-x64.tar.gz
    [root@[x] ~]# mv jdk1.8.0_131 /mnt/app/java
    [root@[x] ~]# chown -R root.root /mnt/app/java
    [root@[x] ~]# echo 'JAVA_HOME=/mnt/app/java' | tee /etc/profile.d/java.sh
    [root@[x] ~]# echo 'JRE_HOME=${JAVA_HOME}/jre' | tee -a /etc/profile.d/java.sh
    [root@[x] ~]# echo 'CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib' | tee -a /etc/profile.d/java.sh
    [root@[x] ~]# echo 'export PATH=${JAVA_HOME}/bin:$PATH' | tee -a /etc/profile.d/java.sh
    [root@[x] ~]# source /etc/profile
    [root@[x] ~]# java -version
  16. 部署jira

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    [root@jira app]# chmod +x atlassian-jira-software-7.5.0-x64.bin
    [root@jira app]# ./atlassian-jira-software-7.5.0-x64.bin
    Unpacking JRE ...
    Starting Installer ...
    Oct 10, 2017 10:15:40 AM java.util.prefs.FileSystemPreferences$2 run
    INFO: Created system preferences directory in java.home.

    This will install JIRA Software 7.5.0 on your computer.
    OK [o, Enter], Cancel [c]
    o
    Choose the appropriate installation or upgrade option.
    Please choose one of the following:
    Express Install (use default settings) [1], Custom Install (recommended for advanced users) [2, Enter], Upgrade an existing JIRA installation [3]
    2

    Where should JIRA Software be installed?
    [/opt/atlassian/jira]
    /mnt/app/jira
    Default location for JIRA Software data
    [/var/atlassian/application-data/jira]
    /mnt/data/jira.home
    Configure which ports JIRA Software will use.
    JIRA requires two TCP ports that are not being used by any other
    applications on this machine. The HTTP port is where you will access JIRA
    through your browser. The Control port is used to startup and shutdown JIRA.
    Use default ports (HTTP: 8080, Control: 8005) - Recommended [1, Enter], Set custom value for HTTP and Control ports [2]
    1
    JIRA can be run in the background.
    You may choose to run JIRA as a service, which means it will start
    automatically whenever the computer restarts.
    Install JIRA as Service?
    Yes [y, Enter], No [n]
    y
    Details on where JIRA Software will be installed and the settings that will be used.
    Installation Directory: /mnt/app/jira
    Home Directory: /mnt/data/jira.home
    HTTP Port: 8080
    RMI Port: 8005
    Install as service: Yes
    Install [i, Enter], Exit [e]
    i

    Extracting files ...


    Please wait a few moments while JIRA Software is configured.
    Installation of JIRA Software 7.5.0 is complete
    Start JIRA Software 7.5.0 now?
    Yes [y, Enter], No [n]
    y

    Please wait a few moments while JIRA Software starts up.
    Launching JIRA Software ...
    Installation of JIRA Software 7.5.0 is complete
    Your installation of JIRA Software 7.5.0 is now ready and can be accessed
    via your browser.
    JIRA Software 7.5.0 can be accessed at http://localhost:8080
    Finishing installation ...
  17. 停止服务

    1
    [root@jira app]# /etc/init.d/jira stop
  18. 将JDBC的客户端拷贝到jira安装目录lib下

    1
    2
    3
    [root@jira app]# cp mysql-connector-java-5.1.44-bin.jar /mnt/app/jira/lib/
    [root@jira app]# ls -1 /mnt/app/jira/lib/mysql-connector-java-5.1.44-bin.jar
    /mnt/app/jira/lib/mysql-connector-java-5.1.44-bin.jar
  19. 创建数据库

    1
    2
    [root@jira app]# mysql -u{username} -p{password} -h{ipaddress}
    MariaDB [(none)]> CREATE DATABASE jira CHARACTER SET utf8 COLLATE utf8_bin;
  20. 查看设置jira.home配置文件

    1
    2
    [root@jira app]# cat /mnt/app/jira/atlassian-jira/WEB-INF/classes/jira-application.properties
    jira.home = /mnt/data/jira.home
  21. 查看启动jira时java版本

    1
    2
    3
    [root@jira app]# vim /mnt/app/jira/bin/check-java.sh
    _EXPECTED_JAVA_VERSION="8"
    #_RUNJAVA=/mnt/app/java/bin/java 注意: 如果使用tar包解压,这里最好加上_RUNJAVA变量
  22. 查看jira启动端口号

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    [root@jira app]# vim /mnt/app/jira/conf/server.xml
    <Connector port="8080"
    maxThreads="150"
    minSpareThreads="25"
    connectionTimeout="20000"
    enableLookups="false"
    maxHttpHeaderSize="8192"
    protocol="HTTP/1.1"
    useBodyEncodingForURI="true"
    redirectPort="8443"
    acceptCount="100"
    disableUploadTimeout="true"
    bindOnInit="false"/>
  23. 设置jira systemd

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    [root@jira app]# cat /etc/init.d/jira
    #!/bin/bash

    # JIRA Linux service controller script
    cd "/mnt/app/jira/bin"

    case "$1" in
    start)
    ./start-jira.sh
    ;;
    stop)
    ./stop-jira.sh
    ;;
    *)
    echo "Usage: $0 {start|stop}"
    exit 1
    ;;
    esac

    [root@jira app]# cat > /usr/lib/systemd/system/jira.service <<EOF
    [Unit]
    Description=jira - atlassian-jira
    Documentation=https://confluence.atlassian.com/alldoc/atlassian-documentation-32243719.html
    After=network.target remote-fs.target nss-lookup.target

    [Service]
    Type=forking
    ExecStart=/mnt/app/jira/bin/start-jira.sh
    ExecStop=/mnt/app/jira/bin/stop-jira.sh
    PrivateTmp=true
    Restart=always

    [Install]
    WantedBy=multi-user.target
    EOF
  24. 启动jira

    1
    2
    3
    [root@jira app]# systemctl daemon-reload
    [root@jira app]# systemctl start jira
    [root@jira app]# systemctl enable jira
  25. 访问jira

    1
    2
    3
    4
    5
    * 浏览器中输入: http://{IP}:8080
    * 选择"中文",自定义设置
    * 选择"Mysql",根据提示输入 数据库地址,用户名,密码
    * 输入"Listen key"
    * 根据提示操作,结束