Fedora 配置

Fedora 28

错误:

开机自动配置Ip

Error: Cannot retrieve repository metadata (repomd.xml) for repository: updates-released . Please verify its path and try again。

1.设置ip

(1)修改/etc/yum.repos.d下面的Fedora.repo如下:

    1.启动网卡:ifconfig eno1 up |ifup eno1

[fedora]
name=Fedora $releasever - $basearch
failovermethod=priority
#baseurl=http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
baseurl=http://mirrors.163.com/fedora/releases/$releasever/Everything/$basearch/os/
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch
enabled=1
metadata_expire=7d
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch

    2.查看eno1状态:ethtool eno1

[fedora-debuginfo]
name=Fedora $releasever - $basearch - Debug
failovermethod=priority
#baseurl=http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/$basearch/debug/
baseurl=http://mirrors.163.com/fedora/releases/$releasever/Everything/$basearch/debug/
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-debug-$releasever&arch=$basearch
enabled=1
metadata_expire=7d
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch

    3.获取网关:route Destination:default Gateway:10.240.176.0

[fedora-source]
name=Fedora $releasever - Source
failovermethod=priority
#baseurl=http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/source/SRPMS/
baseurl=http://mirrors.163.com/fedora/releases/$releasever/Everything/source/SRPMS/
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-source-$releasever&arch=$basearch
enabled=1
metadata_expire=7d
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch

    4.配置静态ip:vi /etc/sysconfig/network-scripts/ifcfg-eno1

(2)修改et c/yum.repos.d下面的fedora-updates.repo 如下:

             :/C:Userswuchan4xDocumentsOS issueFedora-infoifcfg-eno1

[updates]
name=Fedora $releasever - $basearch - Updates
failovermethod=priority
#baseurl=http://download.fedoraproject.org/pub/fedora/linux/updates/$releasever/$basearch/
baseurl=http://mirrors.163.com/fedora/updates/$releasever/$basearch/
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-f$releasever&arch=$basearch
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch

2.设置DNS,要不然不能通过域名访问地址

[updates-debuginfo]
name=Fedora $releasever - $basearch - Updates - Debug
failovermethod=priority
#baseurl=http://download.fedoraproject.org/pub/fedora/linux/updates/$releasever/$basearch/debug/
baseurl=http://mirrors.163.com/fedora/updates/$releasever/$basearch/debug/
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-debug-f$releasever&arch=$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch

$ vim /etc/resolv.conf

[updates-source]
name=Fedora $releasever - Updates Source
failovermethod=priority
#baseurl=http://download.fedoraproject.org/pub/fedora/linux/updates/$releasever/SRPMS/
baseurl=http://mirrors.163.com/fedora/updates/$releasever/SRPMS/
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-source-f$releasever&arch=$basearch
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch

    C:Userswuchan4xDocumentsOS issueFedora-inforesolv.conf

(3)设置/etc/yum.conf文件,添加红色部分

3.重启网络服务

[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=3
color=never
proxy=http://192.168.3.119:8081    (我的代理ip和端口号)

service network restart

#  This is the default, if you make this bigger yum won't see if the metadata
# is newer on the remote and so you'll "gain" the bandwidth of not having to
# download the new metadata and "pay" for it by yum not having correct
# information.
#  It is esp. important, to have correct metadata, for distributions like
# Fedora which don't keep old packages around. If you don't like this checking
# interupting your command line usage, it's much better to have something
# manually check the metadata once an hour (yum-updatesd will do this).
# metadata_expire=90m

 

# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
~   

设置镜像源

(4)设置网卡的域名服务器ifcfg-eth0

vi /etc/yum.repos.d/fedora.repo

vim /etc/sysconfig/network-scripts/ifcfg-eth0

        C:Userswuchan4xDocumentsOS issueFedora-infofedora.repo

DEVICE=eth0
HWADDR=00:18:7D:08:CB:F0
NM_CONTROLLED=yes
ONBOOT=yes
IPADDR=192.168.3.253
BOOTPROTO=none
NETMASK=255.255.255.0
TYPE=Ethernet
GATEWAY=192.168.3.1
IPV6INIT=no
USERCTL=no
PREFIX=24
DNS1=XXX.XXX.XXX.XXX

配置代理:proxy

然后就可以#yum install 了~        

1.vim /etc/dnf/dnf.conf (永久)

图片 1

        C:Userswuchan4xDocumentsOS issueFedora-infodnf.conf

2.export http_proxy=http://proxy-prc.intel.com:911 (临时)

 

遇到的问题:

ping baidu.com没问题,curl 1https://www.baidu.com 返回源代码

dnf -y update

Error: Failed to synchronize cache for repo 'fedora' --无法连特殊的网站

resolve:

1.vim /etc/dnf/dnf.conf

add proxy=http://proxy-prc.intel.com:911

proxy_username=root

proxy_password=tester

2.service network restart

当同时开启2个网卡时,ethtool eno1 && eno2 :link yes 会导致无法上网

需要禁用掉一个网卡,ifconfig eno2 down

 

scp传输时如下报错

declare -x FTP_PROXY='http://proxy-prc.intel.com:911'

#vim ~/.bashrc

删除添加的:FTP_PROXY='http://proxy-prc.intel.com:911'

HTTP_PROXY='http://proxy-prc.intel.com:911'

HTTPS_PROXY='http://proxy-prc.intel.com:911'

 

添加ip地址:

ifcfg-eno1

HWADDR=0c:c4:7a:64:96:d6

NAME=enp5s0f0

ONBOOT=yes

TYPE=Ethernet

BOOTPROTO=static

IPADDR=10.240.176.254

NETMASK=255.255.255.128

本文由金沙官网线上发布于操作系统,转载请注明出处:Fedora 配置

您可能还会对下面的文章感兴趣: