1. 程式人生 > >Centos7 Minimal最小安裝後要進行的優化

Centos7 Minimal最小安裝後要進行的優化

1.修改網路配置,設定靜態IP,方便遠端

[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens33 (按自己實際的名字修改)

ONBOOT="yes"
IPADDR="192.168.1.10"
NETMASK="255.255.255.0"
GATEWAY="192.168.1.1"
DNS1="8.8.8.8"
DNS2="88.88.88.88"

[root@localhost ~]# service network restart

2.安裝網路工具

[root@localhost ~]# yum -y install net-tools

3.安裝常用工具

[root@localhost ~]# yum -y install curl telnet vim wget lrzsz

4.配置阿里yum源

[root@localhost ~]# mkdir ~/backups/yum.repos.d                                                            #備份原yum源

[root@localhost ~]# mv /etc/yum.repos.d/* ~/backups/yum.repos.d

[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

[root@localhost ~]# yum clean all

[root@localhost ~]# yum makecache

[root@localhost ~]# yum list                                                                                                  #列出可用包進行驗證

5.配置SSH遠端連線服務

[root@localhost ~]# yum install -y openssh-server

[root@localhost ~]# sudo systemctl enable sshd

[root@localhost ~]# sudo systemctl start sshd

[root@localhost ~]# sudo firewall-cmd --zone=public --add-port=22/tcp --permanent     #配置防火牆埠開放策略

[root@localhost ~]# sudo service firewalld restart                                                              #重新整