码迷,mamicode.com
首页 > 系统相关 > 详细

linux常用命令

时间:2017-11-15 22:11:04      阅读:312      评论:0      收藏:0      [点我收藏+]

标签:ack   新建   模式   文件夹   关闭   复制   end   start   打开   

  1. 防火墙操作

  2. ip地址操作

  3. 文件操作

  4. redis安装和简单配置

查看网络信息

ifconfig

 contos7

1.防火墙

临时关闭防火墙

systemctl stop firewalld

 

永久防火墙开机关闭

systemctl disable firewalld

 

临时打开防火墙

systemctl start firewalld

 

防火墙开机启动

systemctl enable firewalld

 

查看防火墙状态

systemctl status firewalld

 

2.SElinux

  临时关闭SElinux

  setenforce 0

 

  临时打开SElinux

  setenforce 1

 

  开机关闭SElinux

  编辑 /etc/selinux/config文件,将SELINUX的值设置为disabled

 

 

三、文件操作

查看文件  cat

编辑文件 vim

复制 cp  -r

移动 mv

新建文件 touch

新建文件夹 mkdir

四、redis 安装和简单配置

 

wget http://download.redis.io/releases/redis-3.0.6.tar.gz   #可能是国外源下载不下来
#下载完成
tar xzf redis-3.0.6.tar.gz
cd redis-3.0.6
make   #编辑

启动服务端

src/redis-server

启动客户端

src/redis-cli
redis> set foo bar
OK
redis> get foo
"bar"

当外面主机来连接可能出现

edis.exceptions.ResponseError: DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions: 1) Just disable protected mode sending the command ‘CONFIG SET protected-mode no‘ from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent. 2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to ‘no‘, and then restarting the server. 3) If you started the server manually just for testing, restart it with the ‘--protected-mode no‘ option. 4) Setup a bind address or an authentication password. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside.

 

配置下redis-table 下面的redis.conf文件

将下面两个配置改为:

bind 0.0.0.0  #所有主机都可以连接

protected-mode no     #不是保护模式

再次启动redis服务

 

src/redis-server redis.conf  

 

linux常用命令

标签:ack   新建   模式   文件夹   关闭   复制   end   start   打开   

原文地址:http://www.cnblogs.com/yuyang26/p/7840660.html

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