继续!
4、安装maven
1,创建一个maven的安装路径
[root@localhost ~]# mkdir /usr/local/maven
2,将下载好的maven安装包上传到maven文件夹,解压:
[root@localhost maven]# wget http://mirrors.hust.edu.cn/apache/maven/maven-3/3.5.4/binaries/apache-maven-3.5.4-bin.tar.gz[root@localhost maven]# tar -zxvf apache-maven-3.5.2-bin.tar.gz[root@localhost maven]# ls apache-maven-3.5.2 apache-maven-3.5.2-bin.tar.gz
3,配置maven, 编辑 /etc/profile 文件,尾部添加如下
[root@localhost maven]# vi /etc/profile 添加如下脚本 M2_HOME=/usr/local/maven/apache-maven-3.5.2 export PATH=${M2_HOME}/bin:${PATH}
4,重新加载/etc/profile:
[root@localhost maven]# source /etc/profile
5,检查maven是否安装成功:
[root@localhost maven]# mvn -v
Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d;
2019-06-09 T15:58:13+08:00) Maven home:
/usr/local/maven/apache-maven-3.5.2 Java version: 1.8.0_162,
vendor: Oracle Corporation
到此maven安装完毕
5、安装tomcat
1,下载apache-tomcat-8.5.27.tar.gz
[root@localhost ~]# mkdir /usr/local/tomcat
2,将下载好的安装包上传到tomcat文件夹,解压:
[root@localhost tomcat]# tar -zxvf apache-tomcat-8.5.27.tar.gz
3,设置tomcat的端口80(可选)
[root@localhost tomcat]# vi /usr/local/tomcat/apache-tomcat-8.5.27/conf/server.xml
4,配置防火墙,开放端口
[root@localhost tomcat]# firewall-cmd --zone=public --add-port=80/tcp --permanent
success
5,重启防火墙
[root@localhost tomcat]# firewall-cmd --reload
success
6,启动tomcat:
[root@localhost tomcat]# /usr/local/tomcat/apache-tomcat-8.5.27/bin/startup.sh
Using CATALINA_BASE: /usr/local/tomcat/apache-tomcat-8.5.27 Using
CATALINA_HOME: /usr/local/tomcat/apache-tomcat-8.5.27 Using
CATALINA_TMPDIR: /usr/local/tomcat/apache-tomcat-8.5.27/temp Using
JRE_HOME: //usr/local/java/jdk1.8.0_162/jre Using CLASSPATH:
/usr/local/tomcat/apache-tomcat-8.5.27/bin/bootstrap.jar:/usr/local/tomcat/apache-
tomcat-8.5.27/bin/tomcat-juli.jar Tomcat started
7,在浏览器输入:localhost 如果不配置端口:localhost :8080
6,安装redis
1.进入并创建/usr/local/redis目录,下载并解压redis文件
[root@localhost ~]# clear 或 Ctrl + L 【清屏】 [root@localhost ~]# yum -y install gcc gcc-c++ tcl [root@localhost ~]# mkdir /usr/local/redis [root@localhost ~]# cd /usr/local/redis [root@localhost redis]# wget http://download.redis.io/releases/redis-4.0.9.tar.gz[root@localhost redis]# tar -zxvf redis-4.0.9.tar.gz[root@localhost redis]# cd redis-4.0.9
2.编译并指定安装
[root@localhost redis-4.0.9]# make [root@localhost redis-4.0.9]# make PREFIX=/usr/local/redis install CC Makefile.depHint: It's a good idea to run 'make test' ;)INSTALL installINSTALL installINSTALL installINSTALL installINSTALL install[root@localhost redis-4.0.9]# cd /usr/local/redis/bin[root@localhost bin]# ll
-rwxr-xr-x. 1 root root 2451904 4月 3 17:20 redis-benchmark
-rwxr-xr-x. 1 root root 5770200 4月 3 17:20 redis-check-aof
-rwxr-xr-x. 1 root root 5770200 4月 3 17:20 redis-check-rdb
-rwxr-xr-x. 1 root root 2617024 4月 3 17:20 redis-cli lrwxrwxrwx. 1 root root 12 4月 3 17:20 redis-sentinel -> redis-server
-rwxr-xr-x. 1 root root 5770200 4月 3 17:20 redis-server
3.复制redis.com文件并启动
[root@localhost bin]# cp /usr/local/redis/redis-4.0.9/redis.conf/usr/local/redis [root@localhost bin]# ./redis-server
ctrl+C 关闭redis
4.设置后台启动服务
[root@localhost bin]# vim /usr/local/redis/redis.conf
daemonize no 修改为: daemonize yes
[root@localhost bin]# ./redis-server /usr/local/redis/redis.conf(启动redis)
5.查看和停止
[root@localhost bin]# ps aux | grep redis-server (查看服务名) ps -ef | grep -i redis
root 5549 0.1 0.1 145264 7504 ? Ssl 11:15 0:00
redis-server 127.0.0.1:6379 root 5565 0.0 0.0 112676 988
pts/0 S+ 11:22 0:00 grep --color=auto redis-server
[root@localhost bin]# netstat -tunple | grep 6379 (查看端口)
tcp 0 0 127.0.0.1:6379 0.0.0.0:*
LISTEN 0 33053 5549/redis-server 1
[root@localhost bin]# redis-cli shutdown (停止redis)
[root@localhost bin]# ps aux | grep redis-server root 17245 0.0
0.0 112676 988 pts/0 R+ 17:39 0:00 grep --color=auto redis-server
6.测试
[root@localhost bin]# ./redis-cli
127.0.0.1:6379> ping PONG (连接成功)
127.0.0.1:6379> set 11 “hh” OK
127.0.0.1:6379> get 11"hh"
7.指定IP登录
[root@localhost redis]# vi redis.conf
[ 替换 .conf结尾文件中的内容 :%s/old/new/g]
:%s/6379/6378/g
[快速查找对应关键字—>输入 /关键字]
/bind
修改IP:bind 192.168.234.10 (第69行)
修改Port:6378(第92行)
[root@localhost redis]# ./bin/redis-server /usr/local/redis/redis.conf 重启redis
5618:C 11 Apr 21:09:37.574 # oO0OoO0OoO0Oo Redis is starting
oO0OoO0OoO0Oo 5618:C 11 Apr 21:09:37.575 # Redis version=4.0.9,
bits=64, commit=00000000, modified=0, pid=5618, just started 5618:C 11
Apr 21:09:37.575 # Configuration loaded
[root@localhost redis]# ps aux | grep redis-server 查看端口号
root 4910 0.1 0.1 145264 7504 ? Ssl 13:33 0:29
./redis-server 127.0.0.1:6378 root 5583 0.0 0.1 145264 7504 ?
Ssl 20:54 0:00 ./redis-server 192.168.234.10:6378 root 5622
0.0 0.0 112676 980 pts/0 R+ 21:09 0:00 grep --color=auto redis-server
[root@localhost redis]# ./bin/redis-cli -h 192.168.234.10-p 6378
192.168.234.10:6378> ping PONG (连接成功)
192.168.234.10:6378> set 11 “hh”
192.168.234.10:6378> get 11 “hh”
8.命令
设置密码连接
[root@rabbit1 bin]# ls
dump.rdb redis-benchmark redis-check-aof redis-check-rdb redis-cli
redis-sentinel redis-server
[root@rabbit1 bin]# ./redis-cli
127.0.0.1:6379> config get requirepass 1) “requirepass” 2) “”
127.0.0.1:6379> config set requirepass admin 配置redis.conf 第500行 OK
127.0.0.1:6379> config get requirepass (error) NOAUTH Authentication required.
127.0.0.1:6379>exit
[root@rabbit1 bin]# ./redis-cli -h 127.0.0.1-p 6379-a admin
127.0.0.1:6379> config get requirepass 1) “requirepass” 2) “admin”
127.0.0.1:6379>
9,手动
配置密码
9.1,编辑配置文件
vi redis.conf
9.2,找到配置文件第500行
命令行模式下输入 set nu 回车 //显示行
9.3,配置密码重启即可
requirepass passwd
10、在密码的情况下连接reids
auth passwd