跳转到内容

环境配置

git

Terminal window
$ yum install git
# 基础配置
$ git config --global user.name Hongbusi
$ git config --global user.email coderhbs@gmail.com
# 生成一个 ssh-key
# -t: 可选择 dsa | ecdsa | ed25519 | rsa | rsa1,代表加密方式
# -C: 注释,一般写自己的邮箱
$ ssh-keygen -t rsa -C "coderhbs@gmail.com"
# 生成 id_rsa/id_rsa.pub: 配对的私钥与公钥
$ ls ~/.ssh
authorized_keys config id_rsa id_rsa.pub known_hosts
# 复制 ~/.ssh/id_rsa.pub 中文件内容,并粘贴到 github 的配置中
$ cat ~/.ssh/id_rsa.pub

zsh

Terminal window
# 安装 zsh
$ yum install zsh
# 默认的 shell 是 bash
$ echo $SHELL
/bin/bash
# 找到 zsh 的默认安装位置
$ which zsh
/usr/bin/zsh
# 打印 shell 列表
$ chsh -l
/bin/sh
/bin/bash
/usr/bin/sh
/usr/bin/bash
/usr/bin/zsh
/bin/zsh
# 更改服务器默认登录的 shell,但此刻不会生效
# -s: --shell,切换为指定的 shell
$ chsh -s /usr/bin/zsh
# 如过想要尽快体验 zsh,可直接输入zsh命令
$ zsh

ohmyzsh

Terminal window
$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

plugin

zsh-autosuggestions

.zshrc
$ git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-myzsh/custom}/plugins/zsh-autosuggestions
plugins=(
zsh-autosuggestions
)
# .zshrc 修改颜色
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#ff00ff,bg=cyan,bold,underline"

zsh-syntax-highlighting

.zshrc
$ git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.ohmy-zsh/custom}/plugins/zsh-syntax-highlighting
plugins=(
zsh-syntax-highlighting
)

autojump

.zshrc
$ brew install autojump
plugins=(
autojump
)

nvm

Terminal window
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
# 安装最新稳定版
$ nvm install --lts

docker

在 CentOS 8 上安装 Docker 可以通过官方的 Docker 社区版(Docker CE)来完成。以下是安装步骤:

  1. 安装 Docker 依赖
Terminal window
$ yum install -y yum-utils device-mapper-persistent-data lvm2
  1. 添加 Docker 存储库
Terminal window
# 安装 docker 官方的镜像源
$ yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
# 如果在国内,安装阿里云的镜像
$ yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
  1. 安装 Docker CE
Terminal window
$ yum install -y docker-ce
  1. 启动 Docker 服务
Terminal window
$ systemctl start docker
  1. 设置 Docker 开机自启
Terminal window
$ systemctl enable docker
  1. 验证 Docker 安装

运行以下命令,检查是否成功安装 Docker,并获取 Docker 版本信息:

Terminal window
$ docker --version

你还可以运行一个简单的测试容器:

Terminal window
sudo docker run hello-world

如果一切正常,你将看到一条提示消息,表明 Docker 已经正确安装并运行。

nginx

Terminal window
$ yum install nginx
$ systemctl enable nginx
$ systemctl start nginx
$ systemctl status nginx
$ systemctl reload nginx