1:JDK安装
1:在opt下新建jdk目录
[root@lkLinux01 opt]# mkdir jdk
2:卸载自带jdk
[root@lkLinux01 opt]# rpm -qa | grep java
java-1.8.0-openjdk-headless-1.8.0.181-7.b13.el7.x86_64
python-javapackages-3.4.1-11.el7.noarch
javapackages-tools-3.4.1-11.el7.noarch
java-1.8.0-openjdk-1.8.0.181-7.b13.el7.x86_64
java-1.7.0-openjdk-headless-1.7.0.191-2.6.15.5.el7.x86_64
java-1.7.0-openjdk-1.7.0.191-2.6.15.5.el7.x86_64
tzdata-java-2018e-3.el7.noarch
[root@lkLinux01 opt]# rpm -e --nodeps java-1.8.0-openjdk-headless-1.8.0.181-7.b13.el7.x86_64
[root@lkLinux01 opt]# rpm -e --nodeps java-1.8.0-openjdk-1.8.0.181-7.b13.el7.x86_64
[root@lkLinux01 opt]# rpm -e --nodeps java-1.7.0-openjdk-headless-1.7.0.191-2.6.15.5.el7.x86_64
[root@lkLinux01 opt]# rpm -e --nodeps java-1.7.0-openjdk-1.7.0.191-2.6.15.5.el7.x86_64
[root@lkLinux01 opt]# rpm -qa | grep java
python-javapackages-3.4.1-11.el7.noarch
javapackages-tools-3.4.1-11.el7.noarch
tzdata-java-2018e-3.el7.noarch
3:通过Xftp7传输
4:解压
[root@lkLinux01 jdk]# tar -zxvf jdk-8u321-linux-x64.tar.gz
5:解压后的文件夹放到usr/local/java
[root@lkLinux01 jdk]# ls
jdk1.8.0_321 jdk-8u321-linux-x64.tar.gz
[root@lkLinux01 jdk]# mkdir /usr/local/java
[root@lkLinux01 jdk]# mv jdk1.8.0_321/ /usr/local/java/
[root@lkLinux01 jdk]# ls
jdk-8u321-linux-x64.tar.gz
[root@lkLinux01 jdk]# cd /usr/local/java/
[root@lkLinux01 java]# ls
jdk1.8.0_321
[root@lkLinux01 java]#
6:配置环境变量
在/etc/profile配置JAVA_HOME:
[root@lkLinux01 bin]# vim /etc/profile
#写入的内容
export JAVA_HOME=/usr/local/java/jdk1.8.0_321
export PATH=$JAVA_HOME/bin:$PATH
[root@lkLinux01 bin]# source /etc/profile #使新的环境变量生效
7:运行java测试
[root@lkLinux01 java]# vim hello.java #此处为简单的输出hello的java程序
[root@lkLinux01 java]# javac hello.java
[root@lkLinux01 java]# ls
hello.class hello.java jdk1.8.0_321
[root@lkLinux01 java]# java hello.class
[root@lkLinux01 java]# java hello
hello,world
2:Tomcat安装
1:在opt下新建tomcat目录
[root@lkLinux01 opt]# mkdir tomcat
[root@lkLinux01 opt]# ls
firefox-60.2.2-1.el7.centos.x86_64.rpm jdk tomcat VMwareTools-10.3.2-9925305.tar.gz vmware-tools-distrib
2:上传文件到tomcat
[root@lkLinux01 opt]# cd tomcat/
[root@lkLinux01 tomcat]# ls
apache-tomcat-8.5.78.tar.gz
3:解压文件
[root@lkLinux01 tomcat]# tar -zxvf apache-tomcat-8.5.78.tar.gz
[root@lkLinux01 tomcat]# ls
apache-tomcat-8.5.78 apache-tomcat-8.5.78.tar.gz
4:启动tomcat的bin目录下的startup.sh
[root@lkLinux01 bin]# ./startup.sh Using CATALINA_BASE: /opt/tomcat/apache-tomcat-8.5.78Using CATALINA_HOME: /opt/tomcat/apache-tomcat-8.5.78Using CATALINA_TMPDIR: /opt/tomcat/apache-tomcat-8.5.78/tempUsing JRE_HOME: /usr/local/java/jdk1.8.0_321Using CLASSPATH: /opt/tomcat/apache-tomcat-8.5.78/bin/bootstrap.jar:/opt/tomcat/apache-tomcat-8.5.78/bin/tomcat-juli.jarUsing CATALINA_OPTS: Tomcat started.
5:访问192.168.101.135:8080端口
修改8080端口开启:window也可以访问:ip为虚拟机ip端口为8080,使用ifconfig查看ip
[root@lkLinux01 bin]# firewall-cmd --permanent --add-port=8080/tcp[root@lkLinux01 bin]# firewall-cmd --reload [root@lkLinux01 bin]# firewall-cmd --permanent --query-port=8080/tcp
3:安装MySql
1:opt下创建mysql文件夹
[root@lkLinux01 opt]# mkdir mysql
[root@lkLinux01 opt]# ls
firefox-60.2.2-1.el7.centos.x86_64.rpm idea2020 jdk mysql tomcat VMwareTools-10.3.2-9925305.tar.gz vmware-tools-distrib
2:上传文件并解压
需要删除自带的数据库
[root@lkLinux01 mysql]# rpm -e --nodeps mariadb-libs
[root@lkLinux01 mysql]# rpm -e --nodeps marisa
[root@lkLinux01 mysql]# tar -xvf mysql-5.7.26-1.el7.x86_64.rpm-bundle.tar
3:安装
注意安装顺序:
[root@lkLinux01 mysql]# rpm -ivh mysql-community-common-5.7.26-1.el7.x86_64.rpm
[root@lkLinux01 mysql]# rpm -ivh mysql-community-libs-5.7.26-1.el7.x86_64.rpm
[root@lkLinux01 mysql]# rpm -ivh mysql-community-client-5.7.26-1.el7.x86_64.rpm
[root@lkLinux01 mysql]# rpm -ivh mysql-community-server-5.7.26-1.el7.x86_64.rpm
4:启动mysql服务
[root@lkLinux01 mysql]# systemctl start mysqld.service
5:用户名密码
mysql为root用户设置随机的密码
[root@lkLinux01 mysql]# grep "password" /var/log/mysqld.log
2022-04-15T08:17:55.034095Z 1 [Note] A temporary password is generated for root@localhost: XgdeNs-JG6dz
#此处: 后的全为密码
设置密码
#进入mysql
[root@lkLinux01 mysql]# mysql -u root -p
Enter password:
#设置密码级别 默认为1 此处设置为0
mysql> set global validate_password_policy=0;
mysql> set password=password('root123456');
Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> ALTER USER root@localhost password expire never;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
测试:
mysql> create database
-> testDate;
Query OK, 1 row affected (0.01 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
| testDate |
+--------------------+
5 rows in set (0.00 sec)
mysql> create table users( id int primary key,name varchar(20) );
Query OK, 0 rows affected (0.02 sec)
mysql> insert into users (id,name) values(1,'test');
Query OK, 1 row affected (0.01 sec)
mysql> select * from users
-> ;
+----+------+
| id | name |
+----+------+
| 1 | test |
+----+------+
1 row in set (0.00 sec)
mysql>
4:reids安装
1:上传redis-6.2.1.tar.gz 到/opt/redis 解压(在/opt下创建目录redis)
[root@lkLinux01 redis]# tar -zxvf redis-6.2.1.tar.gz
2:进入redis-6.2.1使用make命令进行编译(需要gcc)
[root@lkLinux01 redis-6.2.1]# make
3:安装
[root@lkLinux01 redis-6.2.1]# make install
4:默认安装到/usr/local/bin目录
[root@lkLinux01 bin]# cd /usr/local/bin/
[root@lkLinux01 bin]# ls
redis-benchmark redis-check-aof redis-check-rdb redis-cli redis-sentinel redis-server
5:启动Redis(后台启动)
redis的目录里面的redis.conf文件复制到其它目录比如/etc目录
[root@lkLinux01 etc]# cp redis.conf /etc/redis.conf
[root@lkLinux01 etc]# vim redis.conf
将daemonize的值改为yes
daemonize yes
启动:
进入usr/loacl/bin目录
[root@lkLinux01 etc]# cd /usr/local/bin/
后台启动redis-server+redis.conf的位置
[root@lkLinux01 bin]# redis-server /etc/redis.conf
[root@lkLinux01 bin]# ps -ef | grep redis
root 14482 1 0 15:16 ? 00:00:00 redis-server 127.0.0.1:6379
通过redis-cli从客户端连接redis
[root@lkLinux01 bin]# redis-cli --raw #--raw为了解决中文乱码
127.0.0.1:6379>
127.0.0.1:6379> ping
PONG
cli关闭redis
127.0.0.1:6379> shutdown
not connected> exit #退出redis-cli