温馨提示:
- 服务器配置至少4核CPU、16GB内存才能较为流畅使用,不推荐个人搭建使用
一、前期准备
1.1 下载相关软件
-
Confluence
不用下载
1.2 虚拟机安装CentOS7
1.2.1 安装步骤
自行百度
1.2.2 linux设置
- 查看系统版本
cat /etc/redhat-release
- 查看系统语言
echo $LANG
- 检查系统时间
date
- 服务裁剪
setup
保留network、NetworkManager、crond、irqbalance、rsyslog、ssd、sysstat - 关闭防火墙
systemctl stop firewall
- 更改系统启动等级(使用多用户命令行)
systemctl set-default multi-user.target
- 更改主机名
vim /etc/sysconfig/network
vim /etc/hosts
vim /etc/hostname
hostnamectl set-hostname <新主机名>
hostname <新主机名>
- 安装dos2unix
yum install dos2unix -y
- 重启服务器
reboot
- 更改软件源
rm -rf /etc/yum.repos.d/*.repo
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum clean all && yum makecache
yum update -y
- 卸载开源jdk
rpm -qa|grep jdk
yum remove -y <packagename>
1.3 CentOS7安装Oracel JDK
- 安装oracel的jdk
mkdir -p /usr/local/java
cd /usr/local/java
tar -zxvf jdk-8u171-linux-x64.tar.gz
- 设置环境变量
vim /etc/profile
JAVA_HOME=/usr/local/java/jdk1.8.0_171
CLASSPATH=$JAVA_HOME/lib/
PATH=$PATH:$JAVA_HOME/bin
export PATH JAVA_HOME CLASSPATH
source /etc/profile
- 查看java版本
java -version
1.4 CentOS7安装Docker
- 安装docker-ce
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
docker --version
- 配置docker加速
第一种方式:
mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["http://hub-mirror.c.163.com"]
}
注意:"registry-mirrors"前的空白符是一个TAB而非空格
systemctl daemon-reload
systemctl restart docker
第二种方式:
curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io
- 配置docker
dig @114.114.114.114 registry-1.docker.io | grep registry-1.docker.io. | awk -F ' ' '{print$5}'
vim /etc/hosts
xxx.xxx.xxx.xxx registry-1.docker.io
vim /etc/sysconfig/network-scripts/ifcfg-eth0
DNS1=223.5.5.5
DNS2=223.6.6.6
systemctl restart docker
参阅:
- docker报错Error response from daemon
- 公共DNS
- 修改/etc/resolv.conf又恢复到原来的状态?
vim /etc/sysconfig/network-scripts/ifcfg-eth0
1.5 CentOS7安装MySQL5.7
- 创建安装目录
mkdir -p /opt/mysql
- 将组件包上传到安装目录下
- 解压
tar -zxvf mysql-5.7.30-linux-glibc2.12-x86_64.tar.gz
- 修改目录名
mv mysql-5.7.30-linux-glibc2.12-x86_64 mysql-5.7.30
- 检查mysql组和用户是否存在,如果没有则创建
cat /etc/group|grep mysql
groupadd mysql
useradd -r -g mysql mysql
- 创建数据目录
cd /opt/mysql/mysql-5.7.30
mkdir -p data
- 将/opt/mysql/mysql-5.7.30的所有者及所属组改为mysql
chown -R mysql:mysql /opt/mysql/mysql-5.7.30
- 在/opt/mysql/mysql-5.7.30/support-files目录下创建my_default.cnf
cd /opt/mysql/mysql-5.7.30/support-files
vim my_default.cnf
[mysqld]
#设置mysql的安装目录
basedir = /opt/mysql/mysql-5.7.30
#设置mysql数据库的数据存放目录
datadir = /opt/mysql/mysql-5.7.30/data
#设置端口
port = 3306
socket = /tmp/mysql.sock
transaction-isolation=READ-COMMITTED
default-storage-engine=INNODB
innodb_default_row_format=DYNAMIC
innodb_large_prefix=ON
innodb_file_format=Barracuda
innodb_log_file_size=2G
#设置字符集
character-set-server=utf8mb4
#日志存放目录
log-error = /opt/mysql/mysql-5.7.30/data/mysqld.log
pid-file = /opt/mysql/mysql-5.7.30/data/mysqld.pid
#允许时间类型的数据为零(去掉NO_ZERO_IN_DATE,NO_ZERO_DATE,NO_AUTO_VALUE_ON_ZERO)
sql_mode=ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
#ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,NO_AUTO_VALUE_ON_ZERO
cp my_default.cnf /etc/my.cnf
- 初始化数据库
/opt/mysql/mysql-5.7.30/bin/mysqld --initialize --user=mysql --basedir=/opt/mysql/mysql-5.7.30/ --datadir=/opt/mysql/mysql-5.7.30/data/
- 获取临时密码
cat /opt/mysql/mysql-5.7.30/data/mysqld.log | grep password
- 启动脚本放到开机初始化目录
cp /opt/mysql/mysql-5.7.30/support-files/mysql.server /etc/init.d/mysql
- mysql作为系统命令
cp /opt/mysql/mysql-5.7.30/bin/mysql /sbin/
- systemctl启动脚本
vim /usr/lib/systemd/system/mysql.service
[Unit]
Description=MySQL Server
Documentation=man:mysqld(8)
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html
After=network.target
After=syslog.target
[Install]
WantedBy=multi-user.target
[Service]
User=mysql
Group=mysql
PIDFile=/opt/mysql/mysql-5.7.30/data/mysqld.pid
# Disable service start and stop timeout logic of systemd for mysqld service.
TimeoutSec=0
# Execute pre and post scripts as root
PermissionsStartOnly=true
# Needed to create system tables
#ExecStartPre=/usr/bin/mysqld_pre_systemd
# Start main service
ExecStart=/opt/mysql/mysql-5.7.30/bin/mysqld --daemonize --pid-file=/opt/mysql/mysql-5.7.30/data/mysqld.pid
# 注意这里要加上 --daemonize
# Use this to switch malloc implementation
#EnvironmentFile=-/etc/sysconfig/mysql
# Sets open_files_limit
LimitNOFILE = 5000
Restart=on-failure
RestartPreventExitStatus=1
PrivateTmp=false
- 启动mysql
chkconfig mysql on
systemctl start mysql
- 进入mysql
mysql -uroot -p
- 执行SQL
-- 更改root登录密码及允许远程访问
set password=password('123456');
grant all privileges on *.* to root@'%' identified by '123456';
flush privileges;
-- 创建jira数据库及用户
create database jira character set utf8mb4 collate utf8mb4_bin;
create user jira identified by 'jiraworker';
grant select,insert,update,delete,create,drop,references,alter,index on jira.* to 'jira'@'%';
flush privileges;
-- 创建confluence数据库及用户
create database confluence character set utf8mb4 collate utf8mb4_bin;
create user cf identified by 'cfworker';
grant select,insert,update,delete,create,drop,references,alter,index on confluence.* to 'cf'@'%' ;
flush privileges;
-- 设置confdb事务级别
show variables like 'tx%';
set global tx_isolation='READ-COMMITTED';
set session transaction isolation level read committed;
show variables like 'tx%';
flush privileges;
-- 退出
exit;
- 重启mysql服务
systemctl restart mysql
参阅:
1.6 CentOS7安装Portainer
- 下载镜像
docker pull portainer/portainer
- 启动容器
docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock --name portainer portainer/portainer
- 访问界面
<虚拟机IP>:9000
二、开始安装
- 创建文件目录
mkdir -p /home/jira
mkdir -p /home/confluence
2.1 安装Jira
2.1.1 第一种方式:docker安装Jira
- 编写Dockerfile文件
cd /home/jira
vim Dockerfile
FROM cptactionhank/atlassian-jira-software:8.1.0
USER root
# 将代理破解包加入容器
COPY "atlassian-agent.jar" /opt/atlassian/jira/
# 设置启动加载代理包
RUN echo 'export CATALINA_OPTS="-javaagent:/opt/atlassian/jira/atlassian-agent.jar ${CATALINA_OPTS}"' >> /opt/atlassian/jira/bin/setenv.sh
- atlassian-extras-3.2.jar上传到/home/jira
- 构建镜像
docker build -f Dockerfile -t jira/jira:v8.1.0 .
启动容器
docker run --detach --publish 8080:8080 --name jira -e JAVA_OPTS='-Xmx512m' jira/jira:v8.1.0
或
docker run --detach --publish 8080:8080 --name jira jira/jira:v8.1.0
访问Jira安装界面(界面多等等,加载慢)
<虚拟机IP>:8080
提示:
- 数据库类型选择MySQL5.7(报错就选择MySQL5.6)
- 数据库、用户名及密码:jira、jira、jiraworker
- 生成jira密钥
java -jar /home/jira/atlassian-agent.jar -d -m test@test.com -n Test -p jira -o http://<虚拟机IP> -s <服务ID>
-m test@test.com -n Test
中test@test.com
修改为自己的邮箱,Test
为个人的名称
【界面演示】
2.1.2 第二种方式:官方安装包
暂未提供
参阅:
2.2 安装CF
2.2.1 第一种方式:docker安装CF
- 编写Dockerfile文件
cd /home/confluence
vim Dockerfile
FROM cptactionhank/atlassian-confluence:7.4.0
USER root
# 将代理破解包加入容器
COPY "atlassian-agent.jar" /opt/atlassian/confluence/
# 设置启动加载代理包
RUN echo 'export CATALINA_OPTS="-javaagent:/opt/atlassian/confluence/atlassian-agent.jar ${CATALINA_OPTS}"' >> /opt/atlassian/confluence/bin/setenv.sh
- atlassian-extras-3.2.jar上传到/home/confluence
- 构建镜像
docker build -f Dockerfile -t confluence/confluence:v7.4.0 .
启动容器
docker run --detach --publish 8090:8090 --name confluence -e JAVA_OPTS='-Xmx512m' confluence/confluence:v7.4.0
或
docker run --detach --publish 8090:8090 --name confluence confluence/confluence:v7.4.0
访问CF安装界面(界面多等等,加载慢)
<虚拟机IP>:8090
提示:
- 数据库类型选择MySQL5.7(报错就选择MySQL5.6)
- 数据库、用户名及密码:confluence、cf、cf
- 生成jira密钥
java -jar /home/confluence/atlassian-agent.jar -d -m test@test.com -n Test -p conf -o http://<虚拟机IP> -s <服务ID>
-m test@test.com -n Test
中test@test.com
修改为自己的邮箱,Test
为个人的名称
【界面演示】
2.2.2 第二种方式:官方安装包
暂未提供
参阅:
参阅:
更新中......