热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

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

中标麒麟版本:kylinos-server-v7.0-x86_64.iso3.99GB主机平台:intelx86一、联网1、编辑ifcfg-eth0文

中标麒麟版本: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.com


[root@localhost ~]# ping qq.com
PING qq.com (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

https://github.com/ogham/exa/
https://the.exa.website/

1、安装rust编译器


curl https://sh.rustup.rs -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 723:19 .bash_history
.rw-r--r--@ 18 root 29 122013 .bash_logout
.rw-r--r--@ 197 root 17 720:37 .bash_profile
.rw-r--r--@ 197 root 17 720:37 .bashrc
drwxr-xr-x - root 17 722:32 .cargo
.rw-r--r--@ 100 root 29 122013 .cshrc
drwxr----- - root 17 720:36 .pki
.rw-r--r-- 21 root 17 720:37 .profile
drwxr-xr-x - root 17 720:37 .rustup
.rw-r--r--@ 129 root 29 122013 .tcshrc
.rw-------@ 1.3k root 17 719: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 https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)”


[root@localhost ~]# sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.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: https://twitter.com/ohmyzsh
• Join our Discord server: https://discord.gg/ohmyzsh
• Get stickers, shirts, coffee mugs and other swag: https://shop.planetargon.com/collections/oh-my-zsh➜ ~

好家伙,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 https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting


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


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


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


git clone https://github.com/zsh-users/zsh-history-substring-search ${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 https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
# 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 https://github.com/ohmyzsh/ohmyzsh/issues/5765
# 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.com

查看配置:

git config --list

2. 安装zsh

安装:

sudo apt-get install zsh

启动:

chsh -s /bin/zsh

查看是否启动:

echo $0

3. 安装Oh My Zsh

官网:https://github.com/ohmyzsh/ohmyzsh
安装:sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

huanghe% sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.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: https://twitter.com/ohmyzsh
• Join our Discord server: https://discord.gg/ohmyzsh
• Get stickers, shirts, coffee mugs and other swag: https://shop.planetargon.com/collections/oh-my-zsh➜ ~

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
官网:https://github.com/romkatv/powerlevel10k

安装:

git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.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 https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

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

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

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

git clone https://github.com/zsh-users/zsh-history-substring-search ${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

推荐阅读
  • postgresql数据库主备安装,备份还原
    一.postgresql数据库安装1.下载软件包地址:PostgreSQL:FileBrowser2.解压安装[rootpostgresqlu01]#tar-z ... [详细]
  • 本文介绍了5个基本Linux命令行工具的现代化替代品,包括du、top和ncdu。这些替代品在功能上进行了改进,提高了可用性,并且适用于现代化系统。其中,ncdu是du的替代品,它提供了与du类似的结果,但在一个基于curses的交互式界面中,重点关注占用磁盘空间较多的目录。 ... [详细]
  • ps:写的第一个,不足之处,欢迎拍砖---只是想用自己的方法一步步去实现一些框架看似高大上的小功能(比如说模型中的toArraytoJsonsetAtt ... [详细]
  • 基于SSL的mysql服务器的主从架构实现说明:本文选用172.16.22.1作为主服务器,172.16.22.3作为从服务器从服务器的mysql软件版 ... [详细]
  • 痞子衡嵌入式:对比MbedTLS算法库纯软件实现与i.MXRT上DCP,CAAM硬件加速器实现性能差异...
    大家好,我是痞子衡,是正经搞技术的痞子。今天痞子衡给大家介绍的是MbedTLS算法库纯软件实现与i.MXRT上DCP,CAAM硬件加速器实现性能差异。近 ... [详细]
  • 篇首语:本文由编程笔记#小编为大家整理,主要介绍了Mycat水平分表相关的知识,希望对你有一定的参考价值。 ... [详细]
  • nvm如何改node默认版本
    小编给大家分享一下nvm如何改node默认版本,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!nvm改node默认版 ... [详细]
  • 本篇博文面向Linux用户,在Linux下(0x00为什么需要有两个版本的PythonPython2和Python3不兼容是每个接触过Python的那就把Python ... [详细]
  • 在Docker中,将主机目录挂载到容器中作为volume使用时,常常会遇到文件权限问题。这是因为容器内外的UID不同所导致的。本文介绍了解决这个问题的方法,包括使用gosu和suexec工具以及在Dockerfile中配置volume的权限。通过这些方法,可以避免在使用Docker时出现无写权限的情况。 ... [详细]
  • 本文介绍了在rhel5.5操作系统下搭建网关+LAMP+postfix+dhcp的步骤和配置方法。通过配置dhcp自动分配ip、实现外网访问公司网站、内网收发邮件、内网上网以及SNAT转换等功能。详细介绍了安装dhcp和配置相关文件的步骤,并提供了相关的命令和配置示例。 ... [详细]
  • Nginx使用(server参数配置)
    本文介绍了Nginx的使用,重点讲解了server参数配置,包括端口号、主机名、根目录等内容。同时,还介绍了Nginx的反向代理功能。 ... [详细]
  • 图解redis的持久化存储机制RDB和AOF的原理和优缺点
    本文通过图解的方式介绍了redis的持久化存储机制RDB和AOF的原理和优缺点。RDB是将redis内存中的数据保存为快照文件,恢复速度较快但不支持拉链式快照。AOF是将操作日志保存到磁盘,实时存储数据但恢复速度较慢。文章详细分析了两种机制的优缺点,帮助读者更好地理解redis的持久化存储策略。 ... [详细]
  • 本文介绍了如何使用C#制作Java+Mysql+Tomcat环境安装程序,实现一键式安装。通过将JDK、Mysql、Tomcat三者制作成一个安装包,解决了客户在安装软件时的复杂配置和繁琐问题,便于管理软件版本和系统集成。具体步骤包括配置JDK环境变量和安装Mysql服务,其中使用了MySQL Server 5.5社区版和my.ini文件。安装方法为通过命令行将目录转到mysql的bin目录下,执行mysqld --install MySQL5命令。 ... [详细]
  • 本文目标是构建随处可用的内核开发环境,用于Linux内核调度器的研究。开发环境的开发套件由docker,ubuntu14.04,qemu,vim,zsh等构成。按照该开发环境的套件 ... [详细]
  • 今天才发现了一个刷新三观的问题。那就是pycharm的底层集成的debugger功能其实是依赖于几个测试框架。。现在由于要写基于pytest的测试,但是如果到zsh里 ... [详细]
author-avatar
koglum
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有