抱歉,您的浏览器无法访问本站
本页面需要浏览器支持(启用)JavaScript
了解详情 >

一个细节发现

源里面经常会有这种变量:

1
https://mirrors.aliyun.com/centos-stream/$stream/AppStream/$basearch/os/

$basearch 的值,系统硬件架构(CPU指令集)

架构是aarch64

$stream 的值,就是系统版本了

版本是CentOS Stream release 9

地址代入该系统变量后的路径就是

1
https://mirrors.aliyun.com/centos-stream/9-stream/AppStream/aarch64/os/

打开ssh

1
sudo vim /etc/ssh/sshd_config
  • PermitRootLogin prohibit-password那一行修改为PermitRootLogin yes,去掉前面的#号

  • 将port 22前面的#去掉

更换源

备份

1
sudo mv /etc/yum.repos.d/centos.repo /etc/yum.repos.d/centos.repo.backup

换成阿里源

1
sudo vi /etc/yum.repos.d/centos.repo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
#failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos-stream/$stream/BaseOS/$basearch/os/
http://mirrors.aliyuncs.com/centos-stream/$stream/BaseOS/$basearch/os/
http://mirrors.cloud.aliyuncs.com/centos-stream/$stream/BaseOS/$basearch/os/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official

#additional packages that may be useful
#[extras]
#name=CentOS-$releasever - Extras - mirrors.aliyun.com
#failovermethod=priority
#baseurl=https://mirrors.aliyun.com/centos-stream/$stream/extras/$basearch/os/
# http://mirrors.aliyuncs.com/centos-stream/$stream/extras/$basearch/os/
# http://mirrors.cloud.aliyuncs.com/centos-stream/$stream/extras/$basearch/os/
#gpgcheck=1
#gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.aliyun.com
#failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos-stream/$stream/centosplus/$basearch/os/
http://mirrors.aliyuncs.com/centos-stream/$stream/centosplus/$basearch/os/
http://mirrors.cloud.aliyuncs.com/centos-stream/$stream/centosplus/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official

[PowerTools]
name=CentOS-$releasever - PowerTools - mirrors.aliyun.com
failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos-stream/$stream/PowerTools/$basearch/os/
http://mirrors.aliyuncs.com/centos-stream/$stream/PowerTools/$basearch/os/
http://mirrors.cloud.aliyuncs.com/centos-stream/$stream/PowerTools/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official


[AppStream]
name=CentOS-$releasever - AppStream - mirrors.aliyun.com
#failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos-stream/$stream/AppStream/$basearch/os/
http://mirrors.aliyuncs.com/centos-stream/$stream/AppStream/$basearch/os/
http://mirrors.cloud.aliyuncs.com/centos-stream/$stream/AppStream/$basearch/os/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official
1
2
3
yum clean all
yum makecache
sudo yum update

如果想使用dnf的话,使dnf的源也更新

1
sudo dnf makecache


添加CRB仓库

1
vim /etc/yum.repos.d/centos.repo

最后一行加入

1
2
3
4
5
6
7
8
[crb]
name = =CentOS-$releasever - CRB - mirrors.aliyun.com
#failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos-stream/$stream/CRB/$basearch/os/
http://mirrors.aliyuncs.com/centos-stream/$stream/CRB/$basearch/os/
http://mirrors.cloud.aliyuncs.com/centos-stream/$stream/CRB/$basearch/os/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official
1
2
dnf makecache
yum makecache

用crb下载

1
dnf --enablerepo=crb install <包名> -y

可以通过https://pkgs.org/来查看要下载的包,是属于哪个仓库源的


安装vim

1
sudo yum search vim
1
sudo yum install vim-enhanced.aarch64

安装oh-my-zsh

安装git

1
2
sudo yum search git
sudo yum install git.aarch64

安装zsh

1
sudo yum install zsh

更改默认shell

1
chsh -s /usr/bin/zsh

github 443拒绝访问

1
sudo vim /etc/hosts

加入

1
192.30.255.113 github.com

就可以ping通了

安装oh-my-zsh(不能用ssh)

1
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

网不好的情况下,就把脚本内容复制过来,在里面装

1
2
3
vim install.sh
chmod +x install.sh
sudo ./install.sh

配置文件

1
vim ~/.zshrc

修改主题

修改这一行ZSH_THEME="robbyrussell"将主题修改为自己喜欢的

1
ZSH_THEME="agnoster"

重新加载配置文件

1
source ~/.zshrc

下载插件

自动提示

1
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions

语法高亮

1
git clone https://github.com/zsh-users/zsh-syntax-highlighting ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
1
echo "source ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ~/.zshrc

修改配置文件,生效插件

1
vim ~/.zshrc

找到插件位置,添加刚刚的插件

1
source ~/.zshrc

改自动提示颜色、亮度

PS:如果重新打开终端看不到自动提示,可能是终端的字体颜色太淡了,可以通过👇配置把字体改亮一些:

1
cd ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions

修改自动提示相关的配置文件:ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=10'

1
2
vi zsh-autosuggestions.zsh
source ~/.zshrc

修改主题目录颜色

1
sudo vim ~/.oh-my-zsh/themes/agnoster.zsh-theme

评论