Cento7配置网络及代理
1、配置网络
编辑网卡配置文件
[root@localhost yum.repos.d]# vim /etc/sysconfig/network-scripts/ifcfg-eno16777736
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=eno16777736
UUID=0fc4b7e3-c161-4644-8121-5c576f1f1018
DEVICE=eno16777736
ONBOOT=yes
DNS1=192.168.163.2
IPADDR=192.168.163.136
PREFIX=24
GATEWAY=192.168.163.2
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
2、配置代理
(1)编辑profile文件
[root@localhost yum.repos.d]# vim /etc/profile
#添加Proxy代理信息(其中username和password根据需要填写,若无则不填写)
http_proxy = http://username:password@proxy_ip:port/
https_proxy = http://username:password@proxy_ip:port/
ftp_proxy = http://username:password@proxy_ip:port/
export http_proxy
export https_proxy
export ftp_proxy
#生效配置
source /etc/profile
(2)yum代理设置
编辑yum.conf文件
[root@localhost yum.repos.d]# vim /etc/yum.conf
添加Proxy代理信息
proxy = http://username:password@proxy_ip:port/
(2)wget代理设置
#编辑/wgetrc文件
[root@localhost yum.repos.d]# vim /etc/wgetrc
修改Proxy代理信息
http_proxy=http://username:password@proxy_ip:port/
ftp_proxy=http://username:password@proxy_ip:port/
(4)下载阿里云镜像
进入yum.repos.d目录,备份好原有的镜像。
[root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
[root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
然后执行
[root@localhost yum.repos.d]# yum clean all
[root@localhost yum.repos.d]# yum makecache
至此网络配置、代理配置完成。
还没有评论,来说两句吧...