centos7
-
在线安装jdk1.8
-
yum install -y java-1.8.0-openjdk.x86_64 java默认安装路径/usr/lib/jvm/; 加入环境变量配置,在/etc/profile 配置文件中加入 java 环境变量: vim /etc/profile #java 环境变量内容: #java环境变量 export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.362.b08-1.el7_9.x86_64 export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/jre/lib/rt.jar export PATH=$PATH:$JAVA_HOME/bin source /etc/profile java -version
-
-
安装tomcat
-
yum -y install tomcat #进入/etc/profile 配置文件 vim /etc/profile #Tomcat 环境变量内容: #tomcat环境变量 COMCAT_BASE=/usr/share/tomcat COMCAT_HOME=/usr/share/tomcat export JAVA_HOME PATH CLASSPATH COMCAT_BASE COMCAT_HOME source /etc/profile systemctl start tomcat.service systemctl status tomcat systemctl status firewalld #执行命令来开启8080端口 firewall-cmd --permanent --zone=public --add-port=8080/tcp #重启防火墙 firewall-cmd --reload #验证开启的8080端口是否生效 firewall-cmd --zone=public --query-port=8080/tcp 解决FirewallD警告问题 vi /etc/firewalld/firewalld.conf #重启tomcat: systemctl restart tomcat #查看tomcat状态: systemctl status tomcat 尝试解决打不开8080的问题 #下载依赖包 yum install tomcat-webapps tomcat-admin-webapps #关闭防火墙 systemctl stop firewalld #查看防火墙状态 systemctl status firewalld #Tomcat的自启动 systemctl enable tomcat.service #系统重启 reboot
-
-
mysql8
-
#下载mysql8.0的rpm仓库源 wget https://repo.mysql.com/mysql80-community-release-el7.rpm #安装mysql8.0源 yum -y install ./mysql80-community-release-el7.rpm #生成yum索引缓存,并查看目录大小 yum makecache fast #查看正在使用的MySQL repo yum repolist all|grep mysql #安装MySQL8.0 yum install -y mysql-community-common mysql-community-libs mysql-community-libs-compat mysql-community-client mysql-community-server #设置 mysql 开机启动 systemctl enable mysqld #启动mysql systemctl start mysqld cat /var/log/mysqld.log | grep password mysql_secure_installation #随机密码登录 mysql -uroot -p #先把root的旧密码置空 use mysql; #备注:Mysql5.7+ password字段 已改成 authentication_string字段 update user set authentication_string='' where user='root'; #重置成新密码 #备注:Mysql8.0修改密码方式已有变化(此处是个坑,需要注意) #Mysql8.0之前; update user set password=password('root') where user='root'; #Mysql8.0之后; alter user 'root'@'localhost' identified by 'root'; #显示密码策略 SHOW VARIABLES LIKE 'validate_password%'; #校验密码不能等同于用户名 set global validate_password.check_user_name=OFF; #设置最低长度为4 set global validate_password.length=4; #校验设置低级别策略 set global validate_password.policy=LOW; #显示密码策略 SHOW VARIABLES LIKE 'validate_password%'; #设置完密码策略后重新输入修改命令,更改后的密码为123456 alter user 'root'@'localhost' identified by '123456'; #退出命令行 mysql> quit; Bye #新密码登录 mysql -uroot -p123456 #停止服务 systemctl stop mysqld #重启服务 systemctl restart mysqld #查看mysql服务 systemctl status mysqld
-
-
nginx文章来源:https://www.toymoban.com/news/detail-670914.html
-
yum install yum-utils #新建nginx.repo vim /etc/yum.repos.d/nginx.repo #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 yum-config-manager --enable nginx-mainline yum install -y nginx systemctl start nginx.service systemctl status nginx #查看防火墙状态 systemctl status firewalld #执行命令来开启80端口 firewall-cmd --permanent --zone=public --add-port=80/tcp #重启防火墙 firewall-cmd --reload #验证开启的8080端口是否生效 firewall-cmd --zone=public --query-port=80/tcp systemctl enable nginx.service
-
-
docker文章来源地址https://www.toymoban.com/news/detail-670914.html
-
一、安装依赖包 [root@localhost ~]# yum install -y yum-utils device-mapper-persistent-data lvm2 二、设置yum仓库地址 [root@localhost ~]# sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo [root@localhost ~]# sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo 三、更新Yum缓存 [root@localhost ~]# sudo yum makecache fast 四、在线安装docker [root@localhost ~]# sudo yum install -y docker-ce docker-ce-cli containerd.io 五、查看docker信息 [root@localhost ~]# docker info Client: Context: default Debug Mode: false Plugins: app: Docker App (Docker Inc., v0.9.1-beta3) buildx: Docker Buildx (Docker Inc., v0.10.0-docker) scan: Docker Scan (Docker Inc., v0.23.0) Server: ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? docker尚未启动,报错 六、启动docker [root@localhost ~]# systemctl start docker 七、docker状态 [root@localhost ~]# systemctl status docker docker.service - Docker Application Container Engine Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled) Active: active (running) since 四 2023-01-26 19:24:36 CST; 12s ago Docs: https://docs.docker.com Main PID: 6284 (dockerd) Tasks: 8 Memory: 108.1M CGroup: /system.slice/docker.service └─6284 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock 八、docker开机启动 [root@localhost ~]# systemctl enable docker 九、修改镜像默认存储路径 查看当前存储路径 [root@localhost /]# docker info | grep "Docker Root Dir" Docker Root Dir: /var/lib/docker 创建新路径 [root@localhost docker]# mkdir -p /data/docker 停止服务 [root@localhost /]# systemctl stop docker Warning: Stopping docker.service, but it can still be activated by: docker.socket [root@localhost /]# systemctl stop docker.socket reload配置文件 [root@localhost /]# systemctl daemon-reload 重启服务 [root@localhost /]# systemctl restart docker.service 查看本地镜像存储修改结果 [root@localhost /]# docker info | grep "Docker" app: Docker App (Docker Inc., v0.9.1-beta3) buildx: Docker Buildx (Docker Inc., v0.10.0-docker) scan: Docker Scan (Docker Inc., v0.23.0) Docker Root Dir: /data/docker
-
到了这里,关于centos7在线安装 jdk1.8+tomcat+mysql8+nginx+docker的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!