0) cdrom中挂载镜像文件
1) 创建目录
.mkdir /mnt/cdrom
2) 挂载cdrom 到目录
mount /dev/cdrom /mnt/cdrom
卸载时可用: unmount /mnt/cdrom
3)创建cdrom.repo文件
vi /etc/yum.repos.d/cdrom.repo
内容如下:
[cdrom]
name=CentOS7-cdrom //查看其它repo文件,复制过来
baseurl=file:///mnt/cdrom/
enable=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 //参考其它repo文件,复制过来
4) 测试查看cdrom的软件包列表
yum --disablerepo=* --enablerepo=cdrom list
5) 使用本地源安装
yum --disablerepo=* --enablerepo=cdrom install -y httpd
6) 修改 ks10-adv.repo文件(以kylin v10为例, /etc/yum.repos.d文件夹中) ,将地址替换为cdrom
7) 清理并重新生成yum缓存 (yum update为更新所有包,自动升级为最新,不要用)
yum clean all
yum makecache
b) apt做法
0) cdrom中挂载镜像文件
1) 创建目录
mkdir /media/cdrom
2) 把cd驱动器挂载到 /media/cdrom
mount -t iso9660 -o loop /dev/cdrom /media/cdrom
3) 自动添加cdrom到 /etc/apt/sources.list中 (需要将/etc/apt/sources.list中 其他地址全部屏蔽)
apt-cdrom -m -d=/media/cdrom add
命令执行成功后,查看 /etc/apt/sources.list 是否已增加cdrom,并将其他地址全部屏蔽
4) 缓存包到本地
apt-get update
[ks10-adv-os]
name=Kylin Linux Advanced Server 10 - os
baseurl=http://archive.kylinos.cn/yum/v10/pks/aarch64/os/
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-kylin-release
enabled=1
centos配置yum源 网络yum源配置 1.把默认yum源备份(可选)#mkdir /opt/centos-yum.bak #mv /etc/yum.repos.d/* /opt/centos-yum.bak/2.查看系统版本cat /etc/redhat-release //查看系统的版本CentOS Linux release 7.2.1511 (Core) 3.下载aliyun yum源repo文件(对应自己的系统版本下载即可)CentOS 5wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo CentOS 6wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo CentOS 7wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo wget http://mirrors.163.com/.help/CentOS7-Base-163.repo wget http://mirrors.aliyun.com/repo/Centos-7.repo4. 清除缓存#yum clean all#yum makecache //把yum源缓存到本地,加快软件的搜索好安装速度#yum list //总共列出了9954个包centos镜像源配置 上传镜像到服务器cd /mntmkdir cdrom //新建挂在目录mount 镜像名称 /mnt/cdrom //挂载镜像cd /etc/yum.repos.dcp -r yum.repos.d yum.repos.d.bak //备份repos.d文件rm -rf /etc/yum.repos.d/* //清空repos.d目录下文件touch local.repo//新建repo文件vi local.repo//编辑repo文件 [yum]name=centos7.6baseurl = file:///mnt/cdrom //镜像挂载目录gpgcheck =0enabled =1 退出:wqyum clean allYum makecache局域网yum源配置 1.备份yum源rm -f /etc/yum.repos.d/*cat>/etc/yum.repos.d/local.repo 2.查看系统版本cat /etc/redhat-release //查看系统的版本CentOS Linux release 7.2.1511 (Core) 3.编辑yum配置文件vi /etc/yum.repos.d/local.repo 【yum】name= centos7.5baseurl=http://ip地址/yum/centos7.2gpgcheck =0enabled =1 4.清楚缓存yum clean allyum makecachedeepin系统配置apt-get 1.备份source.list文件cp /etc/apt/source.list /etc/apt/source.list.bak 2、编辑源列表文件(网络源把网址换成ali或163地址即可) vim /etc/apt/source.listdeb http://ip地址:/yum/deepin kui main contrib non-free3.更新apt缓存4.apt-get updatemain由符合DFSG标准的软件包组成,不依赖于main外的软件来运行。这是debian发行时默认启用的仓库组成。contrib 软件包包含符合DFSG标准的软件,但依赖项不在main中(可能是非自由的Debian打包)。non-free非自由,包含不符合DFSG的软件。lion、panda 是发行版的仓库代号 通过apt命令已安装软件apt list --installeddpkg -lubuntu配置网络apt源1.备份源文件备份 sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak2.查看新版本信息lsb_release -c得到系统的系统代号:我们可以看到新版本的Ubuntu系统代号为bionic同样的我们也可以得到之前任意版本的系统代号:Ubuntu 12.04 (LTS)代号为precise。Ubuntu 14.04 (LTS)代号为trusty。Ubuntu 15.04 代号为vivid。Ubuntu 15.10 代号为wily。Ubuntu 16.04 (LTS)代号为xenial。3.编辑源列表文件sudo vi /etc/apt/sources.list 4.将原有的内容注释掉,添加以下内容 (src-源码)deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse5.更新软件列表运行如下命令:sudo apt-get update 6.更新软件包运行如下命令:sudo apt-get upgrade银河麒麟系统配置apt网络源 1、查看系统版本cat /proc/version 2、备份原list文件cd /etc/aptsudo cp sources.list sources.list.bak3、编辑新list文件vi sources.listdeb http://mirrors.163.com/debian/ jessie main non-free contrib deb http://mirrors.163.com/debian/ jessie-updates main non-free contrib deb http://mirrors.163.com/debian/ jessie-backports main non-free contrib deb-src http://mirrors.163.com/debian/ jessie main non-free contrib deb-src http://mirrors.163.com/debian/ jessie-updates main non-free contrib deb-src http://mirrors.163.com/debian/ jessie-backports main non-free contrib deb http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib deb-src http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib4、更新apt源 sudo apt-get clean apt-get update 5、安装软件包 apt-get install ant欢迎分享,转载请注明来源:夏雨云
评论列表(0条)