- 《Centos7 Minimal最小安装后要进行的优化》 - https://blog.csdn.net/IAGod/article/details/88815209
- 《Linux IP和网关配置》 https://www.cnblogs.com/linyfeng/p/7534677.html
1.修改网络配置,设置静态IP,方便远程
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-enp0s3
BOOTPROTO=“static”
ONBOOT=“yes”
IPADDR=“192.168.1.2”
NETMASK=“255.255.255.0”
GATEWAY=“192.168.1.1”
DNS1=“8.8.8.8”
DNS2=“88.88.88.88”
<mark>是否加分号,看系统原有配置</mark>
[root@localhost ~]# service network restart
- 《查看 网关》 - https://blog.csdn.net/terence_csdn/article/details/83388597
- ifconfig -a //看netmask ,dns
- netstat -rn //看网关
- ls | less //分页显示
- <mark>上面命令要先安装网络工具</mark>
2.安装网络工具
[root@localhost ~]# yum -y install net-tools
- 安装后就可以使用
ifconfig
命令了
3.安装常用工具
[root@localhost ~]# yum -y install curl telnet vim wget lrzsz
4.配置阿里yum源
[root@localhost ~]# mkdir ~/backups/yum.repos.d -p <~~~~~~~~~~~~~~ #备份原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
<~~~~~~~~~~~~~~ #刷新防火墙