国产操作系统安装 之 联网、gcc、rust、exa、zsh5.8、Oh My Zsh、powerlevel10k、git、高亮插件、补全命令插

编程入门 行业动态 更新时间:2024-10-11 19:22:29

国产操作<a href=https://www.elefans.com/category/jswz/34/1767252.html style=系统安装 之 联网、gcc、rust、exa、zsh5.8、Oh My Zsh、powerlevel10k、git、高亮插件、补全命令插"/>

国产操作系统安装 之 联网、gcc、rust、exa、zsh5.8、Oh My Zsh、powerlevel10k、git、高亮插件、补全命令插

中标麒麟版本:kylinos-server-v7.0-x86_64.iso 3.99 GB
主机平台:intel x86

一、联网

1、编辑 ifcfg-eth0 文件,vim 最小化安装时没有被安装,需要自行安装不描述。

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

2、修改如下内容

BOOTPROTO="static" #dhcp改为static 
ONBOOT="yes" #开机启用本配置
IPADDR=10.1.40.102 #静态IP
GATEWAY=10.1.40.1 #默认网关
NETMASK=255.255.255.0 #子网掩码
DNS1=192.168.7.1 #DNS 配置

如果是虚拟机安装,比如pd安装

BOOTPROTO="static" #dhcp改为static 
ONBOOT="yes" #开机启用本配置
IPADDR=10.211.55.72 #静态IP
GATEWAY=10.211.55.1 #默认网关
NETMASK=255.255.255.0 #子网掩码
DNS1=10.211.55.1 #DNS 配置

3、修改后效果(需要修改的地方有注释)

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

HWADDR="00:15:5D:07:F1:02"
TYPE="Ethernet"
BOOTPROTO="static" #dhcp改为static 
DEFROUTE="yes"
PEERDNS="yes"
PEERROUTES="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_PEERDNS="yes"
IPV6_PEERROUTES="yes"
IPV6_FAILURE_FATAL="no"
NAME="eth0"
UUID="bb3a302d-dc46-461a-881e-d46cafd0eb71"
ONBOOT="yes" #开机启用本配置
IPADDR=10.1.40.102 #静态IP
GATEWAY=10.1.40.1 #默认网关
NETMASK=255.255.255.0 #子网掩码
DNS1=192.168.7.1 #DNS 配置

4、重启下网络服务

service network restart

5、ping

ping qq

[root@localhost ~]# ping qq
PING qq (61.129.7.47) 56(84) bytes of data.
64 bytes from 61.129.7.47 (61.129.7.47): icmp_seq=1 ttl=50 time=30.5 ms
64 bytes from 61.129.7.47 (61.129.7.47): icmp_seq=2 ttl=50 time=30.2 ms
64 bytes from 61.129.7.47 (61.129.7.47): icmp_seq=3 ttl=50 time=30.1 ms
64 bytes from 61.129.7.47 (61.129.7.47): icmp_seq=4 ttl=50 time=30.2 ms

6、联网后第一件事:update

yum update

二、exa

/
/

1、安装rust编译器

curl -sSf | sh

2、安装提示,重新打开shell

3、安装exa

cargo install exa

[root@localhost ~]# cargo install exaUpdating crates.io indexFetch [========>                ]  39.40%                                                                         

4、出错了

error: linker `cc` not found|= note: No such file or directory (os error 2)error: aborting due to previous errorerror: could not compile `log`To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: linker `cc` not found|= note: No such file or directory (os error 2)error: aborting due to previous errorerror: linker `cc` not found|= note: No such file or directory (os error 2)error: aborting due to previous errorerror: failed to compile `exa v0.10.1`, intermediate artifacts can be found at `/tmp/cargo-installpF3yZD`

意思是没有gcc呗,装

sudo yum -y install gcc

(⚠️:安装redis也可能用到gcc哦)

5、再来

cargo install exa

Updating crates.io index
warning: spurious network error (2 tries remaining): SSL error: syscall failure: Connection reset by peer; class=Os (2)
Installing exa v0.10.1
Compiling libc v0.2.98
Compiling pkg-config v0.3.19
Compiling matches v0.1.8
Compiling tinyvec_macros v0.1.0
Compiling log v0.4.14
Compiling unicode-width v0.1.8
Compiling cfg-if v1.0.0
Compiling bitflags v1.2.1
Compiling percent-encoding v2.1.0
Compiling byteorder v1.4.3
Compiling number_prefix v0.4.0
Compiling lazy_static v1.4.0
Compiling ansi_term v0.12.1
Compiling glob v0.3.0
Compiling scoped_threadpool v0.1.9
Compiling natord v1.0.9
Compiling tinyvec v1.2.0
Compiling unicode-bidi v0.3.5
Compiling pad v0.1.6
Compiling term_grid v0.1.7
Compiling form_urlencoded v1.0.1
Compiling unicode-normalization v0.1.19
Compiling jobserver v0.1.22
Compiling locale v0.2.2
Compiling users v0.11.0
Compiling num_cpus v1.13.0
Compiling term_size v0.3.2
Compiling cc v1.0.69
Compiling datetime v0.5.2
Compiling zoneinfo_compiled v0.5.1
Compiling idna v0.2.3
Compiling exa v0.10.1
Compiling libz-sys v1.1.3
Compiling libgit2-sys v0.12.21+1.1.0
Compiling url v2.2.2
Compiling git2 v0.13.20
Finished release [optimized] target(s) in 6m 48s
Installing /root/.cargo/bin/exa
Installed package `exa v0.10.1` (executable `exa`)

