nginx系列-准备工作

tips:虚拟机安装centos7之后配置网卡

安装完成虚拟机后需要配置一下网卡,配置为网卡ip为动态获取,配置方式如下:

[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-enp0s3 

在这里插入图片描述
将ONBOOT改为yes,然后重启网卡

service network restart
ip addr

然后再次查看ip地址,发现就会有了,ping一下百度也正常了

1.查看网络状况

[root@bogon opt]# ping www.baidu.com
PING www.a.shifen.com (180.149.131.98) 56(84) bytes of data.
64 bytes from 180.149.131.98: icmp_seq=1 ttl=56 time=24.0 ms
64 bytes from 180.149.131.98: icmp_seq=2 ttl=56 time=16.3 ms
64 bytes from 180.149.131.98: icmp_seq=3 ttl=56 time=97.3 ms
^C
--- www.a.shifen.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2005ms
rtt min/avg/max/mdev = 16.338/45.930/97.377/36.515 ms

2.查看yum是否可用

[root@bogon opt]# yum list | grep gcc

3.确认关闭iptables规则

对iptables不懂的初学者可能会在后期端口等方面造成一定影响,懂的可以自己配置好

iptables -L: 查看规则
iptables -t nat -L:查看nat表的规则
iptables -F:关闭规则
iptables -t nat -F:关闭nat表的规则

[root@bogon opt]# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy DROP)
target     prot opt source               destination         
DOCKER-ISOLATION  all  --  anywhere             anywhere            
DOCKER     all  --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere            

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

Chain DOCKER (1 references)
target     prot opt source               destination         

Chain DOCKER-ISOLATION (1 references)
target     prot opt source               destination         
RETURN     all  --  anywhere             anywhere            
[root@bogon opt]# iptables -F
[root@bogon opt]# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy DROP)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

Chain DOCKER (0 references)
target     prot opt source               destination         

Chain DOCKER-ISOLATION (0 references)
target     prot opt source               destination    

4.确认停用selinux

因为安全性会对一些http或者服务请求等屏蔽,为了学习不受影响。先关闭

//查看selinux是否运行
[root@bogon opt]# getenforce
Enforcing
//关闭selinux
[root@bogon opt]# setenforce 0

5.安装一些基本库和基本工具

[root@localhost ~]# yum -y install gcc gcc-c++ autoconf pcre pcre-devel make automake 
[root@localhost ~]# yum -y install wget httpd-tools vim

6.初始化一些目录

app:代码目录
download:网上下载的源码包等
logs:放一些自定义的日志
work:存放一些shell的脚本
backup:对一些东西修改备份的时候,把备份文件放到这个目录下

[root@localhost ~]# cd /opt/
[root@localhost opt]# ls
[root@localhost opt]# mkdir app
[root@localhost opt]# mkdir backup
[root@localhost opt]# mkdir download
[root@localhost opt]# mkdir logs
[root@localhost opt]# mkdir work
[root@localhost opt]# ls
app  backup  download  logs  work
[root@localhost opt]# 

7.关闭防火墙

systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值