• linux一些配置


    ifconfig 查询、设置网卡和ip参数

    ifup ens33 启动网卡

    ifdown 关闭网卡

    systemctl restart/start/stop network 重启、开始、关闭 网络服务

    PS1="[u@h w ]$" 修改命令提示符,添加 绝对路径,和时间

    hostnamectl set-hostname 新名字  修改主机名 

    selinux 内置的防火墙

      查询selinux状态

      getenforce

      暂时停止selinxu
      setenforce 0
      永久关闭selinux
      vi /etc/selinux/conf
      # enforcing - SELinux security policy is enforced. 开启
      # permissive - SELinux prints warnings instead of enforcing. 临时关闭
      # disabled - No SELinux policy is loaded. 永久关闭

      修改如下行
      SELINUX=enforcing
      重启机器,使得selinx永久关闭

    软件防火墙
    iptables -F 清空规则
    iptables -L
    查看iptable防火墙规则 ,看到只有如下短短的三个链,就说明,没有规则了
    关闭防火墙的需求,防止他影响你的服务访问
    [root@s15fafafa ~]# iptables -L
    Chain INPUT (policy ACCEPT)
    target prot opt source destination

    Chain FORWARD (policy ACCEPT)
    target prot opt source destination

    Chain OUTPUT (policy ACCEPT)
    target prot opt source destination

    停止防火墙服务
    systemctl start/restart/stop firewalld
    systemctl disable firewalld #删除iptables的开机自启

    修改linux的字符编码

    1.编译字符编码的文件
    vi /etc/locale.conf
    写入如下变量
    LANG="zh_CN.UTF-8"

    2.读取这个文件,使得变量生效

    source 读取命令,使得配置文件在系统中生效

    source /etc/locale.conf

    3.查看系统字符编码
    echo $LANG

    yum源的仓库路径在
    /etc/yum.repos.d/
    然后这个目录底下,只有 以 .repo结尾的文件,才会被识别为yum仓库
    
    
    配置国内的yum源
    1.在/etc/yum.repos.d/目录底下,定制我们自己的repo仓库文件 
    2.我们自己没有yum仓库,我们就去拿阿里巴巴的yum仓库
    3.https://opsx.alibaba.com/mirror  这就是阿里巴巴的镜像站
    4.下载阿里巴巴的yum仓库文件
    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
    wget下载文件后,-O参数,指定放到某个目录,且改名
    5.清除yum缓存 
    yum clean all 
    6.生成新的阿里云的yum软件缓存
    yum makecache
    
    
    再配置epel额外的仓库源,这个仓库里就存放了很多第三方软件,例如redis  mysql  nginx 
    1.配置epel仓库
    wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
    2.最好再生成yum缓存
    yum makecache 
    3.请随心所欲的使用 yum工具
    
    yum示例用法
    yum安装nginx web服务器软件
    1.  yum install nginx  -y       -y 一路都是默认yes
    2.启动nginx  
    直接输入nginx命令
    3.修改nginx主页面 ,文件名字叫做 index.html  
    find  /   -name index.html        查找这个文件所在地
    vim /usr/share/nginx/html/index.html        修改这个nginx首页文件
    View Code
  • 相关阅读:
    VMware Workstation Pro下载密钥
    hypervisor
    Xmanager6 下载地址
    linux常用命令
    linux常用
    查看机器端口信息
    windows下快捷键
    SpringMVC学习笔记整理
    2017面试题收集
    oracle 常用知识点整理
  • 原文地址:https://www.cnblogs.com/qq849784670/p/10187074.html
Copyright © 2020-2023  润新知