6、使用exa

[root@localhost ~]# exa -la
.rw-------   565 root 17 7月  23:19 .bash_history
.rw-r--r--@   18 root 29 12月  2013 .bash_logout
.rw-r--r--@  197 root 17 7月  20:37 .bash_profile
.rw-r--r--@  197 root 17 7月  20:37 .bashrc
drwxr-xr-x     - root 17 7月  22:32 .cargo
.rw-r--r--@  100 root 29 12月  2013 .cshrc
drwxr-----     - root 17 7月  20:36 .pki
.rw-r--r--    21 root 17 7月  20:37 .profile
drwxr-xr-x     - root 17 7月  20:37 .rustup
.rw-r--r--@  129 root 29 12月  2013 .tcshrc
.rw-------@ 1.3k root 17 7月  19:45 anaconda-ks.cfg
[root@localhost ~]# 

三、安装zsh、git

yum install -y zsh git

[root@localhost ~]# git --version
git version 2.23.0
[root@localhost ~]# 

sh -c “$(curl -fsSL .sh)”

[root@localhost ~]# sh -c "$(curl -fsSL .sh)"
Cloning Oh My Zsh...
正克隆到 '/root/.oh-my-zsh'...
remote: Enumerating objects: 1239, done.
remote: Counting objects: 100% (1239/1239), done.
remote: Compressing objects: 100% (1204/1204), done.
remote: Total 1239 (delta 20), reused 1099 (delta 15), pack-reused 0
接收对象中: 100% (1239/1239), 863.89 KiB | 315.00 KiB/s, 完成.
处理 delta 中: 100% (20/20), 完成.Looking for an existing zsh config...
Using the Oh My Zsh template file and adding it to ~/.zshrc.Time to change your default shell to zsh:
Do you want to change your default shell to zsh? [Y/n] y
Changing the shell...
Changing shell for root.
Shell changed.
Shell successfully changed to '/bin/zsh'.__                                     ______  / /_     ____ ___  __  __   ____  _____/ /_/ __ \/ __ \   / __ `__ \/ / / /  /_  / / ___/ __ \
/ /_/ / / / /  / / / / / / /_/ /    / /_(__  ) / / /
\____/_/ /_/  /_/ /_/ /_/\__, /    /___/____/_/ /_//____/                       ....is now installed!Before you scream Oh My Zsh! please look over the ~/.zshrc file to select plugins, themes, and options.• Follow us on Twitter: 
• Join our Discord server: 
• Get stickers, shirts, coffee mugs and other swag: ➜  ~ 

好家伙,zsh装了个5.0.7,powerlevel10k至少需要5.1

四、安装zsh5.8、插件、powerlevel10k

前置安装:

yum -y install perl-ExtUtils-MakeMaker ncurses-devel autoconf

下载最新的zsh-5.8.tar.xz包,并上传到Linux系统中

yum -y install perl-ExtUtils-MakeMaker autoconf
yum -y install ncurses-devel
# 编译安装
cd zsh-5.8
./configure
make && make install
# 将zsh加入/etc/shells
vim /etc/shells # 添加:/usr/local/bin/zsh

安装插件,参考这篇Centos7源码安装最新的zsh并安装oh-my-zsh

在zsh中有一些好用的插件,这里介绍几个常用的,安装的插件都存放在 ~/.oh-my-zsh/custom/plugins下:

安装以下几个插件并添加到.zshrc文件中的plugins中后,在命令行中执行命令时,会有语法高亮,历史命令提示,和路径补全等

zsh-syntax-highlighting:语法高亮,命令正确执行时是绿色的,失败时是红色的

git clone .git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

zsh-autosuggestions:输入命令时,会提供命令补全,路径补全等,按键盘 → 补全

git clone ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

zsh-history-substring-search:这个是记住执行过的命令的,使用上下键可以方便的再次执行指定的命令

git clone ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-history-substring-search

安装完插件后,编辑.zshrc文件,把插件都添加到文件中去:

# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; thensource "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH# Path to your oh-my-zsh installation.
export ZSH="/root/.oh-my-zsh"# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See 
# ZSH_THEME="robbyrussell"
ZSH_THEME="powerlevel10k/powerlevel10k"
# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in $ZSH/themes/
# If set to an empty array, this variable will have no effect.
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"# Uncomment the following line to automatically update without prompting.
# DISABLE_UPDATE_PROMPT="true"# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13# Uncomment the following line if pasting URLs and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS="true"# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"# Uncomment the following line to display red dots whilst waiting for completion.
# Caution: this setting can cause issues with multiline prompts (zsh 5.7.1 and newer seem to work)
# See 
# COMPLETION_WAITING_DOTS="true"# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy"# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(gitzsh-syntax-highlightingzsh-autosuggestionszsh-history-substring-search)source $ZSH/oh-my-zsh.sh# User configuration# export MANPATH="/usr/local/man:$MANPATH"# You may need to manually set your language environment
# export LANG=en_US.UTF-8# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
#   export EDITOR='vim'
# else
#   export EDITOR='mvim'
# fi# Compilation flags
# export ARCHFLAGS="-arch x86_64"# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

0. 设置代理

具体教程看:终端设置http https SOCKS代理

这个代理好了,不用设置git代理。

1. 安装git

安装:

sudo apt-get install git

配置:

git config --global http.proxy "http://192.168.1.101:53327"
git config --global https.proxy "https://192.168.1.101:53327"
git config --global http.proxy "socks5://127.0.0.1:1080"
git config --global https.proxy "socks5://127.0.0.1:1080"
git config --global user.name suvancheng
git config --global user.email suvancheng@outlook

查看配置:

git config --list

2. 安装zsh

安装:

sudo apt-get install zsh

启动:

chsh -s /bin/zsh

查看是否启动:

echo $0

3. 安装Oh My Zsh

官网:
安装:sh -c "$(curl -fsSL .sh)"

huanghe% sh -c "$(curl -fsSL .sh)"
Cloning Oh My Zsh...
正克隆到 '/home/huanghe/.oh-my-zsh'...
remote: Enumerating objects: 1243, done.
remote: Counting objects: 100% (1243/1243), done.
remote: Compressing objects: 100% (1207/1207), done.
remote: Total 1243 (delta 20), reused 1100 (delta 15), pack-reused 0
接收对象中: 100% (1243/1243), 864.95 KiB | 7.00 KiB/s, 完成.
处理 delta 中: 100% (20/20), 完成.Looking for an existing zsh config...
Found ~/.zshrc. Backing up to /home/huanghe/.zshrc.pre-oh-my-zsh
Using the Oh My Zsh template file and adding it to ~/.zshrc.__                                     ______  / /_     ____ ___  __  __   ____  _____/ /_/ __ \/ __ \   / __ `__ \/ / / /  /_  / / ___/ __ \
/ /_/ / / / /  / / / / / / /_/ /    / /_(__  ) / / /
\____/_/ /_/  /_/ /_/ /_/\__, /    /___/____/_/ /_//____/                       ....is now installed!Before you scream Oh My Zsh! please look over the ~/.zshrc file to select plugins, themes, and options.• Follow us on Twitter: 
• Join our Discord server: 
• Get stickers, shirts, coffee mugs and other swag: ➜  ~ 

