LINUX_Application

1.MySQL5.7在CentOS系统安装

1.配置yum仓库
#更新密钥
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022

#安装mysql yum库
rpm -Uvh http://repo.mysql.com//mysql57-community-release-el7-7.noarch.rpm
2.安装MySQL
#下载
yum -y install mysql-community-server

#启动
systemctl satrt mysqld

#查看状态
systemctl status mysqld

设置开机自启
systemctl enable mysqld
3.配置密码
#查看初始密码
grep 'temporary password' /var/log/mysqld.log
#2023-01-15T10:31:40.545594Z 1 [Note] A temporary password is generated for root@localhost: lgllSVu&k5ce

#登录系统
mysql -uroot -p

#修改密码
ALTER USER 'root'@'localhost' IDENTIFIED BY '密码'

#123456

4.检查端口
netstat -anp | grep 3306

#tcp6       0      0 :::3306                 :::*                    LISTEN      19182/mysqld  

2.安装tomcat

1.下载jdk

直接官网下载并解压到自己的主机;
上传到centos系统

[root@ninislinux ~]# rz
[root@ninislinux ~]# tar -zxvf jdk-8u351-linux-x64.tar.gz -C /export/server

2.配置软连接和环境变量
#配置软连接
[root@ninislinux ~]# ln -s /export/server/jdk1.8.0_351 /export/server/jdk

#添加环境变量
[root@ninislinux ~]# vim /etc/profile

# 编辑/etc/profile文件
 export JAVA_HOME=/export/server/jdk
 export PATH=$PATH:$JAVA_HOME/bin

#生效环境变量
[root@ninislinux ~]# source /etc/profile

#删除掉系统自带的java程序并软连接到我们自己新下载好滴
[root@ninislinux ~]# rm -f /usr/bin/java
[root@ninislinux ~]# ln -s /export/server/jdk/bin/java /usr/bin/java

3.执行验证
[root@ninislinux ~]# java -version
java version "1.8.0_351"
Java(TM) SE Runtime Environment (build 1.8.0_351-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.351-b10, mixed mode)

[root@ninislinux ~]# javac -version
javac 1.8.0_351

4.设置防火墙
#查看防火墙状态
[root@ninislinux ~]# systemctl status firewalld

#放行8080端口的外部访问权限
[root@ninislinux ~]# firewall-cmd --add-port=8080/tcp --permanent
success

#重新加载
[root@ninislinux ~]# firewall-cmd --reload
success

5.创建tomcat新用户并解压文件
[root@ninislinux ~]# useradd tomcat
[root@ninislinux ~]# passwd tomcat


#下载tomcat安装包
 wget https://dlcdn.apache.org/tomcat/tomcat-10/v10.0.27/bin/apache-tomcat-10.0.27.tar.gz

#解压文件
[root@ninislinux ~]# tar  -zxvf apache-tomcat-10.0.27.tar.gz -C /export/server
 
6.创建软连接修改权限
#创建软连接
[root@ninislinux ~]# ln -s /export/server/apache-tomcat-10.0.27 /export/server/tomcat

#修改目录权限
[root@ninislinux ~]# chown -R tomcat:tomcat /export/server/*tomcat*


[root@ninislinux ~]# su - tomcat

7.启动tomcat
[tomcat@ninislinux ~]$ netstat -anp | grep 8080
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp6       0      0 :::8080                 :::*                    LISTEN      2079/java   

打开浏览器

http://192.168.35.134:8080/

在这里插入图片描述

3.安装nginx

1.安装yum依赖程序
[root@ninislinux ~]# yum install -y yum-utils

2.手动添加,nginx的yum仓库

# root执行
# 创建文件使用vim编辑
vim /etc/yum.repos.d/nginx.repo
# 填入如下内容并保存退出
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

[nginx-mainline]
name=nginx mainline repo
baseurl=http:// nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https: / nginx.org/keys/nginx_signing.key
module_hotfixes=true

3.通过yum安装最新稳定版的nginx
yum install -y nginx
4.启动
[root@ninislinux ~]# systemctl status nginx
● nginx.service - nginx - high performance web server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
   Active: inactive (dead)
     Docs: http://nginx.org/en/docs/
[root@ninislinux ~]# systemctl start nginx
[root@ninislinux ~]# systemctl status nginx
● nginx.service - nginx - high performance web server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
   Active: active (running) since Wed 2023-01-18 12:17:28 CST; 17s ago
     Docs: http://nginx.org/en/docs/
  Process: 52940 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=0/SUCCESS)
 Main PID: 52941 (nginx)
    Tasks: 2
   CGroup: /system.slice/nginx.service
           ├─52941 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
           └─52943 nginx: worker process

Jan 18 12:17:28 ninislinux systemd[1]: Starting nginx - high performance web server...
Jan 18 12:17:28 ninislinux systemd[1]: Started nginx - high performance web server.
[root@ninislinux ~]# systemctl enable nginx
5.防火墙设置
[root@ninislinux ~]# firewall-cmd --add-port=80/tcp --permanent
success
[root@ninislinux ~]# firewall-cmd --reload
success

6.进入浏览器访问
http://192.168.35.134:80

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值