阿里云开源镜像
CentOS 7设置网络开机自动连接
修改/etc/sysconfig/network-scripts/ifcfg-en***文件,
将最后一行的ONBOOT= 后边的no改为yes,保存即可。
ifconfig
如果ifconfig命令无效,通过安装net-tools进行解决,如下:
yum -y install net-tools
防火墙
## CentOS7版本后防火墙默认使用firewalld,因此在CentOS7中关闭防火墙使用以下命令,
## 临时关闭
[root@localhost /]# systemctl stop firewalld
## 禁止开机启动
[root@localhost /]# systemctl disable firewalld
## 如果安装了iptables-service,也可以使用下面的命令
#先检查是否安装了iptables
[root@localhost /]# service iptables status
#安装iptables
[root@localhost /]# yum install -y iptables
#升级iptables
[root@localhost /]# yum update iptables
#安装iptables-services
[root@localhost /]# yum install iptables-services
#关闭防火墙
[root@localhost /]# service iptables stop
## 通过设置Linux的防火墙,开启3306端口
[root@localhost /]# /sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
## 重新刷新防火墙
[root@localhost /]# /etc/rc.d/init.d/iptables save
## 或者关闭防火墙
[root@localhost /]# service iptables close
yum install的时候提示:Loaded plugins: fastestmirror
#fastestmirror是yum的一个加速插件,这里是插件提示信息是插件不能用了。
#不能用就先别用呗,禁用掉,先yum了再说。
#修改插件的配置文件
[root@localhost /]# vi /etc/yum/pluginconf.d/fastestmirror.conf
enabled = 1 # 由1改为0,禁用该插件
# 修改yum的配置文件
[root@localhost /]# vi /etc/yum.conf
plugins=1 # 改为0,不使用插件
进程
## 查看进程
ps -ef | grep redis
## 删除进程
kill -9 pid
查找程序相关位置
[root@localhost /]# whereis mysql
解压缩命令
# tar打包:
tar czvf fileName.tar dirName
# tar解压:
tar zxvf fileName.tar
# ZIP压缩命令:
zip -r xxx.zip ./*
# ZIP解压命令:
unzip filename.zip
端口查看
- lsof -i:端口号 用于查看某一端口的占用情况,比如查看8000端口使用情况,lsof -i:8000
- netstat -tunlp | grep 端口号,用于查看指定的端口号的进程情况,如查看8000端口的情况,netstat -tunlp
|grep 8000