1、安装jdk
java -version //查看已安装java版本
yum -y list java* //查看当前yum源已有jdk版本
yum -y install java-1.8.0-openjdk* //安装jdk1.8.0所需所有,单独安装具体到名称
rpm -qa | grep java //查看当前安装的jdk中所有的子内容,//若重装则尽量卸载干净
yum -y remove java-1.8.0-openjdk* //卸载jdk1.8.0的所有内容
2、安装tomcat
systemctl status tomcat //查看服务器tomcat状态
yum -y install tomcat //yum安装tomcat
systemctl status tomcat //查看tomcat运行状况,dead为死亡,未运行状态,running(绿色)则是运行状态
systemctl start tomcat //启动tomcat
cd /usr/share/tomcat/webapps //进入webapps文件夹
yum install tomcat-webapps tomcat-admin-webapps //安装默认浏览器管理界面,若不执行访问ip:端口会显示找不到网页
yum remove tomcat //卸载tomcat
3、安装mysql
rpm -qa | grep mysql //查看当前已安装的mysql
yum remove mysql-xxx-xxx- //卸载mysql
find / -name mysql //查找mysql的相关文件
rm -rf /var/lib/mysql //根据自身的需求删除mysql的配置文件信息
rpm -qa | grep mariadb //查看当前已安装的mariadb
rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64 //将查找出来的结果进行强制删除
这里应该还需要从官网wgetmysql源
yum install mysql-community-server //安装mysql
systemctl start mysqld //启动mysql
cat /var/log/mysqld.log | grep password //查看mysql初始生成的随机密码
mysql -u root -p //进入mysql命令行
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'yourpassword'; //给root更改密码
mysql> use mysql;
mysql> update user set host='%' where user='root'; //远程设置
mysql> use mysql;
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '新密码'; //创建并设置加密方式
mysql> FLUSH PRIVILEGES; //刷新权限
4、安装nginx
安装nginx镜像源,一般是没有这个源的
sudo rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum search nginx //查找镜像源
sudo yum install -y nginx //安装nginx
sudo systemctl start nginx.service
sudo systemctl enable nginx.service //启动Nginx并设置开机自动运行