Linux基础配置

由于我们的Linux系统是最小化安装的,所以我们须要配置一些基本的功能,首当其中的就是配置网卡。

配置网卡

首先,使用命令来修改配置文件。

shell">vi /etc/sysconfig/network-scripts/ifcfg-ens33

步入编辑界面后,编撰配置文件并更换为如下内容。

TYPE=Ethernet
BOOTPROTO=static
NAME=ens33
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.1.110
GATEWAY=192.168.1.2
NETMASK=255.255.255.0
DNS1=8.8.8.8

重启网卡,但是进行测试。

service network restart
ping www.baidu.com

关掉防火墙

配置完网卡有了网路以后linux操作系统安装,我们就须要使用远程SSH工具来联接虚拟机进行操作,必要的一步就是关掉防火墙linux课程,如下是临时关掉防火墙的命令

systemctl stop firewalld

严禁防火墙开机启动的命令如下。

systemctl disable firewalld

配置yum

考虑到国外网路的特殊性yum源的配置建议使用阿里云,如下是配置阿里云Base源的命令。

# 备份yum源文件
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
# 配置阿里的yum源
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

Base源中的包不能满足所有软件的环境依赖需求,我们须要配置一些拓展源。

# 配置阿里云epel源
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

配置完yum源以后linux编写配置文件,我们须要清理原先的yum源缓存,并生成新的yum缓存linux编写配置文件,命令如下。

yum clean all
yum makecache fast

安装基本命令

为了便捷系统的使用,我们须要安装一些基本的常用命令。

# 基本命令
yum install gcc gcc-c++ cmake pcre pcre-devel zlib zlib-devel openssl openssl-devel vim wget telnet setuptool lrzsz dos2unix net-tools bind-utils tree screen iftop ntpdate tree lsof iftop iotop -y
# 源码安装软件所需命令
yum groupinstall "Development tools" -y

本文原创地址:https://www.linuxprobe.com/lxtpzwkydjbg.html编辑:刘遄,审核员:暂无