系统初始化
服务器信息
1
10.10.10.12 confluence
查看系统版本
1
2[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)设置主机名
1
2
3
4//confluence
[root@localhost ~]# hostname confluence && echo confluence | tee /etc/hostname
[root@localhost ~]# echo '10.10.10.12 confluence' |tee -a /etc/hosts
[root@localhost ~]# $SHELL硬盘格式化挂载
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设置打开最大文件数
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设置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安装基础依赖库和常用工具包
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关闭selinux
1
2[root@[x] ~]# setenforce 0
[root@[x] ~]# sed -i s/'SELINUX=enforcing'/'SELINUX=disabled'/g /etc/selinux/config关闭防火墙
1
[root@[x] ~]# systemctl stop firewalld && systemctl disable firewalld
设置系统时区
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安装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设置开机启动文件权限
1
[root@[x] ~]# chmod +x /etc/rc.d/rc.local
创建常见目录
1
[root@[x] ~]# mkdir -p /mnt/{app,data,log,web,ops/{app,data,cron}}
部署mysql
confluence mysql install部署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部署confluence
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[root@confluence app]# chmod +x atlassian-confluence-6.4.1-x64.bin
[root@confluence app]# ./atlassian-confluence-6.4.1-x64.bin
Unpacking JRE ...
Starting Installer ...
Oct 10, 2017 11:38:32 AM java.util.prefs.FileSystemPreferences$1 run
INFO: Created user preferences directory.
Oct 10, 2017 11:38:32 AM java.util.prefs.FileSystemPreferences$2 run
INFO: Created system preferences directory in java.home.
This will install Confluence 6.4.1 on your computer.
OK [o, Enter], Cancel [c]
o
Choose the appropriate installation or upgrade option.
Please choose one of the following:
Express Install (uses default settings) [1],
Custom Install (recommended for advanced users) [2, Enter],
Upgrade an existing Confluence installation [3]
2
Where should Confluence 6.4.1 be installed?
[/opt/atlassian/confluence]
/mnt/app/confluence
Default location for Confluence data
[/var/atlassian/application-data/confluence]
/mnt/data/confluence.home
Configure which ports Confluence will use.
Confluence requires two TCP ports that are not being used by any other
applications on this machine. The HTTP port is where you will access
Confluence through your browser. The Control port is used to Startup and
Shutdown Confluence.
Use default ports (HTTP: 8090, Control: 8000) - Recommended [1, Enter], Set custom value for HTTP and Control ports [2]
1
Confluence can be run in the background.
You may choose to run Confluence as a service, which means it will start
automatically whenever the computer restarts.
Install Confluence as Service?
Yes [y, Enter], No [n]
y
Extracting files ...
Please wait a few moments while we configure Confluence.
Installation of Confluence 6.4.1 is complete
Start Confluence now?
Yes [y, Enter], No [n]
y
Please wait a few moments while Confluence starts up.
Launching Confluence ...
Installation of Confluence 6.4.1 is complete
Your installation of Confluence 6.4.1 is now ready and can be accessed via
your browser.
Confluence 6.4.1 can be accessed at http://localhost:8090
Finishing installation ...停止服务
1
[root@confluence app]# /etc/init.d/confluence stop
将JDBC的客户端拷贝到confluence安装目录lib下
1
2
3[root@confluence app]# cp mysql-connector-java-5.1.44-bin.jar /mnt/app/confluence/lib/
[root@confluence app]# ls -1 /mnt/app/confluence/lib/mysql-connector-java-5.1.44-bin.jar
/mnt/app/confluence/lib/mysql-connector-java-5.1.44-bin.jar创建数据库
1
2[root@confluence app]# mysql -u{username} -p{password} -h{ipaddress}
MariaDB [(none)]> CREATE DATABASE confluence CHARACTER SET utf8 COLLATE utf8_bin;查看confluence.home
1
2[root@confluence app]# cat /mnt/app/confluence/confluence/WEB-INF/classes/confluence-init.properties
confluence.home=/mnt/data/confluence.home查看confluence.port
1
2
3
4
5[root@confluence app]# cat /mnt/app/confluence/conf/server.xml
<Connector port="8090" connectionTimeout="20000" redirectPort="8443"
maxThreads="48" minSpareThreads="10"
enableLookups="false" acceptCount="10" debug="0" URIEncoding="UTF-8"
protocol="org.apache.coyote.http11.Http11NioProtocol" />设置confluence 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
36
37
38
39[root@confluence app]# cat /etc/init.d/confluence
# Confluence Linux service controller script
cd "/mnt/app/confluence/bin"
case "$1" in
start)
./start-confluence.sh
;;
stop)
./stop-confluence.sh
;;
restart)
./stop-confluence.sh
./start-confluence.sh
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac
[root@confluence app]# cat > /usr/lib/systemd/system/confluence.service <<EOF
[Unit]
Description=confluence - atlassian-confluence
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/confluence/bin/start-confluence.sh
ExecStop=/mnt/app/confluence/bin/stop-confluence.sh
PrivateTmp=true
Restart=always
[Install]
WantedBy=multi-user.target
EOF启动confluence
1
2
3[root@confluence app]# systemctl daemon-reload
[root@confluence app]# systemctl start confluence
[root@confluence app]# systemctl enable confluence访问confluence
1
2
3
4
5* 浏览器中输入: http://{IP}:8090
* 选择"中文",自定义设置
* 选择"Mysql",根据提示输入 数据库地址,用户名,密码
* 输入"Listen key"
* 根据提示操作,结束