Shell Shell
Home
Shell
Linux
Network
Git
Blog (opens new window)
GitHub (opens new window)
Home
Shell
Linux
Network
Git
Blog (opens new window)
GitHub (opens new window)
  • Linux 核心技能与应用

    • 目录
    • Linux 的安装与配置
    • Linux 基础知识和命令
    • Linux 进阶知识和命令
    • 远程连接和 SSH
    • 文本编辑与版本控制
    • 网络和安全
    • Shell 脚本编程
    • 管理服务器和服务
    • Linux 开发神器
    • 内存与磁盘管理
    • 课程总结
  • Linux 命令行与 Shell 脚本编程大全

  • Linux 实战技能 100 讲

  • CentOS7 环境配置
    • 安装 git
    • 安装 vim
    • 安装 neovim
    • 安装 exa
    • 安装 tldr
    • 安装 zsh
    • 安装 zim
  • CentOS7 更换国内软件源
  • CentOS7 安装 pigz
  • 编写 bash 脚本
  • linux
JaimeZeng
2021-09-07

CentOS7 环境配置

系统环境

➜ ~ cat /etc/system-release
CentOS Linux release 7.9.2009 (Core)

➜ ~ cat /proc/version
Linux version 3.10.0-1160.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) )

➜ ~ cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

# 安装 git

虚拟机使用宿主机代理

windows 10 使用 hyper-v 安装的虚拟机使用宿主机代理

function proxy() {
    ip=$(cat /etc/resolv.conf | grep "nameserver" | cut -d " " -f 2)
    export HTTP_PROXY=http://"$ip":7890
    export HTTPS_PROXY=http://"$ip":7890
    export ALL_PROXY=socks5://"$ip":7890
}

proxy
1
2
3
4
5
6
7
8
$ sudo yum install -y http://opensource.wandisco.com/centos/7/git/x86_64/wandisco-git-release-7-2.noarch.rpm
$ sudo yum install -y git
$ sudo git --version
git version 2.31.1
1
2
3
4

# 安装 vim

## https://github.com/vim/vim/blob/master/src/INSTALL
$ sudo yum install -y make clang libtool-bin ncurses-devel ruby ruby-devel lua lua-devel perl perl-devel python3 python3-devel python2-devel perl-ExtUtils-Embed lrzsz cmake wget gcc gcc-c++ unzip
$ ./configure --with-features=huge \
            --enable-rubyinterp=yes \
            --enable-luainterp=yes \
            --enable-perlinterp=yes \
            --enable-python3interp=yes \
            --enable-pythoninterp=yes \
            --with-python-config-dir=/usr/lib64/python2.7/config \
            --with-python3-config-dir=/usr/lib64/python3.6/config-3.6m-x86_64-linux-gnu \
            --enable-fontset=yes \
            --enable-cscope=yes \
            --enable-multibyte \
            --disable-gui \
            --enable-fail-if-missing \
            --prefix=/usr/local \
            --with-compiledby='Professional operations'
# --with-features=huge:支持最大特性
# --enable-multibyte:打开多字节支持,可以在 Vim 中输入中文
# --enable-rubyinterp:打开对 ruby 编写的插件的支持
# --enable-pythoninterp:打开对 python 编写的插件的支持
# --with-python-config-dir=/usr/lib64/python2.7/config 指定 python 路径(此处是腾讯云 CentOS7.4 的 python2 路径)
# --enable-python3interp:打开对 python3 编写的插件的支持
# --with-python-config-dir=/usr/local/python3.7/lib/python3.7/config-3.7m-x86_64-linux-gnu 指定 python3 路径(此处是我指定位置安装 python3 后的路径,CentOS 编译安装 python3.7.0)
# --enable-perlinterp:打开对 perl 编写的插件的支持
# --enable-luainterp:打开对 lua 编写的插件的支持
# --enable-gui=gtk2:gtk2 支持,也可以使用 gnome,表示生成 gvim
# --enable-cscope:打开对 cscope 的支持
# --enable-fail-if-missing:有问题会提示报错,并停止
# --prefix=/usr/local/vim:指定将要安装到的路径(自行创建)
# make VIMRUNTIMEDIR=/usr/local/bin/vim && make install
$ make && sudo make install
$ vim --version
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Mar  7 2021 11:35:08)

$ curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
    https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
$ curl 'https://vim-bootstrap.com/generate.vim' --data 'editor=vim&frameworks=vuejs&frameworks=svelte&langs=jc&langs=elixir&langs=elm&langs=erlang&langs=go&langs=haskell&langs=html&langs=javascript&langs=lisp&langs=lua&langs=ocaml&langs=perl&langs=php&langs=python&langs=ruby&langs=rust&langs=scala&langs=typescript&themes=dracula' > ~/.vimrc
$ vim +PlugInstall +qall
$ vim +VimBootstrapUpdate +qall
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

# 安装 neovim

$ wget https://github.com/neovim/neovim/releases/download/v0.6.1/nvim-linux64.tar.gz
$ tar -tf ./nvim-linux64.tar.gz
$ tar -xf nvim-linux64.tar.gz
$ chmod +x nvim-linux64/bin/nvim
$ sudo mv -R nvim-linux64/* /usr/local/
$ nvim --version
NVIM v0.6.1
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by runner@fv-az87-780

$ sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
       https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
$ mkdir -p ~/.config/nvim/
$ curl 'https://vim-bootstrap.com/generate.vim' --data 'editor=nvim&frameworks=vuejs&frameworks=svelte&langs=jc&langs=elixir&langs=elm&langs=erlang&langs=go&langs=haskell&langs=html&langs=javascript&langs=lisp&langs=lua&langs=ocaml&langs=perl&langs=php&langs=python&langs=ruby&langs=rust&langs=scala&langs=typescript&themes=dracula' > ~/.config/nvim/init.vim
$ nvim +PlugInstall +qall
$ nvim +VimBootstrapUpdate +qall
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

# 安装 exa

$ wget https://github.com/ogham/exa/releases/download/v0.10.1/exa-linux-x86_64-musl-v0.10.1.zip
$ unzip exa-linux-x86_64-musl-v0.10.1.zip
$ chmod +x bin/exa
$ sudo mv bin/exa /usr/local/bin/exa
$ exa --version
exa - list files on the command-line
v0.10.1 [+git]
https://the.exa.website/
1
2
3
4
5
6
7
8

# 安装 tldr

$ wget https://github.do/https://github.com/psibi/tldr-hs/releases/download/v0.9.2/tldr-musl-linux-v0.9.2.tar.gz
$ tar -xf ./tldr-musl-linux-v0.9.2.tar.gz
$ chmod +x tldr
$ mv tldr /usr/local/bin/
$ mkdir -p /home/jaime/.local/share/tldr
$ tldr --update
$ tldr --version
0.9.2
1
2
3
4
5
6
7
8

# 安装 zsh

# cd /usr/local/src/
# wget https://github.com/zsh-users/zsh/archive/refs/tags/zsh-5.8.1.tar.gz
# tar -xf zsh-5.8.1.tar.gz
# cd zsh-zsh-5.8.1/
# ./Util/preconfig
# ./configure
# make -j 20 install.bin install.modules install.fns
# command -v zsh | sudo tee -a /etc/shells
# chsh -s $(which zsh)
#  zsh --version
zsh 5.8.1 (x86_64-pc-linux-gnu)
1
2
3
4
5
6
7
8
9
10
11

# 安装 zim

$ curl -fsSL https://raw.githubusercontent.com/zimfw/install/master/install.zsh | zsh

# Manual installation
$ sudo chsh -s $(which zsh)
$ nvim ~/.zshrc
$ nvim ~/.zimrc
$ zimfw install
$ zsh
1
2
3
4
5
6
7
8
dotfiles
  • .zimrc (opens new window)

  • .zshrc (opens new window)

  • init.vim (opens new window)

第六章:服务管理篇
CentOS7 更换国内软件源

← 第六章:服务管理篇 CentOS7 更换国内软件源→

Theme by Vdoing | Copyright © 2020-2022 JaimeZeng | ❤️ | CC BY-NC-SA 4.0
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式