centos 系统运维基础篇(全新服务器)

1 修改服务器ip地址及网络信息【设置静态ip地址】

centos7的网络IP地址配置文件在  /etc/sysconfig/network-scripts 文件夹下,ens33网卡对应的配置文件为ifcfg-ens33,

使用 ifconfig 可以查看网络信息【没有该命令,可以使用 域名install net-tools 安装命令】(系统自带命令  ip addr)

vim  ifconfig-ens33【修改并新增如下配置,根据实际情况调整ip地址】

BOOTPROTO="static"         # 使用静态IP地址,默认为dhcp
IPADDR="192.168.241.100"   # 设置的静态IP地址
NETMASK="255.255.255.0"    # 子网掩码
GATEWAY="192.168.241.2"    # 网关地址
DNS1="192.168.241.2"       # DNS服务器

...
UUID="95b614cd-79b0-4755-b08d-99f1cca7271b"
DEVICE="ens33"
ONBOOT="yes"             #是否开机启用

2 安装并更新yum 文件

cd /etc/yum.repos.d #此目录存放yum源的文件
1.首先备份旧文件
mv CentOS-Base.repo CentOS-Base.repo.bak
2.下载阿里源的文件
wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
3.安装epel repo源
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
4.清理缓存,重新生成缓存
yum clean all
yum makecache fast

注:虚拟机本地环境下,开启http代理

系统环境代理设置

编辑文件为/etc/profile,如果只想给自己的账户设置,则编辑~/.bashrc即可

添加三行:

# add proxy for network
export http_proxy="http://child-prc.intel.com:913"
export https_proxy="http://child-prc.intel.com:913"
export ftp_proxy=$http_proxy

然后source /etc/profile 或者source ~/.bashrc即可

参考:https://www.cnblogs.com/kinwing/p/11115889.html

原文地址:https://www.cnblogs.com/sien6/p/15322849.html