Centos7 MINIMAL配置

一、配置网络

两种方法

1.插网线

# Minimal ISO,安装时没有设置网络,安装后ifconfig不可用

cd /etc/sysconfig/network-scripts       # 只有ifcfg-enp0s25、ifcfg-lo

# 添加IP、掩码、网关等
vi ifcfg-enp0s25

# IPADDR=192.168.*.*
# NETMASK=255.255.255.0
# GATEWAY=192.168.*.*
# BOOTPROTO=static          # 设为dhcp则为动态获取ip
# ONBOOT=yes                # 开机启用

# 添加dns服务器
vi /etc/resolv.conf

# nameserver 180.76.76.76
# nameserver 114.114.114.114

# 重启网络服务
service network restart

# 测试
ping www.baidu.com

2.连接wifi

#tip:不能同时打开两个网络服务,得关闭以太网,ONBOOT=no。然后重启。

# 查看无线网接口
iw dev
# 启用wlp2s0接口
ip link set dev wlp2s0 up

# 查看周围wifi
iw dev wlp2s0 scan | grep SSID

# 连接wifi,指定SSID(wifi名称)和password(wifi密码)
wpa_supplicant -B -i wlp2s0 -c <(wpa_passphrase "ssid" "password")
# Successfully initialized wpa_supplicant

# 用dhcp获得IP
dhclient wlp2s0

# 查看ip
ip addr show wlp2s0
# <BROADCAST,MULTICAST,UP,LOWER_UP> UP表示接口已启用
# wlp3s0 inet 192.168.*.* brd .... int6 .....,无线网卡已获取ip,网络已连接
# 同时/etc/sysconfig/network-scripts出现ifcfg-"ssid"配置文件

二、安装常用软件包

yum -y install vim net-tools wget lrzsz curl telnet tcpdump tree

三、配置aliyun的repo源

cd /etc/yum.repos.d
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

四、清除缓存并生成新的缓存

yum clean all
yum makecache

五、合盖后黑屏但不进入睡眠模式修改

vim  /etc/systemd/logind.conf
HandlePowerKey按下电源键后的行为

HandleSleepKey 按下挂起键后的行为

HandleHibernateKey 按下休眠键后的行为

HandleLidSwitch 合上笔记本盖后的行为

行为可以是 ignore、poweroff、reboot、halt、suspend、hibernate、hybrid-sleep、lock 或 kexec。

系统默认设置为:

HandlePowerKey=poweroff

HandleSuspendKey=suspend

HandleHibernateKey=hibernate

HandleLidSwitch=suspend

只需要把HandleLidSwitch选项设置为如下即可:

HandleLidSwitch=lock

注意:设置完成保存后运行 systemctl restart systemd-logind 命令才生效。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Pavel-Chen

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值