Linux系统优化(将国外下载源换成国内下载源)

为了解决以下问题:

  • 解决网络下载软件慢的问题
  • 解决系统软件升级的问题
  • 安装一些常用的计算机软件
  • 关闭一些不必要软件
    • 防火墙
    • selinux

修改系统下载源
https://developer.aliyun.com/mirror/
以下教我们将国外下载源换成国内下载源
在这里插入图片描述
按照如下步骤操作即可:

# 第一步:备份原来源
mkdir /etc/yum.repos.d/backup/
mv /etc/yum.repos.d/CentOS-*  /etc/yum.repos.d/backup/

# 第二步:下载新的源
[root@localhost yum.repos.d]# curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2523  100  2523    0     0    235      0  0:00:10  0:00:10 --:--:--   601
[root@localhost yum.repos.d]# ls -l
total 4
drwxr-xr-x. 2 root root  187 Mar  3 16:14 backup
-rw-r--r--. 1 root root 2523 Mar  3 16:16 CentOS-Base.repo

# 第三步:生成新的源的缓存
[root@localhost yum.repos.d]# yum makecache
Loaded plugins: fastestmirror
Determining fastest mirrors
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
 
# 第四步:更新系统
[root@localhost yum.repos.d]# yum update -y

# 第五步:安装常用的计算机软件
[root@localhost yum.repos.d]# yum install vim lrzsz net-tools tree weget-y

# 第六步:关闭防火墙和Selinux
[root@localhost ~]# systemctl disable --now firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@localhost ~]# sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config 

# 第七步:拍摄快照






yum的指令集

yum repolist all                           #列出所有仓库
yum list all                               #列出仓库中所有软件包
yum info                                   #软件包名称 查看软件包信息
yum install                                #软件包名称 安装软件包
yum reinstall                              #软件包名称 重新安装软件包
yum update                                 #软件包名称 升级软件包
yum remove                                 #软件包 移除软件包
yum clean all                              #清除所有仓库缓存
yum check-update                           #检查可更新的软件包
yum grouplist                              #查看系统中已经安装的软件包组
yum groupinstall                           #软件包组 安装指定的软件包组
yum groupremove                            #软件包组 移除指定的软件包组
yum groupinfo                              #软件包组 查询指定的软件包组信息

猜你喜欢

转载自blog.csdn.net/givenchy_yzl/article/details/114332846
今日推荐