File tree Expand file tree Collapse file tree 4 files changed +50
-5
lines changed
Expand file tree Collapse file tree 4 files changed +50
-5
lines changed Original file line number Diff line number Diff line change 3030 - 关闭客户端:` redis-cli shutdown `
3131 - 开机启动配置:` echo "/usr/local/bin/redis-server /etc/redis.conf" >> /etc/rc.local `
3232 - 开放防火墙端口:
33- - 添加规则:` sudo iptables -I INPUT -p tcp -m tcp --dport 6379 -j ACCEPT`
34- - 保存规则:` sudo /etc/rc.d/init.d/ iptables save`
35- - 重启 iptables:` sudo service iptables restart`
33+ - 添加规则:` iptables -I INPUT -p tcp -m tcp --dport 6379 -j ACCEPT `
34+ - 保存规则:` service iptables save`
35+ - 重启 iptables:` service iptables restart `
3636
3737
3838## Redis 配置
3939
40- - 编辑配置文件:` vim /usr/program/redis-3.0.7 /redis.conf `
40+ - 编辑配置文件:` vim /etc /redis.conf `
4141- Redis 默认的配置文件内容:
4242
4343``` ini
@@ -96,7 +96,7 @@ aof-rewrite-incremental-fsync yes
9696
9797## 设置 Redis 请求密码
9898
99- - 打开 ` vim /usr/program/redis-3.0.7 /redis.conf ` 配置文件,找到默认是被注释的这一行:` # requirepass foobared `
99+ - 打开 ` vim /etc /redis.conf ` 配置文件,找到默认是被注释的这一行:` # requirepass foobared `
100100- 去掉注释,把 ` foobared ` 改为你想要设置的密码,比如我打算设置为:123456,所以我改为:` requirepass 123456 `
101101- 修改之后重启下服务
102102- 有了密码之后,进入客户端,就得这样访问:` redis-cli -h 127.0.0.1 -p 6379 -a 123456 `
Original file line number Diff line number Diff line change @@ -48,4 +48,10 @@ ln -s /usr/program/mysql/bin/mysqlslap /usr/bin
4848
4949ln -s /usr/program/mysql/data/mysql.sock /tmp/mysql.sock
5050
51+ iptables -I INPUT -p tcp -m tcp --dport 3306 -j ACCEPT
52+
53+ service iptables save
54+
55+ service iptables restart
56+
5157echo " 安装 mysql 结束,现在需要手动设置防火墙和禁用 selinux."
Original file line number Diff line number Diff line change 1818
1919make install
2020
21+ iptables -I INPUT -p tcp -m tcp --dport 80 -j ACCEPT
22+
23+ service iptables save
24+
25+ service iptables restart
26+
2127echo " 完成安装 nginx,把端口加到防火墙中"
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ echo " 安装开始"
4+
5+ yum install -y gcc-c++ tcl
6+
7+ cd /opt/setups
8+
9+ tar zxvf redis-3.2.8.tar.gz
10+
11+ mv redis-3.2.8/ /usr/program/
12+
13+ cd /usr/program/redis-3.2.8
14+
15+ make
16+
17+ make install
18+
19+ cp /usr/program/redis-3.2.8/redis.conf /etc/
20+
21+ sed -i ' s/daemonize no/daemonize yes/g' /etc/redis.conf
22+
23+ echo " /usr/local/bin/redis-server /etc/redis.conf" >> /etc/rc.local
24+
25+ iptables -I INPUT -p tcp -m tcp --dport 6379 -j ACCEPT
26+
27+ service iptables save
28+
29+ service iptables restart
30+
31+ rm -rf /usr/program/redis-3.2.8
32+
33+ echo " 安装结束"
You can’t perform that action at this time.
0 commit comments