Linux系统优化
YUM仓库优化
防火墙
字符集优化
时间同步
软件安装
扩展优化
一.YUM仓库优化
YUM仓库是什么? 通过yum仓库下载安装软件,类似手机的应用商店。 类似windows下载软件网站。 centos系统默认的仓库地址是在国外.需要将仓库地址修改为国内的仓库。 yum仓库 默认仓库国内服务器 路径:/etc/yum.repos.d/xx.repo Ubuntu仓库 /etc/apt/ 了解当前系统通过哪个仓库安装的软件方法: 1.yum reploist 2.yum -y install wget 为Kylin系统配置扩展仓库epel 将Ubuntu系统配置为国内仓库 必会:kylin安装配置扩展仓库epel 将Ubuntu默认的仓库修改为阿里云 国内YUM仓库: 1.阿里源 https://developer.aliyun.com/mirror/ 2.清华源 https://mirrors.tuna.tsinghua.edu.cn/ 3.重庆大学源 4.华为源 5.腾讯源 扩展的仓库地址epel: 经常使用的软件在基础仓库中没有,所以安装一个扩展的仓库 [root@study ~]# ll /etc/yum.repos.d/ total 4 -rw-r--r-- 1 root root 701 Sep 8 2022 kylin_x86_64.repo
1.默认仓库地址
1.1 查看Kylin默认仓库地址
[root@study ~]# ll /etc/yum.repos.d/ total 4 -rw-r--r-- 1 root root 701 Sep 8 2022 kylin_x86_64.repo # 判断IP地址的归属 [root@study ~]# ping update.cs2c.com.cn PING aitqzjav.slt.sched.tdnsv8.com (101.72.251.68) 56(84) bytes of data. 64 bytes from 101.72.251.68 (101.72.251.68): icmp_seq=1 ttl=128 time=6.85 ms 64 bytes from 101.72.251.68 (101.72.251.68): icmp_seq=2 ttl=128 time=5.82 ms 64 bytes from 101.72.251.68 (101.72.251.68): icmp_seq=3 ttl=128 time=5.96 ms

拿到仓库对应的IP地址 101.72.251.68

浏览器打开ip138.com,确认IP地址归属

1.2 查看Ubuntu默认仓库地址
root@study-inb:~# ll /etc/apt/sources.list -rw-r--r-- 1 root root 2403 Mar 6 14:39 /etc/apt/sources.list # 判断IP地址归属 root@study-inb:~# ping archive.ubuntu.com PING archive.ubuntu.com (185.125.190.82) 56(84) bytes of data. 64 bytes from ubuntu-mirror-2.ps5.canonical.com (185.125.190.82): icmp_seq=1 ttl=128 time=283 ms 64 bytes from ubuntu-mirror-2.ps5.canonical.com (185.125.190.82): icmp_seq=2 ttl=128 time=283 ms ^Z

拿到仓库对应的IP地址 185.125.190.82

浏览器打开 ip138.com,确认IP地址归属

2.Kylin系统安装扩展仓库epel
[root@study ~]# wget -O /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo --2025-03-07 16:26:08-- https://mirrors.aliyun.com/repo/epel-7.repo Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 116.196.141.241, 218.24.90.187, 218.24.90.146, ... Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|116.196.141.241|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 664 [application/octet-stream] Saving to: ‘/etc/yum.repos.d/epel.repo’ /etc/yum.repos.d/epel.r 100%[============================>] 664 --.-KB/s in 0s 2025-03-07 16:26:08 (19.1 MB/s) - ‘/etc/yum.repos.d/epel.repo’ saved [664/664] # 查看epel是否安装成功 [root@study ~]# yum repolist repo id repo name epel Extra Packages for Enterprise Linux 7 - x86_64 ks10-adv-os Kylin Linux Advanced Server 10 - Os ks10-adv-updates Kylin Linux Advanced Server 10 - Updates # sl命令只能通过扩展仓库才可以安装。 [root@study ~]# yum -y install sl

3.Kylin系统配置本地仓库
# 创建iso存放目录和挂载目录
mkdir -p /mnt/{iso,cdrom}
# 上传iso镜像
[root@study ~]# cd /opt/ios/
[root@study ios]# ll
总用量 4471596
-rw-r--r-- 1 root root 4578914304 6月 27 09:02 Kylin-Server-V10-SP3-General-Release-2303-X86_64.iso
# 挂载iso镜像到/mnt/cdrom下
mv /mnt/iso/Kylin-Server-V10-SP3-General-Release-2303-X86_64.iso KylinV10-SP3-General-Release.iso /mnt/iso/KylinV10-SP3-GR.iso
mount -o loop /mnt/iso/KylinV10-SP3-GR.iso /mnt/cdrom
# 创建repo文件并放到/etc/yum.repos.d/目录
mv /etc/yum.repos.d/kylin_x86_64.repo /etc/yum.repos.d/kylin_x86_64.repo.bak
cat >/etc/yum.repos.d/kylin_x86_64.repo<<EOF
###Kylin Linux Advanced Server 10 - os repo###
[ks10-adv-os]
name=Kylin Linux Advanced Server 10 - os
baseurl=file:///mnt/cdrom
gpgcheck=0
enabled=1
EOF
# 开机自动挂载
[root@study etc]# tail -1 /etc/fstab
/mnt/iso/KylinV10-SP3-GR.iso /mnt/cdrom iso9660 defaults 0 0
4.Ubuntu系统修改YUM仓库
4.1 切换到root用户
study@study-inb:~$ sudo su - root [sudo] password for study: #输入用户密码1 root@study-inb:~#
4.2 备份默认仓库
root@study-inb:~# ll /etc/apt total 44 drwxr-xr-x &nb
© 版权声明
文章版权归作者所有,未经允许请勿转载。如内容涉嫌侵权,请在本页底部进入<联系我们>进行举报投诉!
THE END
















暂无评论内容