1、阿里云配置 Wildfly 服务器第 1 部分 应用工具服务器版本:CentOS7.0文件传输工具: SSH Secure File Transfer Client命令行工具:Xshell 环境检测1.1 IP 检测#ifconfig Command not found 表示未安装基本命令模块解决:yum groupinstall base1.2 JDK 版本检测方法一:Java version无此命令表示未安装 java方法二:# rpm -qa | grep java查找所有包含 java 的应用2.3 上传安装文件,/opt/tools 目录下,JDK 安装文件:jdk-8u40-lin
2、ux-x64.rpmWILDFLY 应用文件:wildfly-8.2.0.Final.tar.gz第 2 部分 安装2.1 Jdk 安装案例1.1 查看已安装的 javaroots0 Soft# rpm -qa | grep javatzdata-java-2013c-1.el6.noarchroots0 Soft# rpm -e -nodeps tzdata-java-2013c-1.el6.noarch2.1.1 安装 JDK安装 JDK 的 RPM 软件roots0 Soft# yum install -y jdk-8u40-linux-x64.rpm2.1.2 验证安装rootiZ23
3、xfwtb27Z # java -versionjava version “1.8.0_40“Java(TM) SE Runtime Environment (build 1.8.0_40-b25)Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)2.1.3 配置环境变量(在/etc/profile 中追加)roots0 Soft# vim + /etc/profileJAVA_HOME=/usr/java/jdk1.8.0JRE_HOME=/usr/java/jdk1.8.0/jrePATH=$PATH:$JAVA_
4、HOME/bin:$JRE_HOME/binCLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/libexport JAVA_HOME JRE_HOME PATH CLASSPATH2.1.4 使环境变量立即生效roots0 Soft# source /etc/profileroots0 Soft# echo $PATH/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/go
5、/bin:/root/bin:/usr/local/go/bin:/usr/java/jdk1.8.0/bin:/usr/java/jdk1.8.0/jre/binroots0 Soft# echo $JAVA_HOME/usr/java/jdk1.8.02.2 WILDFLY 安装2.2.1 安装 wildfly解压 wildfly#tar -zxvf /opt/tools/ wildfly-8.2.0.Final.tar.gz解压 wildfly-8.2.0.Final.tar.gz 到当前目录安装#yum install -y wildfly-8.2.0.Final.rpm2.2.2 设
6、置快捷方式目录ln -s /opt/wildfly-8.2.0.Final /opt/wildfly设置 wildfly-8.2.0.Final 简写 wildfly 快捷方式2.2.3 增加 WILDFLY 为服务复制配置文件到 etc/defaultcp /opt/wildfly/bin/init.d/wildfly.conf /etc/default/wildfly.conf修改 etc/default/wildfly.conf 文件# Location of JDKJAVA_HOME=“/usr/lib/jvm/java“# 本地 JAVA 目录JBOSS_HOME=“/opt/wil
7、dfly“# The username who should own the process.JBOSS_USER=wildfly #指定服务运行用户# The mode WildFly should start, standalone or domainJBOSS_MODE=standalone# Configuration for standalone modeJBOSS_CONFIG=standalone-btcgroup.xml# Configuration for domain mode# JBOSS_DOMAIN_CONFIG=domain.xml# JBOSS_HOST_CONF
8、IG=host-master.xml# The amount of time to wait for startupSTARTUP_WAIT=60# The amount of time to wait for shutdownSHUTDOWN_WAIT=60# Location to keep the console logJBOSS_CONSOLE_LOG=“/var/log/wildfly/console.log“ #此目录必需存在且用户有写入权限复制启动脚本到系统开始目录cp /opt/wildfly/bin/init.d/wildfly-init-redhat.sh /etc/ini
9、t.d/wildfly添加服务chkconfig -add wildflychkconfig wildfly on创建目录mkdir -p /var/log/wildfly增加权限chown -R wildfly:wildfly /opt/wildfly-8.2.0.Finalchown wildfly:wildfly /opt/wildflychown wildfly:wildfly /var/log/wildflywildfly/wildfly 代指用户名和组启动 wildfly 服务service wildfly start2.2.4 添加 wildfly 管理平台初始账号和密码root
10、localhost # add-us.sh -bash: add-us.sh: command not found rootlocalhost # add-user.sh What type of user do you wish to add? a) Management User (mgmt-users.properties) b) Application User (application-users.properties) (a): 回车Enter the details of the new user to add. Using realm ManagementRealm as di
11、scovered from the existing property files. Username : hearask 用户名Password recommendations are listed below. To modify these restrictions edit the add-user.properties configuration file. - The password should not be one of the following restricted values root, admin, administrator - The password shou
12、ld contain at least 8 characters, 1 alphabetic character(s), 1 digit(s), 1 non-alphanumeric symbol(s) - The password should be different from the username Password : 输入密码JBAS015269: Password must have at least 8 characters! Are you sure you want to use the password entered yes/no? y Re-enter Passwor
13、d : 再次输入密码What groups do you want this user to belong to? (Please enter a comma separated list, or leave blank for none) : About to add user hearask for realm ManagementRealm Is this correct yes/no? y 选择 YAdded user hearask to file /opt/wildfly-8.2.0.Final/standalone/configuration/mgmt-users.propert
14、ies Added user hearask to file /opt/wildfly-8.2.0.Final/domain/configuration/mgmt-users.properties Added user hearask with groups to file /opt/wildfly-8.2.0.Final/standalone/configuration/mgmt-groups.properties Added user hearask with groups to file /opt/wildfly-8.2.0.Final/domain/configuration/mgmt
15、-groups.properties Is this new user going to be used for one AS process to connect to another AS process? e.g. for a slave host controller connecting to the master or for a Remoting connection for server to server EJB calls. yes/no? y 选择 YTo represent the user add the following to the server-identit
16、ies definition rootlocalhost # 2.3 3.MYSQL 安装2.3.1 上传安装包文到/opt/tools 目录MySQL-server-5.6.23-1.el7.x86_64.rpm MYSQL 服务器安装程序MySQL-client-5.6.23-1.el7.x86_64.rpm MYSQL 客户端安装程序如应用服务器与数据库服务器分离,仅需安客户端程序2.3.2 删除历史版本案例:查询rootlocalhost # rpm -qa | grep -i mysqlmysql-libs-5.1.66-2.el6_3.x86_64删除rootlocalhost #
17、 yum -y remove mysql-libs*2.3.3 安装 MYSQL#yum install y MySQL-server-5.6.23-1.el7.x86_64.rpm安装过程中提示 mariadb 错误,使用以下命令删除yum -y remove mariadb-libs-1:5.5.35-3.el7.x86_642.3.4 配置 f# cp /usr/share/mysql/my-f /etc/f 简单配置client password = 123456 port = 3306 default-character-set=utf8 mysqld port = 3306 cha
18、racter_set_server=utf8 character_set_client=utf8 collation-server=utf8_general_ci #(注意 linux 下 mysql 安装完后是默认:表名区分大小写,列名不区分大小写; 0:区分大小写,1:不区分大小写) lower_case_table_names=1 #(设置最大连接数,默认为 151,MySQL 服务器允许的最大连接数 16384; ) max_connections=1000 mysql default-character-set = utf8 2.3.5 加入系统服务测试服务是否已加载# servic
19、e mysql start如果提示未找到 MYSQL 进程 pid进行初始化操作# /usr/bin/mysql_install_db提示无法安装,per 错误 需先安装 perl安装 perl : yum install -y perl-Module-Install.noarch 无法启动,有权限问题:ROOT mysql$ chown mysql *ROOT mysql$ chgrp mysql *ROOT mysql$ chmod ug+rwx *2.3.6 初始化密码设置rootlocalhost rpm# cat /root/.mysql_secret #查看 root 账号密码#
20、The random password set for the root user at Wed Dec 11 23:32:50 2013 (local time): qKTaFZnlrootlocalhost # mysql -uroot pqKTaFZnlmysql SET PASSWORD = PASSWORD(123456); #设置密码为 123456mysql exitrootlocalhost # mysql -uroot -p1234562.3.7 允许远程登陆mysqlGRANT ALL PRIVILEGES ON *.* TOoadb% IDENTIFIED BY wert
21、990 WITH GRANT OPTION;mysqlflush privileges;2.3.8 设置开机自启动 1 rootlocalhost # chkconfig mysql on2 rootlocalhost # chkconfig -list | grep mysql3 mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off2.3.9 其它sMySQL 的默认安装位置1 /var/lib/mysql/ #数据库目录2 /usr/share/mysql #配置文件目录3 /usr/bin #相关命令目录4 /etc/init.d/mysql #启动脚本
22、查看字符集show variables like %collation%;show variables like %char%;第 3 部分 配置3.1 1.防火墙配置查看已开放端口#firewall-cmd -zone=public -list-ports添加端口#firewall-cmd -permanent -zone=public -add-port=8080-8081/tcp#firewall-cmd -reload删除端口# firewall-cmd -permanent -zone=public -remove-port=8080-8081/tcp# firewall-cmd -reload关闭 firewall:systemctl stop firewalld.service #停止 firewallsystemctl disable firewalld.service #禁止 firewall 开机启动第 4 部分 测试1.启动 wildfly#systemctl start wildfly打开 IE 输入 http:/服务器 IP:8080/ 测试是否能打开 WILDFLY 管理页面