4. 安装exa

zsh --versionzsh --version
sudo apt-get install exa

配置alias

sudo vim ./.zshrc
alias l="exa -l"
alias la="exa -la"

安装romkatv/powerlevel10k

确保zsh版本大于5.7:zsh --version
官网:

安装:

git clone --depth=1 .git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

修改zshrc:Set ZSH_THEME="powerlevel10k/powerlevel10k" in ~/.zshrc

安装插件

安装以下几个插件并添加到.zshrc文件中的plugins中后,在命令行中执行命令时,会有语法高亮,历史命令提示,和路径补全等

zsh-syntax-highlighting:语法高亮,命令正确执行时是绿色的,失败时是红色的

git clone .git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

zsh-autosuggestions:输入命令时,会提供命令补全,路径补全等,按键盘 → 补全

git clone  ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

zsh-history-substring-search:这个是记住执行过的命令的,使用上下键可以方便的再次执行指定的命令

git clone  ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-history-substring-search

安装完插件后,编辑.zshrc文件,把插件都添加到文件中去:

# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
。。。。
。省略 。
。。。。
# Add wisely, as too many plugins slow down shell startup.
plugins=(gitzsh-syntax-highlightingzsh-autosuggestionszsh-history-substring-search)source $ZSH/oh-my-zsh.sh
。。。。
。省略 。
。。。。
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

更多推荐

国产操作系统安装 之 联网、gcc、rust、exa、zsh5.8、Oh My Zsh、powerlevel10k、git、高亮插件、补全命令插

本文发布于:2024-03-14 16:19:23,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1736855.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:系统安装   插件   命令   操作   gcc

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!