码迷,mamicode.com
首页 > 其他好文 > 详细

从零开始装CentOS以及配置Redis,前端都可以!!!

时间:2019-10-16 11:27:47      阅读:65      评论:0      收藏:0      [点我收藏+]

标签:select   禁用   系统   cheng   server   except   虚拟机   redis   gate   

##### 从零开始装CentOS以及配置Redis 1、新建虚拟机 --- ![image](https://img2018.cnblogs.com/blog/1334966/201910/1334966-20191016105938198-388095002.png) 2、稍后再选择你要安装得系统镜像 --- ![image](https://img2018.cnblogs.com/blog/1334966/201910/1334966-20191016105938459-1738099874.png) 3、选择linux 下得 CentOS 7 --- ![image](https://img2018.cnblogs.com/blog/1334966/201910/1334966-20191016105938674-999645929.png) 4、给你要安装的虚拟机进行起名字并且选择安装位置 --- ![image](https://img2018.cnblogs.com/blog/1334966/201910/1334966-20191016105939203-814941760.png) 5、配置磁盘的大小 --- ![image](https://img2018.cnblogs.com/blog/1334966/201910/1334966-20191016105939507-217675346.png) 6、完成 --- ![image](https://img2018.cnblogs.com/blog/1334966/201910/1334966-20191016105940006-490234282.png) 7、配置系统的镜像和网络 --- ![image](https://img2018.cnblogs.com/blog/1334966/201910/1334966-20191016105940266-775643563.png) 8、配置系统的镜像 --- ![image](https://img2018.cnblogs.com/blog/1334966/201910/1334966-20191016105940829-1366420581.png) 9、配置系统的网络 --- ![image](https://img2018.cnblogs.com/blog/1334966/201910/1334966-20191016105941166-866639434.png) 10、此时可以开机了 --- ![image](https://img2018.cnblogs.com/blog/1334966/201910/1334966-20191016105941637-976013530.png)   安装系统 --- ![image](https://img2018.cnblogs.com/blog/1334966/201910/1334966-20191016105941861-771864903.png) 11、选择语言,接下来一步一步的安装就好了 注意一下网络的设置就可以了, 把有叹号的选项处理完就可以了,这里由于图太多就不显示了 --- ![image](https://img2018.cnblogs.com/blog/1334966/201910/1334966-20191016105943653-1623241696.png) 12、安装vim --- ![image](https://img2018.cnblogs.com/blog/1334966/201910/1334966-20191016105944472-1162561103.png) 13、安装成功
--- ![image](https://img2018.cnblogs.com/blog/1334966/201910/1334966-20191016105944844-534480775.png) 14、配置静态的ip的路径 --- ![image](https://img2018.cnblogs.com/blog/1334966/201910/1334966-20191016105945628-2121840717.png) 15、打开网络配置文件 --- ![image](https://img2018.cnblogs.com/blog/1334966/201910/1334966-20191016105945825-1056030187.png) 16、修改如下图所示的位置 --- ![image](https://img2018.cnblogs.com/blog/1334966/201910/1334966-20191016105946547-1112284003.png) ``` TYPE="Ethernet" PROXY_METHOD="none" BROWSER_ONLY="no" BOOTPROTO="static" DEFROUTE="yes" IPV4_FAILURE_FATAL="no" IPV6INIT="yes" IPV6_AUTOCONF="yes" IPV6_DEFROUTE="yes" IPV6_FAILURE_FATAL="no" IPV6_ADDR_GEN_MODE="stable-privacy" NAME="ens33" DEVICE="ens33" ONBOOT="yes" IPADDR=172.16.178.2 NETMASK=255.255.255.0 DNS1=114.114.114.114 GATEWAY=172.16.178.1 ``` 17、重启一下之后 --- systemctl restart network, ping 一下百度,如下图所示则配置成功 ![image](https://img2018.cnblogs.com/blog/1334966/201910/1334966-20191016105947071-1307960496.png) 18、安装一下wget --- ![image](https://img2018.cnblogs.com/blog/1334966/201910/1334966-20191016105947236-1430821983.png)
19、显示当前路径 --- ![image](https://img2018.cnblogs.com/blog/1334966/201910/1334966-20191016105947514-57747381.png)
20、将redis放到该文件夹中 ![image](https://img2018.cnblogs.com/blog/1334966/201910/1334966-20191016105947514-57747381.png)
21、解压后进行make && make install 安装 --- ![image](https://img2018.cnblogs.com/blog/1334966/201910/1334966-20191016105948254-744309484.png)
22、如下图缺少gcc环境 --- ![image](https://img2018.cnblogs.com/blog/1334966/201910/1334966-20191016105948679-709576120.png)
23、安装gcc 环境再一次进行make --- ![image](https://img2018.cnblogs.com/blog/1334966/201910/1334966-20191016105948909-1035129866.png)
24、再一次进行make,如果出现以下情况 --- ![image](https://img2018.cnblogs.com/blog/1334966/201910/1334966-20191016105949102-873902979.png)
``` 解决办法: 使用以下命令 make MALLOC=libc 原因分析: 在README 有这个一段话。 Allocator ——— Selecting a non-default memory allocator when building Redis is done by setting the `MALLOC` environment variable. Redis is compiled and linked against libc malloc by default, with the exception of jemalloc being the default on Linux systems. This default was picked because jemalloc has proven to have fewer fragmentation problems than libc malloc. To force compiling against libc malloc, use: % make MALLOC=libc To compile against jemalloc on Mac OS X systems, use: % make MALLOC=jemalloc 说关于分配器allocator, 如果有MALLOC 这个 环境变量, 会有用这个环境变量的 去建立Redis。 而且libc 并不是默认的 分配器, 默认的是 jemalloc, 因为 jemalloc 被证明 有更少的 fragmentation problems 比libc。 但是如果你又没有jemalloc 而只有 libc 当然 make 出错。 所以加这么一个参数 ``` --- 25、再进行一次make && make install --- ![image](https://img2018.cnblogs.com/blog/1334966/201910/1334966-20191016105949292-572404663.png)
26、cd src目录下可以看到redis的可执行文件 --- ![image](https://img2018.cnblogs.com/blog/1334966/201910/1334966-20191016105949556-1565739619.png)
  ``` redis-server 启动Redis服务器
  redis-cli Redis命令行客户端
  redis-benchmark Redis性能测试工具
  redis-check-aof 对AOF文件进行修复的工具
  redis-check-dump 对RDB文件检查的工具
  redis-sentinel Sentinel服务器
``` ![image](https://img2018.cnblogs.com/blog/1334966/201910/1334966-20191016105950145-1375179421.png)
27、启动redis --- ![image](https://img2018.cnblogs.com/blog/1334966/201910/1334966-20191016105950480-500877531.png)
28、redis.conf配置文件 --- ![image](https://img2018.cnblogs.com/blog/1334966/201910/1334966-20191016105950712-1468954482.png)
29、指定redis.conf配置文件启动 --- ![image](https://img2018.cnblogs.com/blog/1334966/201910/1334966-20191016105950906-1288998180.png)
30、验证启动 --- ![image](https://img2018.cnblogs.com/blog/1334966/201910/1334966-20191016105951211-1940593832.png)
31、测试链接 --- ![image](https://img2018.cnblogs.com/blog/1334966/201910/1334966-20191016105951778-1707465764.png)
32、修改redis.conf的配置文件后台运行 --- ![image](https://img2018.cnblogs.com/blog/1334966/201910/1334966-20191016105952571-177304127.png)
![image](https://img2018.cnblogs.com/blog/1334966/201910/1334966-20191016105952747-3678123.png)
vim /etc/redis.conf 找到bind 127.0.0.1并注释掉 修改 protected-mode 属性值为no 注:redis默认是只能本地访问,注释掉并叫保护模式禁用以后可以IP访问 --- ![image](https://img2018.cnblogs.com/blog/1334966/201910/1334966-20191016105952963-1051408472.png)
33、指定ip访问 --- ![image](https://img2018.cnblogs.com/blog/1334966/201910/1334966-20191016105953129-2056106925.png)
帮忙关注一下 微信公众号一起学习 :chengxuyuan95(不一样的程序员)

从零开始装CentOS以及配置Redis,前端都可以!!!

标签:select   禁用   系统   cheng   server   except   虚拟机   redis   gate   

原文地址:https://www.cnblogs.com/xyzmy/p/11684206.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!