1.开启代理(如机器有网,可省略该步骤)
vim /etc/profile
http_proxy=192.168.228.120:8888 https_proxy=192.168.228.120:8888 ftp_proxy=192.168.228.120:8888 export http_proxy https_proxy ftp_proxy
service network restart
2.下载阿里yum源,让如/etc/yum.repos.d/文件夹中
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
3.安装jdk8
#解压
tar -xzvf jdk-8u172-linux-x64.gz
vim /etc/profile
#在/etc/profile文件中配置环境变量 JAVA_HOME=/home/tools/jdk1.8.0_172 PATH=$JAVA_HOME/bin:$PATH CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export JAVA_HOME export PATH export CLASSPATH
#刷新文件
source /etc/profile
4.安装mysql5.7
#下载官方包 wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm #加载入yum中 yum -y install mysql57-community-release-el7-10.noarch.rpm #安装mysql yum install java-1.8.0-openjdk.x86_64 #启动mysql systemctl start mysqld.service #查看mysql密码 grep "password" /var/log/mysqld.log #修改mysql密码 ##进入mysql,设置密码策略为low mysql -uroot -pxxxx set global validate_password_policy=LOW; ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘zxyt2018‘; #修改mysql访问权限 use mysql update user set host = ‘%‘ where user = ‘root‘; flush privileges; #防火墙管理 systemctl stop firewalld systemctl disable firewalld.service
5.tomcat安装(将tomcat8通过ftp上传至服务器)
#解压 tar -xzvf apache-tomcat-8.5.9.tar.gz #将tomcat加入环境变量 vim apache-tomcat-8.5.39/bin/catalina.sh #加入下面命令大概在 143 行 :set number 143 CATALINA_PID="$CATALINA_BASE/tomcat.pid" #/usr/lib/systemd/system下创建文件tomcat.service systemctl enable tomcat #设置开机自启 systemctl start/stop/ restart tomcat 开始/停止/重启 tomcat
6.资源文件
tomcat.service
[Unit] Description=tomcat After=syslog.target network.target remote-fs.target nss-lookup.target [Service] Type=forking Environment="JAVA_HOME=/home/tools/jdk1.8.0_172" PIDFile=/home/tools/apache-tomcat-8.5.9/tomcat.pid ExecStart=/home/tools/apache-tomcat-8.5.9/bin/startup.sh ExecStop=/home/tools/apache-tomcat-8.5.9/bin/shutdown.sh ExecReload=/bin/kill -s HUP $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target
tomcat、jdk、mysql这里上传不了那么大,就去官网找下资源。……