CentOS 7.5 Minimal (最小化安装)安装后的设置
系统版本
cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
开启网络
修改网卡配置文件
vi /etc/sysconfig/network-scripts/ifcfg-enp0s3
修改 ONBOOT=no
为 ONBOOT=yes
重启网卡使配置生效
systemctl restart network
验证网络情况
ping qq.com -c 3
0% packet loss 没有丢包,表示网络完好。
安装常用软件
- vim
yum install -y vim
- net-tools
如果需要使用 ifconfig、netstat 命令,则需要安装 net-tools
yum install -y net-tools
- wget
yum install -y wget
更新系统
yum update -y
如果觉得网络源比较慢可以更改为国内的源,更改方法:
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
yum update -y
添加 epel 和 remi 源
yum install -y epel-release
yum install http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
添加 remi 源主要是为了方便安装最新的 PHP 7.2 版本
添加普通账号
- 添加账号
useradd nideshop
- 设置登录密码
echo "你的密码" | passwd --stdin useradd
- 清空历史命令
history -c
echo > ~/.bash_history
禁用 root 账号远程登录
- 更改配置文件
vim /etc/ssh/sshd_config
把 #PermitRootLogin yes
更改为 PermitRootLogin no
- 重启 sshd 服务
systemctl restart sshd