联网设置
查看可用的网卡(不用ifconfig)
nmcli con
固定IP
- 用文本编辑器打开接口配置文件
# vim /etc/sysconfig/network-scripts/
- 修改以下内容
BOOTPROTO=static
ONBOOT=yes
IPADDR=<静态IP>
GATEWAY=<默认网关>
NETMASK=<子网掩码>
DNS1=<DNS>
- 重启网络服务
service network restart
修改hostname
hostnamectl --static set-hostname <主机名>
👆其实主机名有static(静态,一般用于永久修改)、transient(系统运行时临时分配)、pretty(用于当前终端用户)三种
系统代理
- 在CLI界面输入
export ALL_PROXY="https://username:password@proxy_ip:port"
👆如果想对所有用户开机生效,把这行写进/etc/profile
里,并用source /etc/profile
使之立即生效
Wget代理
在/etc/wgetrc
里,取消掉下文注释并加入需要的内容
http_proxy=http://<user>:<pwd>@<host>:<port>
修改ulimit(重启不失效)
在/etc/security/limits.conf
中添加以下内容:
* soft nofile 65535
* hard nofile 65535
YUM包管理
引入epel源(建议都这么做一下)
yum -y install epel-release
查询维护
查看哪个进程占用了某个端口
# 最小安装的CentOS需要事先安装lsof
yum install lsof
lsof -i:80