第1章 操作系统环境的基本说明
1.1 准备的服务器
[操作系统] [主机名] [IP地址] [说明]
centos7.9 vm7-121.host.com 10.4.7.121 这台服务器是清爽的
1.2 操作系统环境
[root@vm7-121 ~]
CentOS Linux release 7.9.2009 (Core)
3.10.0-1160.el7.x86_64
x86_64
[root@vm7-121 ~]
not running
[root@vm7-121 ~]
[root@vm7-121 ~]
未安装软件包 iptables-services
[root@vm7-121 ~]
[root@vm7-121 ~]
Chain INPUT (policy ACCEPT)
num target prot opt source destination
Chain FORWARD (policy ACCEPT)
num target prot opt source destination
Chain OUTPUT (policy ACCEPT)
num target prot opt source destination
[root@vm7-121 ~]
/dev/sdb 100G 33M 100G 1% /data
1.3 准备普通用户
这个普通用户我们用来启动软件(端口在1024以上的)。这个用户是可以登录、有密码、有家目录、用户和用户密码都不过期
useradd app
echo 'app123456'|passwd --stdin app
第2章 安装MySQL软件及初始3306实例
2.1 安装MySQL软件
软件下载地址
https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.34-linux-glibc2.12-x86_64.tar.gz
卸载mariadb(我这台服务器是干净的哈)
rpm -qa|grep mariadb
rpm -e --nodeps $(rpm -qa|grep mariadb)
rpm -qa|grep mariadb
安装mysql软件(使用二进制包)
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
chattr -i /etc/passwd /etc/shadow /etc/group /etc/gshadow
yum install -y gcc gcc-c++ bison ncurses ncurses-devel numactl zlib libxml2 openssl libaio libstdc++-devel
rpm -qa gcc gcc-c++ bison ncurses ncurses-devel numactl zlib libxml2 openssl libaio libstdc++-devel
mkdir /data/apps
ls -ld /data/apps
ll mysql-5.7.34-linux-glibc2.12-x86_64.tar.gz
tar xf mysql-5.7.34-linux-glibc2.12-x86_64.tar.gz -C /data/apps
cd /data/apps && ln -sv mysql-5.7.34-linux-glibc2.12-x86_64 mysql
chown -R app:app /data/apps/mysql/
ls -ld /data/apps/mysql/bin
echo 'export PATH=/data/apps/mysql/bin:$PATH' >>/etc/bashrc
source /etc/bashrc
echo $PATH
which mysql mysqld
echo "alias mysql='mysql -A'" >>/etc/bashrc
source /etc/bashrc
alias mysql
2.2 初始化3306实例
创建实例的相关目录
mkdir -p /data/mysql/3306/{data,etc,script,run,logs,tmp}
ls -ld /data/mysql/3306/{data,etc,script,run,logs,tmp}
mkdir -p /data/mysql/3306/logs/{errlog,binlog,relaylog,slowlog}
ls -ld /data/mysql/3306/logs/{errlog,binlog,relaylog,slowlog}
配置3306实例的配置文件
cd /data/mysql/3306/etc
pwd
cat >>my.cnf<<EOF
[mysqld]
######## Basic Parameter
server_id=121
user=app
port=3306
basedir=/data/apps/mysql
datadir=/data/mysql/3306/data
tmpdir=/data/mysql/3306/tmp
socket=/data/mysql/3306/run/mysql.sock
pid_file=/data/mysql/3306/run/mysql.pid
character_set_server=utf8
skip_character_set_client_handshake=1
lower_case_table_names=1
######## Gtid replication
gtid_mode=on
enforce_gtid_consistency=1
binlog_gtid_simple_recovery=1
######## Other Parameter
skip_external_locking=on
skip_name_resolve=on
max_connections=800
max_connect_errors=1000
wait_timeout=1800
interactive_timeout=1800
max_allowed_packet=1G
query_cache_size=0
query_cache_type=0
######## Ordinary Log
## log output mode and time
log_output=FILE
log_timestamps=system
## errlog
log_error=/data/mysql/3306/logs/errlog/121_mysql_error.log
## binlog
log_bin=/data/mysql/3306/logs/binlog/121_mysql_bin
log_bin_index=/data/mysql/3306/logs/binlog/121_mysql_bin.index
binlog_row_image=full
binlog_rows_query_log_events=on
binlog_format=row
expire_logs_days=60
max_binlog_size=1G
binlog_cache_size=16M
sync_binlog=1
log_bin_trust_function_creators=1
## slowlog
slow_query_log=on
slow_query_log_file=/data/mysql/3306/logs/slowlog/121_mysql_slow.log
long_query_time=10
log_queries_not_using_indexes=on
log_throttle_queries_not_using_indexes=10
log_slow_admin_statements=1
log_slow_slave_statements=1
######## InnoDB Engine
## buffer pool
default_storage_engine=innodb
innodb_buffer_pool_size=1G
innodb_buffer_pool_instances=8
innodb_buffer_pool_chunk_size=128M
innodb_change_buffering=all
innodb_change_buffer_max_size=25
innodb_buffer_pool_dump_at_shutdown=1
innodb_buffer_pool_dump_pct=40
innodb_buffer_pool_load_at_startup=1
## sql mode and transaction
group_concat_max_len=4294967295
explicit_defaults_for_timestamp=1
sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'
innodb_strict_mode=1
autocommit=on
transaction_isolation=READ-COMMITTED
transaction_write_set_extraction=OFF
## log buffer and redo log file
innodb_flush_method=O_DIRECT
innodb_log_buffer_size=16M
innodb_flush_log_at_trx_commit=1
innodb_log_files_in_group=2
innodb_log_file_size=2G
## double write
innodb_doublewrite=off
## table space
innodb_data_file_path=ibdata1:5G;ibdata2:5G;ibdata3:5G:autoextend:max:20G
innodb_autoextend_increment=64
innodb_temp_data_file_path=ibtmp1:5G:autoextend:max:20G
innodb_file_per_table=1
## undo table
innodb_undo_tablespaces=3
innodb_undo_logs=128
innodb_undo_log_truncate=1
innodb_max_undo_log_size=20G
innodb_purge_rseg_truncate_frequency=128
EOF
编写3306实例的启停脚本
cd /data/mysql/3306/script/
pwd
cat >>mysqld.sh<<'EOF'
#!/bin/bash
#
# explain: mysql $Port example start and stop scripts
#
# Define variables
RETVAL="0"
Port="3306"
User="shut" # grant shutdown on *.* to 'shut'@'localhost';
Pass="chenliang"
State=$(ss -lntup|grep -w "$Port"|wc -l)
Sock="/data/mysql/$Port/run/mysql.sock"
My="/data/mysql/$Port/etc/my.cnf"
Path="/data/apps/mysql/bin"
# Load the local functions
[ -f /etc/init.d/functions ] && source /etc/init.d/functions
# Define functions
start(){
if [ "$State" -eq 0 ];then
$Path/mysqld_safe --defaults-file=$My >/dev/null 2>&1 &
RETVAL=$?
if [ $RETVAL -eq 0 ];then
action "Start MySQL [$Port]" /bin/true
else
action "Start MySQL [$Port]" /bin/false
fi
else
echo "MySQL $Port is running"
fi
return $RETVAL
}
stop(){
if [ "$State" -ne 0 ];then
$Path/mysqladmin --no-defaults -u$User -p$Pass -S $Sock shutdown >/dev/null 2>&1
RETVAL=$?
if [ $RETVAL -eq 0 ];then
action "Stop MySQL[$Port]" /bin/true
else
action "Stop MySQL[$Port]" /bin/false
fi
else
echo "MySQL [$Port] is not running"
fi
return $RETVAL
}
status(){
if [ "$State" -ne 0 ];then
echo "MySQL [$Port] is running"
else
echo "MySQL [$Port] is not running"
fi
return $RETVAL
}
# Case call functions
case "$1" in
start)
start
RETVAL=$?
;;
stop)
stop
RETVAL=$?
;;
restart)
stop
sleep 10
start
RETVAL=$?
;;
status)
status
RETVAL=$?
;;
*)
echo "USAGE:$0{start|stop|restart|status}"
exit 1
esac
# Scripts return values
exit $RETVAL
EOF
更改启动脚本的权限
cd /data/mysql/3306/script/
ll mysqld.sh
chmod 700 mysqld.sh
ll mysqld.sh
User=shut
Pass=chenliang
是通过ss -lntup|grep -w "3306"|wc -l来判断的,不等于0表示启动了的。
所以说:如果我的mysql实例不采用默认的3306端口,你还得修改这个脚本。
初始化3306实例
chown -R app:app /data/mysql/3306/
ls -ld /data/mysql/3306/
mysqld --defaults-file=/data/mysql/3306/etc/my.cnf --user=app --basedir=/data/apps/mysql \
--datadir=/data/mysql/3306/data/ --initialize
可以看/data/mysql/3306/logs/errlog/121_mysql_error.log,只要没有error就ok
启动3306实例
chown -R app:app /data/mysql/3306
su - app -c "/data/mysql/3306/script/mysqld.sh start"
sleep 5
netstat -lntup|grep 3306
更改超级用户的密码,创建专用于关闭实例的用户并授权
[root@vm7-91 ~]
2020-06-06T15:05:00.511315+08:00 1 [Note] A temporary password is generated for root@localhost: YmGiq79IAr>j
[root@vm7-91 ~]
[root@vm7-91 ~]
Enter password: <== 这里输入的密码是 YmGiq79IAr>j
mysql>
mysql> alter user 'root'@'localhost' identified by "chenliang";
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql> create user 'shut'@'localhost' identified by "chenliang";
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql> grant shutdown on *.* to 'shut'@'localhost';
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql>
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql> exit
Bye
加入开机自启动
echo -ne "\n# Boot start mysql service[3306]. USER:chenliang \nsu - app -c \"/data/mysql/3306/script/mysqld.sh start\"\n" >>/etc/rc.local
tail -2 /etc/rc.local
chmod 744 /etc/rc.d/rc.local
2.3 创建jira库和用户
创建jira库
mysql -uroot -p -S /data/mysql/3306/run/mysql.sock
create database if not exists jira character set utf8 collate utf8_general_ci;
show databases like "jira";
exit
创建jira@‘127.0.0.1’用户,并授权
mysql -uroot -p -S /data/mysql/3306/run/mysql.sock
create user 'jira'@'127.0.0.1' identified by 'jira123456';
grant all on jira.* to 'jira'@'127.0.0.1';
show grants for 'jira'@'127.0.0.1';
flush privileges;
exit
验证jira用户是否OK
mysql -ujira -p'jira123456' -h 127.0.0.1 -P 3306 -e "show databases;"
2.4 当前3306实例用户整理
用户名 | 密码 | 说明 |
---|
root@‘localhost’ | chenliang | 自身超级用户 | shut@‘localhost’ | chenliang | 关闭帐户,专门用来关闭mysql 3306实例的用户 | jira@‘localhost’ | jira123456 | 业务帐户,对jira库下所有对象有all权限 |
第3章 安装JIRA并进行相关的配置
3.1 安装java环境(jdk)
软件下载地址(会提示你登录哈)
https://www.oracle.com/webapps/redirect/signon?nexturl=https://download.oracle.com/otn/java/jdk/8u202-b08/1961070e4c9b4e26a04e7f5a083f551e/jdk-8u202-linux-x64.tar.gz
部署jdk
mkdir /data/apps
ls -ld /data/apps
ll jdk-8u202-linux-x64.tar.gz
tar xf jdk-8u202-linux-x64.tar.gz -C /data/apps
cd /data/apps && ln -sv jdk1.8.0_202 jdk
echo 'export JAVA_HOME=/data/apps/jdk' >>/etc/profile
echo 'export PATH=$JAVA_HOME/bin:$PATH' >>/etc/profile
echo 'export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar' >>/etc/profile
source /etc/profile
which java jar
3.2 安装jira软件
软件下载地址
https://www.atlassian.com/software/jira/downloads/binary/atlassian-jira-software-7.13.18.tar.gz
安装jira软件
mkdir /data/jira
ls -ld /data/jira
ll atlassian-jira-software-7.13.18.tar.gz
tar xf atlassian-jira-software-7.13.18.tar.gz -C /data/jira/
cd /data/jira/ && ln -sv atlassian-jira-software-7.13.18-standalone atlassian-jira
修改端口【默认8080(http端口) 和8005(用于关闭)】,我这里就不修改了,因为我当前服务器没有程序占用8080和8005端口
对应文件:/data/jira/atlassian-jira/conf/server.xml
加入MySQL jdbc驱动包,我前面安装的数据库版本为5.7.34
下载地址:https://downloads.mysql.com/archives/get/p/3/file/mysql-connector-java-5.1.49.tar.gz
ll mysql-connector-java-5.1.49.tar.gz
tar xf mysql-connector-java-5.1.49.tar.gz
ll mysql-connector-java-5.1.49/mysql-connector-java-5.1.49*
cp mysql-connector-java-5.1.49/mysql-connector-java-5.1.49-bin.jar /data/jira/atlassian-jira/atlassian-jira/WEB-INF/lib/
ll /data/jira/atlassian-jira/atlassian-jira/WEB-INF/lib/mysql-connector-java-5.1.49-bin.jar
配置jira_home
cd /data/jira/atlassian-jira/ && mkdir atlassian-jira-data
sed 's#jira.home =#jira.home = /data/jira/atlassian-jira/atlassian-jira-data#g' /data/jira/atlassian-jira/atlassian-jira/WEB-INF/classes/jira-application.properties
sed -i 's#jira.home =#jira.home = /data/jira/atlassian-jira/atlassian-jira-data#g' /data/jira/atlassian-jira/atlassian-jira/WEB-INF/classes/jira-application.properties
科学使用 将 /data/jira/atlassian-jira/atlassian-jira/WEB-INF/lib/atlassian-extras-3.2.jar 文件给替换掉
下载地址:https://github.com/ly641921791/knowledge/blob/master/jira/crack/atlassian-extras-3.2.jar
ll atlassian-extras-3.2.jar
/bin/cp -a atlassian-extras-3.2.jar /data/jira/atlassian-jira/atlassian-jira/WEB-INF/lib/atlassian-extras-3.2.jar
启动jira,查看启动日志, 查看端口
chown -R app:app /data/jira/
su - app -c "/data/jira/atlassian-jira/bin/startup.sh"
su - app -c "tailf /data/jira/atlassian-jira/logs/catalina.out"
lsof -n -i :8080
3.3 web引导配置
01:浏览器输入 "IP:8080"进行访问
02:连接数据库
03:设置程序标题、模式、基本URL
04:许可证:先注册(atlassian.com)—>申请试用许可证—>粘贴
05:设置管理员帐户
06:设置邮件通知,这里我先不设置
07:完成引导配置的最后一步
3.4 随便创建一个项目
1:
2:
3:
4
3.5 查看用户使用限制
1:设置—>系统
2:应用程序
3.6 配置邮件(腾讯邮箱)
3.6.1 配置
1:设置—>系统
2:系统–>电邮—>外发邮件
3.6.2 发送测试电邮
|