网站搭建 | 从零开始在CentOS7中使用Docker搭建CF

2020-05-01  本文已影响0人  Ricsy

温馨提示

  • 服务器配置至少4核CPU、16GB内存才能较为流畅使用,不推荐个人搭建使用

一、前期准备


1.1 下载相关软件

想要直接下载,就点我


1.2 虚拟机安装CentOS7

1.2.1 安装步骤

自行百度

1.2.2 linux设置

参阅:Centos7更改yum源与更新系统


1.3 CentOS7安装Oracel JDK

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

参阅:CentOS7下安装jdk8环境


1.4 CentOS7安装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

参阅:

1.5 CentOS7安装MySQL5.7

[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

[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

-- 更改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;

参阅:

1.6 CentOS7安装Portainer

参阅:docker的容器可视化工具portainer


二、开始安装

2.1 安装Jira

2.1.1 第一种方式:docker安装Jira

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

提示:

  • 数据库类型选择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 Testtest@test.com修改为自己的邮箱,Test为个人的名称

【界面演示】

2.1.2 第二种方式:官方安装包

暂未提供

参阅:


2.2 安装CF

2.2.1 第一种方式:docker安装CF

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

提示:

  • 数据库类型选择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 Testtest@test.com修改为自己的邮箱,Test为个人的名称

【界面演示】

2.2.2 第二种方式:官方安装包

暂未提供

参阅:


参阅:


更新中......


上一篇 下一篇

猜你喜欢

热点阅读